Uh oh!
There was an error while loading. Please reload this page.
fix(storage): keep portable path tests stable on Windows - #2395
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for this — the fixture fix is solid (the tmpdir() path really did violate the POSIX-absolute contract on Windows), and the variant set is a strict superset of the old behavior, so there's no regression risk.
One thing I'd double-check though: coarseCwdVariants only flips the trailing separator, so a filter like C:\\Users\\me\\project (which is what process.cwd() actually looks like on Windows) produces {C:\\..., C:\\.../, C:\\...\\} — no C:/Users/me/project form in there. If Codex does store POSIX-shaped cwds as the PR body says, the pre-filter would still drop those rows before the authoritative normalizePath comparison gets to accept them. In other words the fix covers the POSIX-input shape the tests exercise, but not the native-input shape production actually sees (old and new code both miss that one, so it's not a regression — just an incomplete claim).
Minimal fix if you want it airtight: add the forward-slash-flipped form (candidate.replace(/\\\\/g, '/')) to the set — it's a pure function, so a direct unit test with path.win32 would pin it on every CI, not just the Windows lane (the current 3 cwd tests pass on POSIX under both old and new code, which is how this slipped through). Alternatively, if Codex actually stores native paths on Windows, it's worth softening the PR description to frame this as a test-stability fix rather than a production bug fix.
Non-blocking either way. Minor: the comment at foreign-session-store.ts:573-576 ("the exact normalized path or its trailing-separator variant") no longer describes the six-variant set.
liugddx
commented
Aug 7, 2026
Addressed in
Validation:
The complete foreign-session test file still has the pre-existing Windows symlink privilege failure when Developer Mode is unavailable; that is separate from this review change and remains in the #2142 capability-skip group. |
b019477 to
e120277Compareliugddx
commented
Aug 7, 2026
The new failure is repository-wide formatting residue from #2406, not this PR's storage changes. The required I rebased #2395 onto current main ( The review follow-up itself remains green locally: Core/Storage build, four targeted cwd tests, and |
e120277 to
144834aCompare
jackwener
left a comment
There was a problem hiding this comment.
Adversarial review — approve & merge
Scope
codexCwdSqlVariants(): coarse SQL pre-filter for Codex cwd across separator styles- Fixture: sandbox boundary path forced to POSIX
/tmp/...(contract requires normalized absolute POSIX paths)
Attack surface checked
SQL injection — variants are bound params (IN (?,?,…)), never interpolated. Safe.
False negatives (still miss rows before JS filter)
- Separator flip + trailing
/\covered; reviewer gap addressed withpath.win32unit test. - Case (
C:vsc:), 8.3 short names, UNC-vs-drive still not covered — pre-existing on both SQL andnormalizePath()string compare; not a regression. - Cross-host
resolve()of foreign-style paths is noisy on POSIX but production filter is host-native.
False positives / LIMIT pollution
- Variant set is same-path shape variants only; should not admit other projects into the LIMIT window.
- Authoritative two-sided
normalizePath()still runs incodexRowsToSummaries().
Empty IN () — function always yields ≥1 variant for any string input.
Sandbox fixture — isNormalizedAbsolutePath rejects \ and non-/ roots; tmpdir() on Windows violates the contract. Hardcoding /tmp/maka-output correctly exercises :slash_tmp → already_applied.
API surface — exporting codexCwdSqlVariants is a minor public export for testability; acceptable.
Validation
- CI green (incl. windows_baseline non-blocking)
- Local: 3 Codex cwd tests + sandbox settlement test pass
No blocking issues. LGTM.
Uh oh!
There was an error while loading. Please reload this page.
Summary
LIMITPart of #2142 Phase 1.
Why
On Windows,
path.resolve('/target')becomes a drive-qualified native path before the Codex thread query runs. The SQL pre-filter therefore discarded rows storing Codex's POSIX cwd before the existing JavaScript normalization could compare them. Separately, the sandbox-boundary fixture passedtmpdir()into a contract that intentionally accepts normalized absolute POSIX paths.Validation
npm --workspace @maka/storage run buildnpx biome checkfor changed filesgit diff --check678 pass / 14 fail / 45 skip, improved from677 pass / 18 fail / 44 skip