Repository navigation
test(control-plane): give the DEL-chunk sweep test its own 20 s timeout - #988
Conversation
The test builds 251 turns one at a time against a real Redis before the sweep: over 750 sequential round trips, near vitest's 5 s default on a loaded runner (it timed out once at 5008 ms). Its 502-key boundary is unchanged. Closes rossoctl#987 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
Correct, minimal fix for the #987 flake. The DEL-chunk sweep test now carries its own 20 s timeout — the same }, 20_000); idiom already used for long tests in packages/mocactl, packages/supervisor and packages/session-backend — and nothing else changes: the 251-turn setup, the 502-key boundary and every assertion are untouched.
I verified the timeout is actually in force with a positive/negative control at 300 ms default (see below): the pre-PR file fails with Test timed out in 300ms, the head passes the same invocation in 470 ms because the per-test 20 s overrides the config default. Both turn-store suites are green at the default timeout.
Author: webchang (MEMBER — maintainer)
Areas reviewed: control-plane test helper (turn-store-contract.ts), vitest timeout semantics, CI status
Agent/IDE config (.claude/.vscode): none (1 file changed, test helper only)
Commits: 1 commit, all signed-off: yes (DCO green, Assisted-By trailer per repo convention)
CI status: passing (17/17 checks, incl. check, lint, codeql, k8s-kind-e2e)
Verified by: npx vitest run test/turn-store-redis.test.ts -t 'sweeps more turns' --testTimeout 300 at head 7d50e6cd → pass (470 ms) and on the pre-PR file of the same test → Test timed out in 300ms; the same at --testTimeout 1000 → pass (427 ms); npx vitest run test/turn-store-redis.test.ts test/turn-store.test.ts at head → 60/60 pass against a local Redis 8.10.3 (not 7-alpine, but the sweep is chunk-count-driven, not version-driven); tsc --noEmit clean; prettier --check clean on the changed file. No probes were left behind; the local pr988 checkout was restored to main.
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
| } | ||
| await done(); | ||
| }); | ||
| // Over 750 sequential round trips against a real Redis: on a loaded CI runner that's near the 5 s default. |
There was a problem hiding this comment.
nit — the rationale reads best beside the timeout it explains. As the last statement of the body, after await done() has already torn the store down, a reader only meets it after finishing the test, and at a glance it looks like it annotates the teardown.
Suggested fix (either works):
// Over 750 sequential round trips against a real Redis: on a loaded CI runner that's
// near the 5 s default.
it('sweeps more turns than one DEL chunk holds (§9.2)', async () => {or keep it on the timeout argument:
}, 20_000); // over 750 sequential round trips against a real Redis: near the 5 s defaultWhy it matters now: this file is the shared contract for both the Redis and the in-memory store, so the next slow case added here will copy whatever convention lands first.
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Approving. Correct, minimal fix for the #987 flake, and the arithmetic in the new comment checks out.
- Default timeout:
packages/control-plane/vitest.config.tssets onlyinclude, so vitest's 5000 ms default is in force; the per-test third argument overrides it for this test and nothing else. The}, 20_000);form is already used in six other test files (mocactl, supervisor, session-backend, harness), so it matches existing practice, and vitest ^2 supports the signature. - "Over 750 sequential round trips": 251 turns ×
create+putResult+finalize= 753. Accurate. - Boundary unchanged: still 251 turns = 502 keys against
DELETE_CHUNK = 500(src/turn-store.ts:97, chunk loop:438-440); the first/middle/last assertions are untouched. - CI: all 17 check runs at 7d50e6c are green (including
check,lint,codeql,k8s-kind-e2e); DCO signed.
One non-blocking note: the comment sits after await done(), where it reads as if it annotates teardown. clawgenti already made that nit on this head, so I won't repeat it inline, but moving it above the it( (or onto the 20_000) is worth taking. Also, since the contract is shared, turn-store.test.ts (in-memory) now also gets 20 s instead of 5 s — harmless, but it does loosen the fail-fast guard for that suite.
Author: webchang (MEMBER — maintainer)
Areas reviewed: control-plane test helper, vitest timeout semantics, CI
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (17/17 checks)
Upstream rossoctl#972, rossoctl#977, rossoctl#978, rossoctl#979, rossoctl#981, rossoctl#983, rossoctl#985, rossoctl#988 and rossoctl#990 (44 commits past 49cce28). No conflict. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Closes #987
What.
sweeps more turns than one DEL chunk holds (§9.2)inpackages/control-plane/test/helpers/turn-store-contract.tsgets its own 20 s timeout, with a one-line comment saying why. Nothing else changes: the test still builds 251 turns (502 keys, one fullDELETE_CHUNKof 500 plus a remainder) and checks the first and last turns are gone.Why. The test makes over 750 sequential round trips to a real Redis before the sweep, which puts it near vitest's 5 s default on a loaded runner. It timed out once at 5008 ms in CI (#987).
Tests. Against a local
redis:7-alpine:--testTimeout 1000) so the limit is reachable on a fast machine: without the change the test fails withTest timed out in 1000ms; with it the test passes (about 1.6 s), so the per-test timeout takes effect;turn-store-redis.test.tsandturn-store.test.tspass (60 tests); typecheck is clean.Assisted-By: Claude Code