P6A-8: Source Reference Bundle and harness profile aji_source

- source bundle: a /docs directory with QUICK.md (Quick Reference plus a
  where-to-read table), language/*.md, diagnostics/errors.md and the AIR
  bundle only under air/; built from docs/agent/source-bundle.txt
  (> output files, @manifest includes) by zig build agent-reference
- Quick Reference examples are checked: every aji block must be an
  excerpt of a conformance program in tests/conformance/source/quickref
  (zig build test fails otherwise); QR fixes found by the check
  (mut d = data, region not auto-borrowed, statement/borrow blocks that
  could not verify, io_error match)
- frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006
- aji lower --stats: mechanical_air_eliminated_raw and _normalized (each
  byte-string materialization counted as one constant; spec 15 §11)
- harness: profile aji_source (doc_groups), per-file and per-group docs
  metrics on distinctive lines, profile columns (tool calls, lowered AIR
  raw/normalized, docs files read, IR-form and type-mismatch counts),
  dev-echo aji_source variant, scripted run and test, source token report
- plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block
  deferred
This commit is contained in:
dev committed 2026-10-05 13:16:51 +03:00
1 parent 61be766634
commit 3e2d9b63a7
35 files changed
+1170 -106

No files matched your search

+15
View File
@@ -102,6 +102,21 @@ class RunTest(unittest.TestCase):
self.assertEqual(len(rows), len(languages.available()))
self.assertTrue(all(r["verified_success_rate"] == 1.0 for r in rows))
@unittest.skipUnless(SANDBOX == "bwrap", "bubblewrap unavailable")
def test_source_docs_metrics(self):
# The Source Reference Bundle is a directory: reading is measured per file and per group.
_, rec = self.run_lang("aji_source")
self.assertTrue(rec["accepted"], rec["verdict"])
d = rec["metrics"]["context"]["docs"]
self.assertEqual(d["files_opened"], ["QUICK.md"])
self.assertEqual(d["unique_docs_read"], 1)
self.assertGreater(d["coverage_by_section"]["QUICK.md"], 0.9)
self.assertEqual(d["coverage_by_section"]["air/reference.md"], 0.0)
for g in ("quick_reference_tokens", "source_docs_tokens", "air_docs_tokens", "full_source_docs_tokens"):
self.assertGreater(d[g], 0)
self.assertEqual(d["full_source_docs_tokens"], d["quick_reference_tokens"] + d["source_docs_tokens"])
self.assertEqual(d["read_tokens_by_group"]["air_docs"], 0)
def test_tool_budget(self):
_, rec = self.run_lang("aji_air", limits={"tool_calls": 3})
self.assertEqual(rec["metrics"]["termination"], "budget_tool_calls")