Skip to content

test(control-plane): give the DEL-chunk sweep test its own 20 s timeout - #988

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i987-chunk-test-timeout
Nov 23, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/i987-chunk-test-timeout

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #987

What. sweeps more turns than one DEL chunk holds (§9.2) in packages/control-plane/test/helpers/turn-store-contract.ts gets its own 20 s timeout, with a one-line comment saying why. Nothing else changes: the test still builds 251 turns (502 keys, one full DELETE_CHUNK of 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:

  • with the default timeout lowered to 1 s (--testTimeout 1000) so the limit is reachable on a fast machine: without the change the test fails with Test timed out in 1000ms; with it the test passes (about 1.6 s), so the per-test timeout takes effect;
  • at the default timeout, turn-store-redis.test.ts and turn-store.test.ts pass (60 tests); typecheck is clean.

Assisted-By: Claude Code

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]>
@webchang
webchang requested a review from pdettori as a code owner November 22, 2026 15:28
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 23, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 default

Why 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 ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Correct, minimal fix for the #987 flake, and the arithmetic in the new comment checks out.

  • Default timeout: packages/control-plane/vitest.config.ts sets only include, 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)

@pdettori
pdettori merged commit 3e9d135 into rossoctl:main Nov 23, 2026
17 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 23, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

control-plane test: the TurnStore DEL-chunk sweep test can exceed the 5 s default timeout in CI

4 participants