Repository navigation
Conversation
The requestState cases pinned tamper rejection and the round trip, but not expiry: that a correctly signed, untampered state is refused once its time has run out. The new case freezes the clock, continues the same state at +599 s (accepted) and at +601 s (refused with -32602), so it fails if the expiry check is absent or the TTL changes. Closes #5542 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 22 | 4 | 8 | 5 |
| Head | 22 | 4 | 8 | 5 |
Updated by this run for f67c1c0a23db3eaf1ce196821184892f672c8e31.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the added request-state expiry regression coverage.
No open issues 🎉
What changed in this PR
Adds regression coverage for the everything server’s 600-second requestState expiry, addressing #5542 without changing server behavior.
Changes:
- Adds a fake-clock test confirming the same untampered continuation is accepted at +599 seconds and rejected with
-32602at +601 seconds. - Updates the test file’s header comment to include expired-state coverage.
| File | Description |
|---|---|
src/everything/__tests__/modern.test.ts |
Adds request-state TTL regression coverage and updates the coverage summary comment. |
Review effort: Balanced
|
Copilot round 1 (review 5962995958, on f67c1c0): clean. No comments and no suppressed findings, so the review loop ends here on the first clean round. Nothing was pushed after the review. |
Closes #5542
Description
Adds one test to
src/everything/__tests__/modern.test.ts, beside the existingrequestStatecases inmulti-round-trip requests on 2026-07-28: a correctly signed, untamperedrequestStateis refused with -32602 once its 600-second TTL has passed.The test freezes
Datebefore the state is minted (the fake-Date pattern the minted-resource TTL test in the same file uses), then sends the same continuation twice:The in-TTL half is there because an expired state and a tampered one are the same error on the wire (
{"code":-32602,"message":"Invalid or expired requestState","data":{"reason":"invalid_request_state"}}for both), so a lone -32602 assertion would not show that the refusal is the expiry. The file's existingafterEachalready callsvi.useRealTimers(), so the real clock is restored when the test fails too.The file header's summary gains "or expired". No source change.
Server Details
__tests__/modern.test.ts)Motivation and Context
#5542: the tests pinned tamper rejection and the happy-path round trip, but not expiry, which is the security-relevant half of the TTL declared on
roundStateCodec(ttlSeconds: 600inserver/index.ts).How Has This Been Tested?
This change has no client-observable surface (a test only), so the evidence is a targeted probe: the test made to fail by breaking what it pins, then passing against the unmodified source.
server/index.ts, changed locally and restored)ttlSeconds: 600)ttlSeconds: 6000(no expiry at +601 s)expected undefined to match object { code: -32602 }(the +601 s continuation was accepted)ttlSeconds: 500(expires early)expected { code: -32602, … } to be undefined(the +599 s continuation was refused)npm test -w src/everything -- __tests__/modern.test.ts: 54 passed.npm run local:gate: exit 0 on the pushed head.Breaking Changes
None. No user-facing change.
Types of changes
None of the four applies: this adds a test.
Checklist
npm run changeset) if this changes what a TypeScript server publishes (not applicable: tests are not published)Additional context
The test uses 599 s and 601 s rather than the exact boundary: whether a state is still good in its 600th second is the SDK codec's detail (
exp < now, in whole seconds), not something this server declares.🤖 Generated with Claude Code