Repository navigation
test: the Rest "tonight" case of the agent-access document test pins its clock - #2175
Merged
Merged
Conversation
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.
Summary
One parameterised test read the real clock, so the
webjob failed for every pull request that ran between 00:00 and 07:59 UTC.The validation under test calls
restChoicesAt(Date.now())(rows.ts:391), which drops "tonight" before 08:00 local (rest-end.ts:31-34). The block's existingafterEach(() => vi.useRealTimers())(line 241 area) restores the clock, and its other tests already pin it the same way. No production file changes.Related issues
Closes #2174
Related decisions / docs
None.
Runtime evidence (required for UI / DOM / runtime behavior)
N/A — no runtime behavior change (test file only).
Red, before the change:
TZ=Etc/GMT+8 pnpm exec vitest run src/settings/agent-access/document.test.tsat local hour 01 gives 1 failed, 28 passed, with the assertion quoted in the issue. Green, after: the same command gives 29 passed; with noTZ(local hour 18) 29 passed.Merge danger
Door: two-way (a revert undoes it). Blast radius: one test file.
Review tier: Ship. Nothing a user, the backend or another process can observe changes; the diff is two lines in a test, read in full.
Verification
pnpm buildpasses (includes tsc typecheck)pnpm testpasses (this file, with and without the early clock; the full suite runs in CI)pnpm lintpasses (biome checkon the file: no fixes)cargo test/cargo clippypass (Rust changes): noneChecklist (YUI principles)
docs/reference/client-context.mdalongside the code: nonedocs/agent-guide/architecture/map.jscarries every module, part, and exchange this PR adds, removes, or changes (or none changed): none changedgenerate_expresstool-call argumentsconfigs/skip-testslabel justified): the change is the test