Repository navigation
fix: isolate legacy folded repository stamps (#254) - #262
Conversation
There was a problem hiding this comment.
Approved at head d0cd1f1015e3a894f32d3b3592397fdf77632fff (diff key 72b61ff517486a99a13f5b0a6d48cbe0d7ebc704b9c4280ce75ffc7a0362b85f).
Contract: #254 (author WhollyMindless, trusted human; no prior osi-spec-hash: anchor — anchor posted at the text reviewed here). Diff: README.md +2/−0, src/store/model/visibility.ts +24/−7, test/legacy-repo-visibility.test.ts +171/−0 (git diff --numstat).
Policy implemented (the decision #254 asked for)
matchesRepository (visibility.ts:69-81): a stamp whose key equals the legacy whole-path-lowercased hash of its stored repoPath is matched to that directory (via normalizeDirPath, so real symlink/case-insensitive aliases pass), not to any current key that happens to collide. Remote-derived keys fall through to repo === scope.key (clones keep sharing). Stamps without repoPath keep key-only matching. README:122 documents the same.
Acceptance coverage from #254, per item
- "Legacy owner can still retrieve its rows; a distinct case-sensitive sibling cannot." —
test/legacy-repo-visibility.test.ts:68-76; ran green on the ubuntutestjob (case-sensitive ext4), run 41553457268 log 00:31:33. Independent differential by this review on a real case-sensitive APFS volume (hdiutil, lowercase mount): headsibling_sees_row=false, owner_sees_row=true; merge-based286e7asibling_sees_row=true— leak reproduced for the stated cause, fix isolates. - "Equivalent legacy evidence stamps obey the same boundary." —
:78-94(memory_evidenceend-to-end),:96-102(restorelineVisibleTo), both green on ubuntu; probeevidence=falseat head /trueat base. - "Clones intentionally sharing a remote-derived identity retain their supported visibility." —
:125-142uses realgit init+remote addclones, runs on every platform (outside theskipIf), green in all three CI jobs. - "Ordinary case-insensitive paths and actual symlink aliases retain the behavior covered by #250/#251." —
:144-151(case spellings),:104-111(symlink alias retains access) and:113-122(alias-stamped row still excludes the sibling); existing #250/#251 suites unchanged and green.
Commands run at this head (measured)
bun run typecheck→ exit 0bun run lint→ 498 warnings = baselinebun run test→ 892 pass / 14 skip / 0 fail (the 5 case-sensitive-volume tests skip on this case-insensitive APFS host; they ran on ubuntu CI)bun run test:e2e→ 30 pass / 0 fail- CS-volume differential probe: head isolates, merge-base leaks (evidence above)
No existing assertion deleted, skipped, widened or re-toleranced: the only deletions in the diff are inside visibility.ts (the replaced key-or-path expression); no existing test file is touched.
test-windows failure (required context — quoted, attributed)
Job test-windows, run 41553457268, step "Tests":
(fail) supersede racing appends > a concurrent reader never sees a half-written file [5192.33ms]
ENOENT: no such file or directory, open 'C:\Users\RUNNER~1\AppData\Local\Temp\osi-race-MYMRoS\memory\evidence\2026-11-03.logfmt'
(fail) prune racing appends / restore racing appends ×2 / two processes sharing one store ×2
Attribution: all 22 fixture-path references in the failed log point at one root (osi-race-MYMRoS) — the six failures are one event: the 5192ms timeout kill orphaned supersede promises, afterEach removed the fixture root, the survivors' ENOENTs were charged to the five tests that followed. This is the documented flake of that exact test (green on rerun at identical commits before this PR); concurrency.test.ts write paths are untouched by this diff, and the new test file's bodies skip on NTFS (foldsCase, confirmed in the job log). ci.yml itself: "test-windows is informational — it reports, it cannot gate merges." A rerun (gh run rerun 41553457268 --failed) needs actions:write, which the reviewer app lacks — a maintainer can trigger it.
Findings
- nit:
test-windowsred as analyzed above — rerun recommended before merge for a clean board; no code defect found in or around it. - nit:
matchesRepositoryclassifies a stamp as legacy only whenrepoPathis present; a legacy folded stamp that lost itsrepoPathkeeps the broad key match. Deliberate and documented (README:122, test:164-171) — historical identity is unrecoverable from the key alone.
— ocsi-reviewer
|
🎉 This PR is included in version 0.15.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #254.
A historical whole-path-lowercased key for
Foocan equal the current path key of a distinctfoodirectory. The shared visibility checks accepted that key despite a conflicting storedrepoPath, exposing the owner's memories and evidence to the sibling.Memory rows, raw restore lines and evidence now share a repository matcher. When the stamp matches the historical lowercase hash of its canonical stored path, access follows that directory, including real symlink/junction and case-insensitive aliases. Remote-derived keys retain sharing between clones at different paths. No row rewrite or schema migration is required; #168's session-binding work is untouched.
Compatibility limit: stamps without
repoPathretain key-only matching because the historical identity source cannot be recovered from the key alone. README states that limit. Global/admin access and session-private unstamped evidence keep their existing rules.Validation on Bun 1.4.4, based on main
d286e7a:bun run gate: typecheck and lint pass (498 warnings / 131 infos); 866 unit tests pass / 31 skip / 0 fail, and 30 real-host E2E tests pass / 0 fail. Five new case-sensitive tests skip on this Windows volume and run on WSL Linux. The new test file has no lint diagnostics.Taking this issue following the maintainer's Discord handoff relayed by the user. Please feel free to narrow or reject this compatibility approach if you prefer explicit identity provenance or migration.