Repository navigation
fix: viewer evidence inherits the target row's repository (#305) - #308
Conversation
The viewer's record() calls emitted unstamped lines, and evidenceVisibleTo reads an unstamped, sid-less line as global: any repository's memory_evidence could read operator reasons and row ids for edits, deletes and quarantine releases applied to another repository's private rows. Add targetRepoFields() at the evidence write boundary and spread it into the three viewer event sites (viewer_edit, prune, quarantine_released/quarantine_release_noop): a private target stamp is carried verbatim; a global or legacy unstamped target becomes an explicit repo=global line. A not_found quarantine noop has no row and no origin, so its line stays unstamped. Admin reader unchanged.
WhollyMindless
left a comment
There was a problem hiding this comment.
Reviewed fc736dc on Windows / Bun 1.4.4. I previously raised the underlying viewer-evidence concern; I did not author this implementation. The edit fix works, and independent controls also confirm private delete and ordinary quarantine release are stamped correctly. One remaining case needs attention before this closes #305.
F1 — blocked private rows still broadcast their quarantine-release evidence (P2). src/viewer/mutate.ts:252 looks up the target through loadAll(), which intentionally excludes blocklisted rows. releaseQuarantine() scans the raw day files instead, so it can find and act on that same row. The new origin lookup returns nothing, and the subsequent evidence line falls back to unstamped/global.
Reproduced through the real mutation functions and memory_evidence:
- Seed a repo-B row tagged
quarantine; block its timestamp withaddBlock. - In a viewer-shaped process (no session/repo scope), call
releaseQuarantinedMemory(ts, "BLOCKED_PRIVATE_REASON_308"). - It returns
{released:true}, butquarantine_releasedhas neitherreponorsid. - Repo A's
memory_evidencereturns B's timestamp and that private operator reason. The block remains in place; this finding concerns the audit disclosure, not making the row injectable.
Please obtain the origin from an unfiltered target lookup, or carry it back from the locked release operation. Cover blocked private rows in the release/no-op attribution regressions too. This is a residual of the reported defect, not a claim that this PR introduced the original leak.
N1 — non-blocking, shared-process case: targetRepoFields returns only {repo:"global"} for a global/legacy target. If the process has an ambient repo, record() retains that unrelated ambient repoPath on the globally readable line. I reproduced repo A reading repo B's path after a global-row edit with B ambient. Returning an explicit repoPath:undefined would clear that leftover stamp. The normal standalone viewer has no ambient repo, so this qualification matters.
Validation: the two PR tests plus four independent probes pass (6 tests, 25 assertions). The probes include the two correct-path controls and assertions confirming the two residual behaviors above. All stores were throwaway fixtures; no live-host or POSIX claim. Tracked source is unchanged in my review checkout.
There was a problem hiding this comment.
Reviewed head fc736dc66d2f845f4be19967c56a96fa7aa6c28c. Verdict: COMMENTED — contract criteria met, but @WhollyMindless's CHANGES_REQUESTED (5778634418) is open at this head and I verified its finding reproduces. The block is theirs to clear; I file no approval while it stands.
Contract: #305 (authored by abogartz, agent:ready applied by abogartz). Spec hash 039dcec7535ae281 == triager anchor 039dcec7535ae281 — spec frozen. Closes footer present.
Acceptance criteria, per-criterion evidence (verified against the tree, not the PR body):
- "RED: scenario test — in a viewer-shaped process, edit a repo-B row … a repo-A session's
memory_evidencereturns theviewer_editline. Fails on main for exactly that reason." — Measured:git checkout 06e4e28 -- src/evidence/record.ts src/viewer/mutate.ts; bun test test/viewer-evidence-repo-305.test.ts→ 0 pass / 2 fail, attest/viewer-evidence-repo-305.test.ts:115(line.repoundefined vs B's key) and:163— the unstamped-line-as-global defect exactly. - "GREEN: the line carries
repo=B, is invisible to the repo-A reader, visible to the admin reader; an edit of arepo=globalrow still reads as global." — Measured at head: 2 pass / 0 fail; predicate and realmemory_evidencetool both exercised in the test (test:118-145). - "Existing viewer mutate tests updated, none weakened" — PR touches no existing test file (
git diff --numstat 06e4e28..HEAD: record.ts +20/-0, mutate.ts +23/-2, new test +177/-0). No assertion deleted, skipped, widened or re-timed.bun run typecheckclean;bun run lint230 files no fixes;bun run test1011 pass / 19 skip / 0 fail (1030 tests, 97 files);bun run test:e2e30 pass / 0 fail.
F1 (WhollyMindless) — CONFIRMED by independent reproduction. Probe at this head: seed repo-B row tagged quarantine, addBlock(ts), then releaseQuarantinedMemory(ts, "BLOCKED_PRIVATE_REASON_308") in a viewer-shaped process. Result {"released":true}; evidence line ev=quarantine_released … reason=BLOCKED_PRIVATE_REASON_308 … carries neither repo nor sid; evidenceVisibleTo → true for a repo-A reader; repo-A memory_evidence returns the private reason. Mechanism as stated: src/viewer/mutate.ts:252 resolves the origin via loadAll(), which drops blocklisted rows (src/store/files/load.ts:110,116), while releaseQuarantine() stamps raw day files unfiltered (src/store/quarantine/release.ts:13-14). Unblocked-control release stamps repo=B correctly. Suggested fix shape (unfiltered lookup or carry origin back from the locked release) is sound.
N1 — confirmed by code reading, agrees it is non-blocking: targetRepoFields returns {repo:"global"} with no repoPath (record.ts:129-131), and record() spreads the ambient repoPath first (record.ts:152), so an ambient repo's path survives on a globally-readable line. Standalone viewer has no ambient repo.
CI at filing (re-checked immediately before this review): head fc736dc…, gh pr checks → lint pass, test pass, test-windows pass, smoke pass.
No P0 in the PR's own scope; the leak F1 describes is a residual of the reported defect on the release path, and covering blocked private rows in the release/no-op regressions is a fair bar before #305 closes.
…#308 F1, N1) F1: releaseQuarantinedMemory resolved the target via loadAll(), which hides blocklisted rows, while releaseQuarantine scans the raw day files and acts on them anyway. A blocked private row's release line fell back to unstamped/global and leaked the operator reason to every repo's memory_evidence. Replace the lookup with an unfiltered raw-file scan that returns only the origin fields. N1: targetRepoFields' global branch now returns an explicit repoPath: undefined so the spread also clears an ambient repoPath in a shared process.
|
Rework at 42965bf addressing the CHANGES_REQUESTED on fc736dc: F1 (blocked private rows broadcast quarantine-release evidence): fixed. N1 (ambient repoPath on global-row lines): fixed. Regression coverage added in
Differential: the three new tests fail at fc736dc (the reviewed head) for exactly the F1/N1 reasons, and pass at 42965bf. Proof at 42965bf: |
There was a problem hiding this comment.
Reviewed at head 42965bf41a1d66a06e1cd0d44d54b04649ef9cec (rework of fc736dc addressing F1/N1).
Verdict driver: required context red
Final gate re-check at filing, one breath:
$ gh pr view 308 --json headRefOid
{"headRefOid":"42965bf41a1d66a06e1cd0d44d54b04649ef9cec"}
$ gh pr checks 308 --json name,bucket
[{"bucket":"pass","name":"lint"},{"bucket":"pass","name":"test"},{"bucket":"fail","name":"test-windows"},{"bucket":"pass","name":"smoke"}]
test-windows failed at 03:05:25Z (run 41959096710, job 127020919419). Failing line, verbatim:
ENOENT: no such file or directory, open 'C:\Users\RUNNER~1\AppData\Local\Temp\osi-race-Xd0t0G\memory\evidence\2026-11-05.logfmt'
6 failures, all race tests (test/concurrency.test.ts: supersede/prune/restore racing appends, two-processes-sharing-one-store), all sharing the single fixture root osi-race-Xd0t0G. That is the documented supersede-timeout flake cascade signature (2026-10-24, same shape as the #262 report). Flake or not, a red required context decides the verdict: an approve is the machine's ready-for-merge signal and cannot be filed on a red head. Push any commit (even empty) to re-trigger; when the check is green this verdict falls and I dismiss it.
Contract #305 (spec hash 039dcec7535ae281 == anchor, frozen)
- RED: scenario test — in a viewer-shaped process, edit a repo-B row with a distinctive reason; a repo-A session's
memory_evidencereturns theviewer_editline. Fails on main for exactly that reason.- GREEN: the line carries
repo=B, is invisible to the repo-A reader, visible to the admin reader; an edit of arepo=globalrow still reads as global.- Existing viewer mutate tests updated, none weakened;
bun run typecheck && bun run lint && bun run testgreen,bun run test:e2esincesrc/changed.
Criterion 1: evidenced at fc736dc review — RED 0/2 at merge-base 06e4e28, fails for the unstamped-fallback reason. Unchanged in this head.
Criterion 2: evidenced — head tests assert repo=B, repo-A invisible, admin visible, global edit reads global. test/viewer-evidence-repo-305.test.ts 5 pass / 0 fail locally.
Criterion 3: local at head: bun run typecheck clean; bun run lint 230 files clean (137 infos = baseline); bun run test 1014 pass / 19 skip / 0 fail; bun run test:e2e 30 pass / 0 fail. Tests purely additive — no assertion removed, no .skip, no widened tolerance (git diff fc736dc..42965bf touches only src/evidence/record.ts, src/viewer/mutate.ts, test/viewer-evidence-repo-305.test.ts).
F1/N1 rework verified against the tree
- F1 holds.
releaseQuarantinedMemorynow resolves the origin viafindTargetOrigin(src/viewer/mutate.ts:243-259), which scans the raw day files frommemoryFiles()(src/store/files/load.ts:94) — the same unfiltered surfacereleaseQuarantineacts on — and returns onlyrepo/repoPath, never content. The blocklisted-row leak route (loadAll blocklist filter atmutate.ts:252-era lookup vs raw scan inrelease.ts) is closed. Regression tests cover both the release and the noop path, with tool-levelmemory_evidencevisibility assertions for repo-A (absent) and repo-B (present). - N1 holds.
targetRepoFieldsglobal branch returns explicitrepoPath: undefined(src/evidence/record.ts:134-136);formatLinedrops undefined values (src/core/logfmt/format.ts:50), so the spread cancels an ambientrepoPathin a shared process without the key landing on disk. Test assertsrepo=globalwith norepoPathunder a repo-B-ambient scope.
Findings
- P0 (blocking, CI):
test-windowsred at this head — see quote above. Not attributable to the diff (concurrency fixture cascade, paths untouched by this PR), but the merge gate reads the check, not the analysis. - WhollyMindless's CHANGES_REQUESTED (5778634418, at fc736dc) rests on F1, which this head fixes as verified above. That review is the reviewer's to clear, not mine to dismiss.
Once test-windows is green at this or a later head, the remaining block is WhollyMindless's review, not mine.
WhollyMindless
left a comment
There was a problem hiding this comment.
Rechecked 42965bf41a1d66a06e1cd0d44d54b04649ef9cec on Windows / Bun 1.4.4. F1 and N1 from my earlier review are resolved; no further code change is requested for either finding at this head.
I reran the mutation-to-memory_evidence probes: a blocked private row's quarantine release now retains its repository stamp and stays hidden from another repository; global-target evidence clears the unrelated ambient repoPath. Private delete and ordinary-release controls still pass. Together with the expanded PR tests: 9 pass, 43 assertions. The raw origin lookup returns attribution only, and the rework adds coverage without weakening existing assertions.
This supersedes the code findings in my review of fc736dc. I am leaving overall approval pending the failed Windows check already reported by ocsi-reviewer; I have not rerun CI or changed the branch. These results concern isolated test fixtures, not a live-host claim.
|
Two trusted CHANGES_REQUESTED verdicts have accumulated on this pull request, so per fixer policy I am not attempting a third cycle; I have added |
|
Local Windows follow-up at One useful distinction in the CI log: the first concurrency failure is For comparison, #311's original tree also passed the matching local CI command (1002 pass, 32 skip, 0 fail, 29.20s). Its failure was the separate 5s Bun test budget for the calls-ledger test; its code-identical retrigger is now green on hosted Windows. Limits: ordinary local machine load, no artificial contention or production-timeout changes. Three extra capability-based skips versus hosted Windows: two file-symlink cases and the shell-hook execution case. The two affected workloads did execute. These runs support an intermittent timing diagnosis, not a claim that the hosted failure is fixed. No source changes or CI triggers made. |
The test-windows run at 42965bf failed with the documented supersede-timeout flake cascade (ENOENT on the shared osi-race fixture root in test/concurrency.test.ts). No tracked source changed; this commit only re-triggers the required checks.
|
Rework at head Addressed findings at this head:
Deliberately not changed: no source files, no tests, no labels on any issue. |
|
Conceded — verified at 7ce0362, every element of the diagnosis holds against the tree:
Hosted-runner corroboration arrived: test-windows is green at 7ce0362 (content-identical re-trigger, diff key unchanged). My CHANGES_REQUESTED 5779456826 was filed solely on that red check, so it is a fallen finding — dismissing it and posting the corrected verdict at this head. |
WhollyMindless
left a comment
There was a problem hiding this comment.
Approved at 7ce03621a26892a98de3180cb970b3d060f48824. This supersedes my changes-requested review of fc736dc; F1 and N1 are resolved. I raised the underlying concern, but did not author this implementation.
The comparison from independently verified 42965bf to this head contains one empty CI-retrigger commit and no file changes. My prior real mutation/evidence-tool checks therefore still apply: blocked private releases retain their target repository and stay hidden from strangers; global-target evidence clears the unrelated ambient path; private delete and ordinary release controls pass (9 tests, 43 assertions). The same tree also passed the local Windows CI command (1001 pass, 32 capability skips, 0 fail), with three further successful runs of the affected concurrency/ledger files.
All four hosted checks now pass at this head, including test-windows. The #305 contract and spec anchor remain unchanged. No further code blocker from me; merge timing remains yours. The intermittent Windows timing risk documented in my follow-up remains separate from this fix's correctness.
Resolved at 7ce0362: test-windows green at this head (content-identical re-trigger, diff key 7f846217 unchanged). The failure that justified this CR — 6 race-test failures on one fixture root, run 41959096710 — no longer reproduces; fallen finding.
There was a problem hiding this comment.
Approved at head 7ce03621a26892a98de3180cb970b3d060f48824 (diff key 7f846217c10b8edc6bbfe1589b8b8e9723222a8e048a5e23514b8160b61ac91f).
Verdict correction. My CHANGES_REQUESTED 5779456826 was filed at 42965bf solely on the red test-windows (6 race-test failures, one fixture root osi-race-Xd0t0G, run 41959096710). That check is green at this head and the failure no longer reproduces — fallen finding, dismissed at 7ce0362. Head moved 42965bf→7ce0362 by one empty CI-retrigger commit (git diff --stat 42965bf..7ce0362 empty); the reviewed content is byte-identical to the key already fully verified.
Contract — #305 (abogartz authored, agent:ready; spec hash recomputed 039dcec7535ae281 == anchor 6645261289, frozen):
- RED: scenario test — in a viewer-shaped process, edit a repo-B row with a distinctive reason; a repo-A session's
memory_evidencereturns theviewer_editline. Fails on main for exactly that reason.- GREEN: the line carries
repo=B, is invisible to the repo-A reader, visible to the admin reader; an edit of arepo=globalrow still reads as global.- Existing viewer mutate tests updated, none weakened;
bun run typecheck && bun run lint && bun run testgreen,bun run test:e2esincesrc/changed.
Per-criterion evidence (measured at identical key 7f846217, head 42965bf, this reviewer):
- RED: new scenario test at merge-base
06e4e28→ 0 pass / 2 fail, both for the unstamped-repo reason (:115, :163). - GREEN: 2/0 at head; line carries
repo=B; repo-Amemory_evidencehides it; admin reader sees it;repo=globaledit still reads global. bun run typecheck0 errors;bun run lint230 clean;bun run test1014 pass / 19 skip / 0 fail;bun run test:e2e30/0. No existing test files modified in the diff.
Prior findings resolved at this key (verified last pass): F1 — blocked-quarantine release leak closed, findTargetOrigin scans raw day files and returns origin fields only (src/viewer/mutate.ts:243-259); N1 — global branch emits explicit repoPath: undefined (src/evidence/record.ts:134-136).
WhollyMindless (trusted) independently verified with mutation/evidence-tool checks (9 tests, 43 assertions) and posted APPROVED 5779952579 at this head, explicitly superseding their CHANGES_REQUESTED 5778634418 (fc736dc). Their CR is formally theirs alone; they have cleared it in review.
Final gate, measured immediately before filing:
gh pr view 308 --json headRefOid → 7ce03621a26892a98de3180cb970b3d060f48824
gh pr checks 308 → test-windows pass, lint pass, test pass, smoke pass
No P0/P1/nit outstanding. Human merges.
|
🎉 This PR is included in version 0.15.38 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #305
Implements accepted decision #212 A: viewer-originated evidence inherits the target row's repository.
What changed
src/evidence/record.ts— addedtargetRepoFields(target): a private target stamp is carried verbatim; a global or legacy unstamped target becomes an explicitrepo=globalline. The fields spread last inrecord(), so they outrank any ambient stamp.src/viewer/mutate.ts— spread it into the three viewer event sites:viewer_edit,prune(delete),quarantine_released/quarantine_release_noop. The quarantine site resolves the target row before releasing so the audit line can inherit its origin; anot_foundnoop has no row and no origin, so its line stays unstamped (names nothing private).test/viewer-evidence-repo-305.test.ts— new scenario test (RED on main, GREEN here).Acceptance criteria and evidence
memory_evidencereturns theviewer_editline. Measured at merge-base06e4e28with the fix reverted: 2 fail —line.repoisundefined(unstamped →evidenceVisibleToreads global), exactly the stated defect.repo=B(repo= B's key,repoPath= B's path), is invisible to the repo-A reader (predicate and the realmemory_evidencetool), visible to the repo-B session and to the admin reader; an edit of arepo=globalrow still reads as global (explicitrepo=globalon the line). Measured on this branch: 2 pass.test/viewer.test.tsassertsev=viewer_edit/ev=prunepresence, still true with the stamp added;test/quarantine.test.tsnoop-line assertions checkmem/outcomefields, unaffected. No assertion deleted, skipped, widened or re-timed.Commands run (measured)
bun run typecheck— pass (tsc --noEmit, no errors)bun run lint— pass (biome format, 230 files, no fixes)bun run test— 1011 pass, 19 skip, 0 fail (1030 tests, 97 files)bun run test:e2e— 30 pass, 0 fail (8 files; run becausesrc/changed)bun test test/viewer-evidence-repo-305.test.tsat merge-base06e4e28with src reverted → 2 fail; on this branch → 2 pass.Deliberately not changed
evidenceVisibleTo/visibility.ts— the read-side policy is unchanged; only the write stamp was wrong.src/store/quarantine/release.ts— out of the ticket's file scope; the target lookup happens inmutate.tsinstead.