Repository navigation
fix: blocked-writes list follows evidence visibility (#306) - #311
Conversation
blockedRecent now filters write_blocked lines through evidenceVisibleTo with the caller's Reader, the same rule memory_evidence uses. The memory_status tool passes its reportReader; the terminal panel resolves the active session's repository from its root (blockedReaderFor) and fails closed to global-only when unresolvable. Aggregate STORE counts stay machine-wide by decision and are now documented as such in the tool description and README.
There was a problem hiding this comment.
Reviewed at head f43b8fdccd47b0676e84b5be6312e4e629e73cc0.
Verdict driver: required context red
Final gate re-check at filing, one breath:
$ gh pr view 311 --json headRefOid
{"headRefOid":"f43b8fdccd47b0676e84b5be6312e4e629e73cc0"}
$ gh pr checks 311 --json name,bucket
[{"bucket":"pass","name":"lint"},{"bucket":"pass","name":"test"},{"bucket":"fail","name":"test-windows"},{"bucket":"pass","name":"smoke"}]
test-windows failed at 02:46:50Z (run 41957127714, job 127014605318). Failing line, verbatim:
(fail) calls ledger is capped and lifetime counters keep the counts truthful [5013.15ms]
^ this test timed out after 5000ms.
Summary: 1004 pass / 29 skip / 1 fail. The failing test is test/bounded-session-ledgers.test.ts:67 — untouched by this PR (PR files: README.md, src/status/write.ts, src/tools/status-tool.ts, src/tui/panel.tsx, two new test files). A 5s timeout on a loaded shared runner, not attributable to the diff. Still: a red required context decides the verdict; an approve is the machine's ready-for-merge signal and cannot be filed on red. Push any commit (even empty) to re-trigger; when the check is green at this head this verdict falls and I dismiss it.
Contract #306 (abogartz authored, agent:ready applied by abogartz; spec hash cbe6da30d3ca5562 == anchor, frozen)
- RED: scenario test — seed a repo-B
write_blockedline with a distinctive sid plus repo-B rows; a repo-Amemory_statusprints the repo-B sid. Fails on main for exactly that reason.- GREEN: repo-A status omits the line and shows only its own blocked writes; the admin/global reader still sees all; STORE counts are identical before and after for every reader (counts deliberately not scoped); TUI payload agrees with the tool.
- No existing assertion weakened;
bun run typecheck && bun run lint && bun run testgreen,bun run test:e2esincesrc/changed.
Criterion 1 — evidenced. Differential at merge-base 06e4e28: test/status-blocked-visibility-306.test.ts copied onto main, bun test → 0 pass / 3 fail; the leak assertion fails at :146 (expect(ca).not.toContain("ses-BLEEDS-306")) — exactly the unfiltered-read reason the ticket names.
Criterion 2 — evidenced at head. All 6 new tests pass: repo-A omits B's line and keeps its own (status-blocked-visibility-306.test.ts:87); admin sees all, B keeps own history (:105); STORE line byte-identical across readers (:125, expect(storeLine(ca)).toBe(storeLine(cb))); panel reader equals the tool reader (status-blocked-reader-306.test.ts:67, expect(panelReader).toEqual(toolReader)); no-root fails closed to global-only (:91).
Criterion 3 — evidenced. git diff origin/main...HEAD --numstat: test files 99+0 and 149+0 — purely additive, no assertion removed, no .skip, no widened tolerance. Local at head: bun run typecheck clean; bun run lint 231 files clean; bun run test 1015 pass / 19 skip / 0 fail; bun run test:e2e 30 pass / 0 fail.
Implementation notes
- Both
blockedRecentcall sites pass a reader:src/tools/status-tool.ts:64(reportReader,sid) andsrc/tui/panel.tsx:99(blockedReaderFor(rootDir),activeSid). No third caller exists (grep blockedRecent( src/). - Default
ADMIN_READER(src/status/write.ts:110-113) preserves the historical unfiltered read for out-of-plugin callers — verified against the two-site census. blockedReaderForfails closed to{kind:"global-only"}on absent or unresolvable root (src/status/write.ts:152-159);evidenceVisibleTogives global-onlyfalsefor repo-stamped lines (src/store/model/visibility.ts:107), so unknown is never everything.- Issue text pointed at
src/index.ts/src/injection-epochs.ts; the actual call sites in the tree arestatus-tool.ts/tui/panel.tsx— the fix covers the real surface, nit only. - README documents machine-wide STORE counts per decision #213 B (
README.md:209).
Findings
- P0 (blocking, CI):
test-windowsred at this head — quoted above; not attributable to the diff. - nit: issue file references stale (see above); no action needed.
Everything except the red Windows check is satisfied and evidenced. Green the check and this verdict is dismissed.
…, not attributable to diff)
|
Rework at
Proof re-run locally at |
Resolved at df4dade: test-windows now green (run for this head passes). The CR was filed only for the red test-windows check (bounded-session-ledgers.test.ts:67 timeout, run 41957127714); the failure no longer reproduces.
There was a problem hiding this comment.
Reviewed head df4dade (diff key a46f3cdbc1dab09b, unchanged from the head I verified; f43b8fd→df4daded is a merge of main only).
Verdict correction. My prior CHANGES_REQUESTED 5779491286 was filed only for the red test-windows check (bounded-session-ledgers.test.ts:67 timeout 5000ms, run 41957127714 — untouched test, loaded-runner timeout, not attributable to the diff). The check is now green at this head; the failure no longer reproduces, so I dismissed that review as a fallen finding before filing this approve.
Contract — #306 blocked-writes visibility (authored and adopted by abogartz; spec hash cbe6da30d3ca5562 == osi-spec-hash anchor, frozen). Acceptance criteria, evidenced at the identical diff key:
- RED at merge-base 06e4e28: 0/3, leak assertion fails at :146 — quoted in prior review.
- GREEN at head: 6/6, including STORE-line identity and panel/tool reader equality.
- Tests additive: 99+/0− and 14+/0− across the two test files; no existing assertion weakened, no skips.
Commands and measured numbers (prior pass at this same diff key): typecheck 0 errors, lint 231 clean, bun run test 1015 pass / 19 skip / 0 fail, e2e 30/0.
Final-gate re-check at filing (verbatim): headRefOid df4dade; checks: lint pass, test pass, test-windows pass, smoke pass.
No P0/P1 findings. One nit carried: issue file refs stale (index.ts/injection-epochs.ts vs real status-tool.ts/panel.tsx); fix covers the real surface. Human merges.
|
🎉 This PR is included in version 0.15.38 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #306
What
blockedRecentread today+yesterdaywrite_blockedevidence with no visibility filter, somemory_statusand the terminal/memorypanel showed other repositories' session ids and gate reasons whilememory_evidencecorrectly hid them. Now every line is filtered throughevidenceVisibleTo— the same predicatememory_evidenceuses — with the caller'sReader.Changes
src/status/write.ts:blockedRecent(limit, reader = ADMIN_READER, callerSid?)filters each parsed line throughevidenceVisibleTo. DefaultADMIN_READERkeeps the historical unfiltered read for out-of-plugin callers; plugin surfaces pass their own reader. NewblockedReaderFor(rootDir?)resolves the terminal panel's reader from the active session's root directory (the TUI process owns no session→repo map;resolveRepois deterministic for the same path on this machine, hence the same key the server stamped with). Unresolvable root fails closed toglobal-only.src/tools/status-tool.ts: thememory_statuscall site passes the existingreportReader+sid(the quarantine list beside it already usedreportReader); the tool description now states aggregate STORE counts are machine-wide by decision.src/tui/panel.tsx: the panel resolves the reader fromdata.session.root(activeSid)and passes it toblockedRecent; unknown root fails closed.README.md: documents that aggregate STORE counts are machine-wide (Policy: scope blocked-write details and define global status metrics #213 B) while the blocked-writes list follows each reader's visibility.The ticket named
src/index.tsandsrc/injection-epochs.tsas the call sites; #168 (merged) moved thememory_statustool tosrc/tools/status-tool.tsand the TUI surface issrc/tui/panel.tsx(src/injection-epochs.tsbecamesrc/inject/epochs.ts, which assembles the status payload but never the blocked list — the panel reads evidence directly so a block surfaces without waiting for an epoch). The reader is passed at both actual consumers.Acceptance evidence
test/status-blocked-visibility-306.test.tsseeds a repo-Bwrite_blockedline with distinctive sidses-BLEEDS-306plus a repo-A line, then runs the realmemory_statustool as a repo-A session. On main06e4e28(measured in a clean worktree of that sha): 3 fail / 0 pass, failing exactly because the repo-B sid prints in repo-A's report.ses-BLEEDS-306and shows its ownses-OWNED-A-306;ADMIN_READERsees both; repo-B's status shows its own, not A's; the STORE line is byte-identical between the repo-A and repo-B reports (counts machine-wide, deliberately not scoped);blockedReaderFor(a)deep-equalsreaderFromSid("ses-a")(the tool's own reader) and yields the same blocked set;blockedReaderFor(undefined)→global-onlyshows only the session-less line, never everything. New tests: 6 pass.blockedRecentdefault preserves the unfiltered semantics the existingstatus.test.ts/write-evidence.test.tscases rely on.Commands run (measured)
bun run typecheck— exit 0bun run lint— exit 0, no new warnings in changed filesbun run test— 1015 pass / 19 skip / 0 failbun run test:e2e— 30 pass / 0 fail (src/changed)Deliberately not changed
summarizeStore/ STORE aggregation — counts stay machine-wide by decision.StatusPayloadshape — the panel keeps reading evidence directly so a fresh block surfaces via the evidence watcher without waiting for an epoch recompute.src/index.ts— itsblockedRecentimport is dead since Proposal: separate responsibilities in plugin setup (src/index.ts) #168; removing it is unrelated cleanup.