I0822 — Every canonical file is flattened at most once per command
Add a case that runs doctor, watch, context and plan validate under MJ_TIMING and asserts the yaml_flatten count never exceeds the number of distinct canonical files a command reads.
BLOCKED wave 3 · p0 · implementation profile · runs alone
Part of M004 — Performance is executable evidence, and the hot path does no canonical work twice.
Blocked. This issue cannot start until I0820 is done. The status is derived from that, not declared.
Objective
Add a case that runs doctor, watch, context and plan validate under MJ_TIMING and asserts the yaml_flatten count never exceeds the number of distinct canonical files a command reads.
Why
This is the shell tool's form of the no-rebuild-per-request invariant: repeated work is structural, and a counter catches it where a clock cannot.
Current state
doctor flattens 181 times for a repository with fewer canonical files than that.
Desired state
The counter equals the distinct-file count per command and the case fails when a validator regresses to re-flattening.
Scope
- test/cases/78_flatten_once.sh
- lib/common.sh
Dependencies
- I0818DONE The command registry is read in one pass
- I0819DONE The project model is loaded with one flatten per file and no per-file lookups
- I0820READY Catalogue, DAG, context and command-surface validators read their inputs once
What waits on this
- I0831BLOCKED Performance claims at their proven status
- I0835BLOCKED CI runs the structural performance checks
Acceptance criteria
- Case 78 passes on this repository and fails on a mutation that re-flattens inside a loop
Validation
- bash test/run.sh 78_flatten_once
Evidence required
- batch_reads
Evidence
None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.
Risk
Some validators legitimately flatten a file twice in different shapes; the case names the allowed exceptions explicitly rather than tolerating a margin.
Timeline
- started
- —
- verified
- —
- completed
- —
Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.
Canonical record: .ai/repo/project/issues/I0822.yaml. Read it back with majordomus plan show I0822.