Prevent indexed cache TTL test flakes - #2184
Open
kriszyp wants to merge 3 commits into
Open
Conversation
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the 'Can load cached indexed data' unit test in caching.test.js to use robust asynchronous assertions (waitFor) instead of fixed timeouts, and introduces dynamic cache expiration control via a sourceExpiresAt variable. The feedback suggests adhering to the repository style guide by explicitly using assert.strictEqual instead of assert.equal for asserting primitive values.
Contributor
|
Reviewed; no blockers found. |
kriszyp
marked this pull request as ready for review
August 20, 2026 03:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The indexed cache test depended on a 5 ms expiry and 10 ms sleeps, so loaded runners could observe an additional revalidation before the exact source-request assertion. This change controls the source expiry explicitly, waits on cache state and source-write locks, preserves exact request counts, and verifies secondary-index cleanup directly.
For the human reviewer
No open judgment calls — mechanics verified by cross-model review (receipt @ 0ad3ae1).
Verification
npm run build— passed.npx mocha unitTests/resources/caching.test.js --grep "Can load cached indexed data"repeated 50 times — 50/50 passed.evict(23, entry, entry.version)argument makes the direct index assertion fail with1 == 0; the correctedentry.valuecall passes.npx prettier --write unitTests/resources/caching.test.jsand focusedoxlint --deny-warnings— passed.npm run test:unit:resources— 1,553 passing / 15 pending; three unrelated existing failures remain indatabases.test.js,randomAccessFieldsDirective.test.js, andreplayStructures.test.js. The changed caching test passed in this gate.Review coverage
Authored by GPT-5 Codex. Initial full review: Claude Opus 5, Cursor Composer 2.5, and Harper-domain adjudication. Final-head delta review: Claude Opus 5 ✓; Gemini via agy ✗ (no output); Cursor and domain legs pruned by the low-risk delta policy. Receipt @ 0ad3ae1.
Human-Review-Need: 3 @ 0ad3ae1