Skip to content

Code map kept current, criteria traced to proof, non-functional checks in plans - #780

Merged
nambok merged 2 commits into
mainfrom
code-map-trace-checklists
Nov 18, 2026
Merged

nambok merged 2 commits into
mainfrom
code-map-trace-checklists

Conversation

@nambok

@nambok nambok commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Three mechanisms for planning and proof:

  1. Code map. Each repository's code knowledge is kept current, section by section, and the planner and the coder start from it.
  2. Criteria trace. Each acceptance criterion is traced to the code changed for it, the tests that cover it and its proof. The trace is a table in the description, a record on the run and a field in the run API.
  3. Non-functional checks. When a plan's change reaches infrastructure, CI, auth and security, data, a hot path or observability, the plan answers a short checklist for that area. The checklists are data. An unanswered item is a plan gap, never a new stop.

Changes

Code map (common::code_map, passes::code_map; docs: docs/code-map.md)

  • The map is kept on the repository's agent file record, in the code_map attribute. It has five sections for the whole repository (architecture, stack and versions, build/test/run, conventions, dependencies between packages and services) and one section per top-level area (structure and entry points). Each section is stamped with the commit it describes.
  • plan::run brings the map to the run's base before it builds the prompt:
    • Same commit or same tree: every section is reused, with no tree read and no model call.
    • Otherwise: the comparison's paths mark only the sections they touch: manifests, CI, lint and format config, guidance, the README, infrastructure, structural or entry-point changes in an area, and areas added or gone. Only those sections are read again (each from its own files, within a budget) and rebuilt, in one model call.
    • Comparison cut or unreadable: every section is rebuilt.
    • Section missing from the reply: it keeps its old stamp, is flagged as possibly out of date, and is retried on the next run.
  • The planner's system prompt and every coder round's system prompt carry the map.
  • Two run attributes record what the run did:
    • code_map_refresh: the commit, why it refreshed, and which sections were reused, rebuilt or missed.
    • exploration: the build's tool calls before its first write (counted in the coder's tool executor), its total tool calls, and the map commit it started from.

Criteria trace (common::trace; docs: docs/criteria-trace.md)

  • The criteria come from e2e_proof::criteria_or_map: the same ticket list or plan criteria map the two-way proof uses. A map line can name its code with | code: <files or functions>.
  • Each row has three parts:
    • Code: the changed non-test files and the definitions they add or change, matched by code: or else by the criterion's words. A ticket with one criterion owns the whole diff.
    • Tests: the map's end-to-end test, plus changed test files that match the criterion.
    • Proof: the two-way proof on this head (staging and the preview, with the server HTML check from Finished runs ship, one run per ticket, and criteria proven on the preview #778). Without one, the changed tests' runs with and without the change (habits_check). Otherwise not_run or missing.
  • description::build rebuilds the trace from the facts of the head on every push:
    • The compact table goes in the "Full test evidence" fold, in the checks block.
    • Gaps (no traced code, no test, or a proof that doesn't hold) become open items. A gap the two-way proof already reports is listed once.
    • The trace is saved on the run as traceability.
  • Open gaps feed the same fix-round loop as the run's other open gaps:
    • trace::coder_items turns each gap into an item for the coder, leaving out what the two-way proof already sends.
    • Each description build records the items on the run's checks ledger (run_guard::Ledger::trace, per head). There they hold the draft (open_findings) and count toward convergence (Target::of).
    • pr_watch builds the description before queuing the two-way proof's round, then sends the proof's items and the trace's together in one queue_own_review_round.
    • A pull request with no preview gets its round from the description build.
  • GET /api/runs/{run_id} now returns typed traceability and exploration objects, and docs/api/openapi.json is regenerated.

Non-functional checks (common::nfr_check, data in common/src/nfr_checklists.json; docs: docs/non-functional-checks.md)

  • There are six areas. Each has path rules (extension, file name, folder, prefix, a word in a path segment), ticket words, and its own items:
Area Items
Infrastructure rollout, rollback, blast radius, environments, permissions, cost, limits, monitoring
CI triggers, rollback, permissions, blast radius, limits
Auth and security threat, permissions, secrets, input, compatibility
Data and migrations migration safety, compatibility, rollback, environments, existing rows
Performance hot path, cost per call, limits, measurement
Observability signal, thresholds, routing, noise
  • The planner is told the rule and every area's checklist.
  • After the draft, nfr_check::plan_gaps reads ## Non-functional checks in design.md and flags a missing section, a missing item, an n/a without a reason, and an answer without a source (a file, a command or a lookup). These gaps join the existing send-back (back), so there is no new stop and no approval gate.

Replays (these fail on main): incidents/dg_code_map_kept_current, dh_criteria_traced_to_proof and di_infra_checklist_answered, each with its page in docs/incidents/. Each new common module also has unit tests.

Verification

  • cargo fmt --all --check, plus rustfmt --check on the three incident files.
  • cargo clippy --all-targets -- -D warnings.
  • cargo test --workspace (common, worker, gateway), including the incident suite and the OpenAPI completeness test.

…s in plans

Code map: each repository keeps sections on its agent file record
(architecture, stack, build and test, conventions, dependencies, one per
top-level area), each stamped with the commit it describes. Before the
planner starts, the map is brought to the run's base: the same commit or
tree reuses every section, otherwise only the sections the comparison's
paths touch are read again and rebuilt in one model call. The planner and
the coder get it as context; the build's tool calls before its first write
and the map's commit are kept on the run.

Criteria trace: every description build traces each acceptance criterion
to the files and definitions changed for it, the tests that cover it, and
its proof on the head (the two-way proof, else the tests' runs with and
without the change). The table goes in the description's checks, gaps are
open items, and the trace is kept on the run and served by the run API.

Non-functional checks: when a plan's files or the ticket reach
infrastructure, CI, auth and security, data, a hot path or observability,
design.md answers that area's checklist with sources; a "n/a" needs a
reason. The lists are data in one file. Missing answers are plan gaps in
the same send-back, with no new stop or approval.
The trace's gaps become coder items (common::trace::coder_items). The two
-way proof already sends an item for a test that is missing, failing or not
testing the ticket, so for those criteria the trace only adds untraced
code. Each description build records the items on the run's checks ledger
(run_guard::Ledger::trace) for its head. There they are open items like any
check's: they hold the draft (open_findings) and the run converges on them
(Target::of). The PR watch builds the description before it queues the two
-way proof's round and sends both lists in one round. A pull request with
no preview gets its round from the description build.
@nambok
nambok merged commit 7cbc380 into main Nov 18, 2026
10 checks passed
@nambok
nambok deleted the code-map-trace-checklists branch November 18, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant