test(auth): fix sub-second race in TTL-cap introspection test#1675
Merged
Conversation
`exp: Math.floor(Date.now() / 1000) + 1` gives a remaining lifetime of ~1ms–999ms depending on sub-second clock position, so on slow CI runners the cache entry expires before the second auth() call lands. Change `+1` → `+2` (guarantees ≥1 s of remaining TTL regardless of offset) and extend the post-expiry sleep from 1200 ms to 2500 ms (500 ms slack over the new ~2-second window, vs. the previous 200 ms which was the root of the flakiness). Fixes #1673. https://claude.ai/code/session_01SSAxWkYWJZyuBy4CXHhzKx
The `Check for changeset` CI gate runs `changeset status` which doesn't distinguish test files from library code. Project CLAUDE.md says test-only changes don't need a release changeset; the empty changeset is the documented escape hatch (`changeset add --empty`) for that case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
May 22, 2026
The `Check for changeset` CI gate runs `changeset status` which doesn't distinguish test files from library code. Project CLAUDE.md says test-only changes don't need a release changeset; the empty changeset is the documented escape hatch (`changeset add --empty`) for that case. Same pattern as #1675. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
May 22, 2026
…chema properties (#1918) * test(codegen): lock @deprecated JSDoc generation on deprecated JSON Schema properties Closes #1915 Adds three regression tests to `test/jsdoc-constraints-codegen.test.js` that lock the behavior that `deprecated: true` in a JSON Schema property produces `@deprecated` JSDoc in the TypeScript types generated by `json-schema-to-typescript` v15. Motivation: the expert review on adcontextprotocol/adcp#4904 (the 3.1 additive-deprecate on `CreateMediaBuySuccess.status` / `UpdateMediaBuySuccess.status`) flagged that `deprecated: true` propagation through codegen is partially reliable across toolchain versions. This test fires on any jsts upgrade that silently drops the annotation, which would remove the IDE deprecation signal for buyers without any runtime failure." * chore: add empty changeset (test-only change, no release) The `Check for changeset` CI gate runs `changeset status` which doesn't distinguish test files from library code. Project CLAUDE.md says test-only changes don't need a release changeset; the empty changeset is the documented escape hatch (`changeset add --empty`) for that case. Same pattern as #1675. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #1673
exp: Math.floor(Date.now() / 1000) + 1gave the introspection cache a remaining lifetime window of anywhere from ~1 ms to ~999 ms depending on where in the current second the test started. On slow CI runners (or when the test fired within the last few ms of a second), the cache entry expired before the secondauth()call landed, causingcallCountto reach 2 instead of the asserted 1. The fix changes+1→+2, which guarantees the effective TTL is always between 1000 ms and 2000 ms regardless of sub-second clock offset. The post-expiry sleep is extended from 1200 ms to 2500 ms to give 500 ms of slack over the new ~2-second worst-case window (the original 200 ms slack was the root of the timing fragility).What was tested:
npm run format:check— passed ✓npm run typecheck— passed ✓ (pre-existing@types/node/moduleResolutiondeprecation errors present onmainbefore this change; unrelated to diff)schemas:ensurestep (403 fromadcontextprotocol.org); schema cache is gitignored and unavailable without network. Change is test-only — no library code touched. CI will run the full suite on push.node --check test/server-auth-introspection.test.js— passed ✓Pre-PR review:
+2guarantees 1000–2000 ms effective TTL; 2500 ms sleep gives ≥500 ms slack over worst-case expiry. One nit: inline comment "Second call within 1s — cached." is slightly imprecise post-fix (token now lives 2 s); no blocker.@sinonjs/fake-timers(separate decision). Nit:+2/2500are implicitly coupled; a named constant would make the relationship explicit but is not a blocker.Session: https://claude.ai/code/session_01SSAxWkYWJZyuBy4CXHhzKx
Generated by Claude Code