Repository navigation
feat(status): show each nested memory file's sampled-session reach - #209
Conversation
[Medium impact] The PR appears safe to merge; no actionable defects were found. Reviews (2) · Last reviewed commit: "feat(status): show each nested memory fi..." · Reviewed by Greptile |
A nested file trains only on sessions whose every in-repo work path stays under its directory, so in repos where sessions cross directories it may never reach minGapEvidence, and a run that proposes nothing there looked the same as a file with no gaps. Each attribution now records, per nested file, how many sampled sessions worked only under its directory (.backpass/nested/reach.json). The run summary and `backpass status` print that count and warn below minGapEvidence, when no add, rewrite, or remove edit can reach the file. `status --json` reports it as nestedAttribution, and the proposal's nested entries carry sampledSessions, minGapEvidence, and belowMinGapEvidence. The count comes from deterministic attribution and is report-only. Refs kunchenguid#191 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70b7fe3 to
1fde44a
Compare
|
Speaking as Kun's firstmate: Merged as contract-class: restore. Part (1) of #191: Failure-is-loud already requires a run that proposes nothing to explain why; showing each nested file's sampled-session reach (and warning below VISION (per rule) @ pre-merge
CI green (ubuntu + macos build-and-test, generated-files guard, no-mistakes). Live validation already in the PR — no further ask. Refs #191 (does not close; part 2 remains). |
Intent
Implement part (1) of issue #191: a nested memory file trains only on sessions whose every in-repo work path is under its directory, so in repos with cross-cutting sessions it may never reach minGapEvidence, and nothing told the user. Now backpass status and the run summary show, per nested file, how many sampled sessions were attributed to it, with a warning below minGapEvidence. The user (issue author, Pantoria) asked to implement their own ready-for-pr backpass issues, each in its own worktree and PR. Follow AGENTS.md invariants and VISION.md. No live model calls were made while implementing.
Scope decision: only part (1) (maintainer: restore, can ship alone). Part (2), the opt-in to ignore reads of configured memory files as work paths, is explicitly out of scope and left for a follow-up; commit says Refs #191, not Fixes. Design: counts come only from deterministic workedUnder attribution in nestedCorpora (src/commands/analyze.js), persisted to .backpass/nested/reach.json at attribution time so status stays read-only and cheap (no discovery/sampling); unmeasured files show 'not yet measured'. Proposal nested entries gain sampledSessions/minGapEvidence/belowMinGapEvidence; status --json gains nestedAttribution. Strictly report-only per the 'Presentation never gates' invariant - a test asserts the root edit is still proposed when a nested file is below the floor. Wording deliberately says 'no add, rewrite, or remove edit can reach this file' instead of the issue's 'cannot receive edits', because extract/move edits are exempt from the evidence floor. Accepted: status shows the count/floor saved at the last attribution, timestamped, not a fresh measurement.
What Changed
nestedCorporainsrc/commands/analyze.js), backpass now saves to.backpass/nested/reach.jsonhow many sampled sessions each nested file can learn from, meaning sessions whose every in-repo work path is under that file's directory. The save has a timestamp and records theminGapEvidencefloor and whether the file is below it. New helpers insrc/nested.jsbuild, write, read and format this record (nestedReach,writeNestedReach,readNestedReach,nestedReachWarning).backpass statusgains a "NESTED EVIDENCE REACH" section. It shows the count and floor saved at the last attribution, ornot yet measuredif no attribution has run, and warns when a file is belowminGapEvidence, at which point no add, rewrite, or remove edit can reach it.status --jsonnow includes anestedAttributionobject.statusreads only the saved file and does no discovery or sampling.nestedentry now carriessampledSessions,minGapEvidenceandbelowMinGapEvidence. The run summary prints "N of M sampled session(s) worked only under dir/" and the same below-floor warning. All of this is report-only and never gates a run. README documents it, and tests cover the status output and the warning, including a check that the root edit is still proposed when a nested file is below the floor.Refs #191. This covers part (1) only; the opt-in to ignore reads of memory files is left for a follow-up.
🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change only reports data: counts come from the existing deterministic workedUnder attribution and are saved to .backpass/nested/reach.json. That file sits beside the per-file state directories without clashing, since the raw-file cleanup only walks subdirectories. Nothing reads the count back to gate a run, and a test checks the root edit is still proposed when a nested file is below the floor, which matches every stated constraint in the intent.
Testing
I drove the real CLI end to end in four disposable monorepo setups: below the floor, at the floor,
analyzeonly, and no nested config. In every setup only the model was stubbed. The run summary and status showed "1 of 3 sampled session(s) worked only under apps/api/" with the warning "below minGapEvidence (2); no add, rewrite, or remove edit can reach this file". At the floor ("2 of 4") there was no warning. The root edit was still proposed below the floor, so the count stays report-only. Before any run, status shows "not yet measured". Status does not change reach.json. A corrupt reach.json makes status warn and fall back to "not yet measured" without failing. With no nested config there is no reach section and nonestedAttributionkey. The two targeted test files also pass. Every scenario passed, so the verdict is go.backpassorbackpass analyze'; 'reach.json exists after status: false'Evidence: Below-floor run summary, status, status --json, and corrupt reach.json transcript
Evidence: At-floor run summary and status (no warning)
Evidence: analyze-only run records reach, then status
Evidence: Repo with no nested config: unchanged output
Evidence: Live driver script
Evidence: Run summary excerpt
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
backpass statuslists each nested file as 'not yet measured' and writes no statebackpassrun shows each nested file's 'N of M sampled session(s) worked only under dir/' and warns only for the file below minGapEvidencebackpass statusshows the saved, timestamped counts and the warning without re-measuringbackpass status --jsonexposes nestedAttribution with measuredAt and per-file fieldsbackpass analyzealone records reach that status then showsnode --test --test-name-pattern="nested|status" test/nested-cli.test.js test/status.test.js(12 pass, including the new CLI floor-warning test and the status reach test)node $EV/drive.mjs $EV: real CLI driver (helpers copied from test/nested-cli.test.js) runningbackpass status,backpass,backpass status,backpass status --json, andbackpass analyzein disposable repos and HOMEsAdversarial: a cross-cutting pi session that reads an apps/api file and edits an apps/web file, checked to count toward neither nested fileChecked thatstatusneither creates nor modifies reach.json (existence before any run; mtime after a run)Checked a repo with no nested files configured: no NESTED EVIDENCE REACH section and nonestedAttributionJSON key✅ No issues found.
backpassorbackpass analyze'; 'reach.json exists after status: false'node drive.mjs sparse(evidence driver): status before any run, then a fullbackpassrun with 1 api session and 2 web sessions, thenstatus,status --json, and status with corrupt and malformed reach.jsonnode drive.mjs floor: fullbackpassrun with 2 api sessions and 2 web sessions (at the floor), thenstatusnode drive.mjs analyze:backpass analyzealone writes reach.json, thenstatusnode drive.mjs plain: run with no nested memory files configured, thenstatusandstatus --jsonnode --test test/nested-cli.test.js test/status.test.js✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.