I2867 — A passing scenario's evidence is reused by every checkout of the repository whose tool is the same
Keep I0832's scenario cache in one store that every checkout of this clone shares, under git's common directory, keyed exactly as today. Keep every key's entry instead of one entry per use case, so that two checkouts deriving different tools do not evict each other. Let CI restore and save the same store by the same tool key, so a run whose tool is unchanged reuses the evidence an earlier run wrote.
READY wave 0 · p1 · implementation profile · runs alone
Ready. Every dependency is done, so majordomus plan start I2867 will be accepted.
Objective
Keep I0832's scenario cache in one store that every checkout of this clone shares, under git's common directory, keyed exactly as today. Keep every key's entry instead of one entry per use case, so that two checkouts deriving different tools do not evict each other. Let CI restore and save the same store by the same tool key, so a run whose tool is unchanged reuses the evidence an earlier run wrote.
Why
Measured on 2026-10-21 at master 97391192dbb with MJ_TIMING=1 scripts/generate-site-data --check in a fresh worktree on one machine (load 13-32), the same command twice. The first run took 952 s, of which gen:catalogue.json (every use-case scenario executed) was 797 s, 84%. The second, with the 47 cache entries the first had written, took 284 s, gen:catalogue.json 56 s. The cache from I0832 works, but it lives in $MJ_AI_LOCAL_DIR/cache/use-cases, which is per checkout, so every integration train, repair lane and CI run derives in a fresh checkout and pays the fill again, even when an earlier checkout already ran the same tool. Ten train derives on 2026-10-21 spent 569-1246 s in stage B, 62-78% of each total, which is consistent with no reuse. The key is content-addressed (the executable's bytes and the blob ids of every tracked file of the tool, records excluded), so sharing it across checkouts cannot reuse another tool's evidence. Today's store also deletes every other key's entry for a use case when it writes one, which in a shared store would make two checkouts evict each other.
Current state
lib/usecase.sh mj_uc_run_cached stores a passing run at $MJ_AI_LOCAL_DIR/cache/use-cases/<id>.<key>.json and removes the use case's other entries when it writes. mj_uc_tool_key refuses a tree with uncommitted tool changes, a MAJORDOMUS_BIN that is not set, and a tree that is not the tool's own source. CI keeps nothing between runs.
Desired state
One store per clone, under $(git rev-parse --git-common-dir), shared by the primary checkout and every linked worktree. Entries are written atomically, never evicted by another key's write, and bounded by a size or age sweep. Every refusal of mj_uc_tool_key is unchanged. The validate and pages workflows restore and save the store with actions/cache, keyed by the tool key. A derive in a fresh worktree whose tool equals an earlier checkout's reuses that checkout's evidence, and the generated data stays byte-identical, which generate-site-data --check proves.
Scope
- lib/usecase.sh
- .github/workflows/validate.yml
- .github/workflows/pages.yml
- .ai/repo/project/issues/I2867.yaml
Out of scope
- Narrowing the key to the files a scenario exercises: a change to the tool may change any scenario's output, and a narrower key is a correctness risk that needs its own proof
- Caching a failed or unmet run
Dependencies
None. This issue is a root of the graph.
Acceptance criteria
- Two worktrees of one clone at the same tool: the second's generate-site-data reuses every entry the first wrote, and its output is byte-identical
- Two worktrees at different tools derive alternately and neither evicts the other's entries
- A tree with an uncommitted tool change, or no MAJORDOMUS_BIN, still runs every scenario
- CI restores the store by the tool key and a second run of an unchanged tool reuses it
- A case holds the first three; the timing of a fresh-worktree derive with and without the shared store is recorded with its commit, load and samples
Validation
- bin/majordomus plan validate
- bash test/run.sh 3836_a_repeated_scenario_is_read_from_its_cache
- scripts/generate-site-data --check
Evidence required
- shared_scenario_cache_case
- fresh_worktree_derive_timing
Evidence
None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.
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/I2867.yaml. Read it back with majordomus plan show I2867.