Repository navigation
test(usage): stop asserting the overlay version against a moving oracle - #2549
Conversation
preview now carries the same tree as main and dev (36aed0b). The version string is the only difference, which is what the release workflow requires: preview publishes prerelease versions under the 'preview' dist-tag. Before this, the preview channel was 12,065 lines behind dev and still shipped the Compatibility Lab on every install's request path.
chore(preview): promote dev for the v2.20.0 line
[WRONG BRANCH] Merge dev into preview: Windows suite green
Merge dev into preview: ignore leftover test temp files
Merge main into preview: v2.24.2 release
Promote dev to preview: Wave 5 campaign (107 commits)
Promote dev to preview: CodeQL #87 ReDoS fix + closeout correction
Promote dev to preview: Wave 5 record corrections
Promote dev to preview: alert-precision record
Promote dev to preview: post-scan closing note
Promote dev to preview: final Wave 5 errata
Promote dev to preview: Wave 5 closing record
Promote dev to preview: v2.25.0 release train
release: v2.25.0-preview.20260818
promote: dev to preview for v2.26.0-preview.20260819
release: v2.26.0-preview.20260819
[WRONG BRANCH] release: sync dev into preview for 2.27.0
[WRONG BRANCH] release: sync dev into preview for 2.28.0
[WRONG BRANCH] release: v2.28.0-preview.20260820
[WRONG BRANCH] promote: dev to preview for v2.29.0-preview
# Conflicts: # package.json
[WRONG BRANCH] release: promote dev to preview for v2.31.0-preview.20260822
release: promote dev to preview (v2.32.0-preview)
merge dev into preview for the v2.33.0-preview.20260825 release
merge dev into preview for the v2.33.0-preview.20260825 release (release-gate parity)
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe package version is updated to a preview release. API usage tests now reset preserved disk-only provider state and use a settled overlay-version baseline for the mid-read race assertion. ChangesPackage release metadata
Overlay test stability
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This PR adjusts a flaky usage test and related test setup without changing production behavior; the targeted suite and type check pass, so no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…lay-version-oracle test(usage): stop asserting the overlay version against a moving oracle
…lay-version-oracle test(usage): stop asserting the overlay version against a moving oracle
Summary
tests/api-usage.test.tsfails reproducibly outside CI's dedicated single-file job. It blocked the release preflight, and it reproduces on the already-shippedmain(71c57ea64, v2.32.1) — it is not caused by anything in the current release.Cause
Two independent problems, both in the test rather than the route.
1. The final assertion used a moving oracle. It compared the cache stamp against
userCostOverlayVersion()read after the response:The server runs a 5-second overlay reconciler that re-reads the config from disk and refreshes the registry. Instrumenting the test showed the counter moving 9 → 10 during the settled request, so the cache was correctly stamped with the version its summary was priced under, and the assertion then compared it against a newer number.
The contract is "the cache is stamped with the version its summary was priced under" — not "the counter never moves again". The test now captures the version before issuing the request and asserts the stamp is at least that.
2. Module-level overlay state leaked across files.
preservedDiskOnlyProvidersoutlives a test file. Every other overlay suite callsresetPreservedDiskOnlyProvidersForTests(); this one did not, so a leftover provider could make a refresh byte-identical and the version would not bump at all.Why CI never saw it
ci.ymlrunsapi-usagein a dedicated job on a fresh runner with only this file, so neither the cross-file leak nor enough overlay history to make the timing matter ever existed there.Verification
The relaxed assertion is not vacuous. I injected a deliberate defect into the route — stamping the cache with
userCostOverlayVersion() - 1, exactly the stale-price bug the test guards — and the suite went to 3 fail. Reverting restored 32 pass. No production file is touched by this PR.Checklist
Summary by CodeRabbit
Bug Fixes
Chores
2.32.1-preview.20260825.