Repository navigation
fix(usage): ignore a ChangeTime-only ledger move on Windows (pricing-cache lane=all failure) - #8799
Conversation
…on Windows On NTFS the config home's background ACL harden re-applies inherited ACEs to usage.jsonl and moves its ChangeTime with dev/ino/size/mtime/birthtime unchanged, which rebuilt the filter index and every retained aggregate. POSIX keeps ChangeTime. The pricing-cache test now requires unchanged on every platform.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Validation evidence for e3c2846 (merge manager): Windows (desktop-c795oh4, Windows 11, bun 1.3.14, GITHUB_ACTIONS unset):
Linux (pen-cc-01): |
|
Maintainer integration of #8799 at e3c2846. This repairs the last red shard (windows 11/14,
Next step: one batched |
Summary
tests/server/model-costs-pricing-cache.test.ts:140("policy-only API writes refresh warm estimate, summary and aggregate caches") fails on Windows withExpected "unchanged", Received "rebuild": 5/5 runs at stage 0 on a Windows 11 host (desktop-c795oh4), intermittently on hosted Windows (devlane=allruns on 2026-11-09 e76511d, 1d16d79, c81be32, a144140, 4b38e9a, and windows 11/14 at b378a43 on 2026-11-16, run https://github.com/lidge-jun/opencodex/actions/runs/43790630995). Between the two revisions onlyrevision.ctimeMsdiffers (+0.18–1.1 s); dev/ino/size/mtime/birthtime are equal, and a plain read/stat does not move ChangeTime on that host.Root cause (inferred from the code, not yet traced on Windows):
hardenConfigDir(src/config/paths.ts) starts a backgroundicaclson the config home whenever the home's ctime differs from the ACL memo (src/lib/windows-secret-acl.ts); config writes and the filter-index database creation change the home, and re-applying inherited ACEs movesusage.jsonl's ChangeTime.usageLogRevisionKeycounted ChangeTime, so the next read took the same-size branch ofrefreshOnce(src/usage/filter-index.ts) and rebuilt the filter index and every retained aggregate — a full ledger scan with no content change.usageLogRevisionKey(src/usage/log.ts) omitsctimeMson win32 (aplatformparameter defaults toprocess.platform). Content cannot change without moving mtime (100 ns resolution on NTFS), and the append path still verifies the boundary digest. POSIX keeps ChangeTime, where it is the one field that exposes an in-place rewrite that restores mtime. Because the key is the single comparison point, ledger retention and scanner mutation checks also ignore a ctime-only move on win32."rebuild": every warm read must be"unchanged", and the ChangeTime diagnostics JSON stays in the failure message, so a remaining failure names any other mover.tests/usage/usage-aggregate-cache.test.ts: a key-level test (a ctime-only move changes the key on linux/darwin, not win32; every other field still does) and a behavioural test (withprocess.platformset to win32, a chmod-driven ChangeTime-only move leaves the base and filtered aggregates"unchanged"and a later append is still picked up).structure/dashboard-and-usage.mdrecords the rule.Prepared by a merge-manager implementation task; validated and opened by the merge manager.
Verification
log.tsto 1993 lines):bun test tests/usage/usage-aggregate-cache.test.ts tests/server/model-costs-pricing-cache.test.ts38 pass / 0 fail;bun run typecheck,bun run structure:checkpass.Checklist
structure/dashboard-and-usage.md).Summary by CodeRabbit