Skip to content

test: delete the redraw wall-time race and shrink oversized scaling populations (~105 s per run) - #37385

Merged
nwparker merged 1 commit into
mainfrom
test/shrink-expensive-tests
Nov 2, 2026
Merged

nwparker merged 1 commit into
mainfrom
test/shrink-expensive-tests

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This is a skeptical pass over the most expensive unit test files from green main run 41400829349. It deletes one suite, shrinks five scaling suites, and fixes one test that was waiting out a real 5 s timeout. Measured savings: about 105 worker-seconds per full unit run. For the changed files, CI test time went from 127.5 s on main (41400829349) to 64.4 s on this PR (41403569437). The deleted suite accounts for another 41.6 s, including its imports.

For every file I asked four questions: would deleting it let a real bug ship, is the behavior already covered more cheaply, is it testing timing rather than behavior, and is N larger than needed to catch the regression.

Changed

File Decision Value judgment CI s before CI s after
src/main/runtime/terminal-tail-redraw-wall-time.test.ts Delete Its result equality duplicates terminal-tail-redraw-row.equivalence (2,000 randomized streams against the same per-character reference). The #11315 complexity claim is already pinned deterministically by terminal-tail-redraw-scaling (it counts wide-row joins). What remains is a 3x wall-clock race, which is an anti-pattern: it waits on real time and duplicates coverage 41.6 incl. imports 0
structured-agent-session-input-order-projection.test.ts Shrink N 100 → 30 Every count is an exact formula in n, or n·log n with large constants. So N=100 catches nothing that 3x doesn't, and the loose node-read bound can't separate quadratic from linear at either size 33.7 10.7
acp-history-scaling.test.ts (two slowest cases) Shrink 200 → 80, ratio bounds scaled The cases are ratio checks. 4x still separates linear (4x) and n·log n (about 5.8x, bound 8x) from quadratic (16x). The three cheaper cases are unchanged 26.1 17.3
journal-checkpoint-scaling.test.ts Matrix of 8 cases → 4 Each case pays about 2 s of fixed worker cadence. The bounds are exact in population and never involve history, so the {100 chats, 1000 rows} corner exposes a regression on either axis, and the two mixed corners added nothing 19.5 10.9
chat-worker-legacy-failure-read.test.ts Shrink 1000 → 300 Every count is exact in n (3 * n, 5 * n, and so on). 300 still crosses the 128-row and 200-row journal page sizes 13.8 5.0
journal-input-legacy-baseline.test.ts Shrink 100 → 40 Bounds are linear plus small constants, so 4x already exposes superlinear indexing 10.7 3.5
orca-runtime "keeps each worktree poll paired with its platform generation" Fix The fresh poll was awaited while the stale scan was still held, so both polls waited out RESOLVED_WORKTREE_REPO_TIMEOUT_MS (5 s) and fell back to stored rows. They now run concurrently, and the test asserts that both generations really scanned 23.7 (whole file) 17.0 (whole file)

For the deleted suite, the entries in vitest-node-runtime-files.mjs, config/flaky-test-pattern-baseline.txt and ci-shard-timings.json are removed.

Kept (each has a concrete bug it catches that nothing cheaper does)

File(s) CI s Why kept
Codex Stop suites (codex-interrupt-order, codex-goal-stop-settings, codex-stopped-send-order, codex-turn-end-settlement) ~80 The only coverage that an interrupt answered before turn/completed never shows a transient failed turn. The 5 s is CODEX_STOP_GRACE_MS, which is inherent to that ordering; avoiding it would need a test-only production seam
account-add-process 33 Real CLI: held pipes, owned descendants, and cleanup after the real 10 s execution deadline (#36292)
remote-node-runtime-host-download 31 The only proof that the remote host's wget watchdog kills a trickling download without a timeout command (#35869). The 30 s is the production minimum attempt
server-claude-helper-recovery / -kill 43 Real hook server and spool timing for killed Claude helpers (#35930). The waits are production transcript and persist cadence
wsl-distro-holder-script 29 The only real-shell coverage of the WSL distro holder (/proc scanning, fail-closed cases)
serialize-grid-transcript-replay 26 Replays captured TUI transcripts against the serializer, with known-failure counts calibrated to 2 seeds
pty-connection-*, launch-parity-window-tab, orca-runtime (other cases) ~200 Hundreds of small real-behavior cases. Their CI time is mostly a cold import charged to the first test plus 4-worker contention, not per-test waste (for example, launch-parity takes 0.4 s locally)
codex-shell-no-daemon, codex app-server teardown/supervision/client ~60 Real shells and process groups, including SIGTERM-resistant descendants and session-deadline kills
journal-outcome-scaling 23 10N=400 deliberately crosses MAX_JOURNAL_LIFECYCLE_BATCH_MUTATIONS (200). Shrinking it would drop that boundary
remote-runtime-request-connection 10 Intentionally asserts that the real 5 s cancellation timer elapses
use-ai.operation-recovery 10 Two 5 s waits on the chat-discovery bound, because the runtime fixture lacks host capabilities. This needs a runtime-catalog fixture (follow-up), not deletion
orchestration-cli-restart-handoff 20 Single end-to-end CLI restart/mail handoff. Time is the production 2 s mail-repoint debounce
pr-unit-support-routing 15 Builds the real repo import graph once in beforeAll. It is the only check that product code never imports test harnesses (leaving CI scoping alone)

Checks

  • pnpm test on all touched suites, plus the redraw scaling/equivalence suites and the config suites that read vitest-node-runtime-files.mjs: 1,520 passed (orca-runtime re-run after one assertion fix).
  • oxlint and oxfmt on the changed files: clean.
  • pnpm check:flaky-test-pattern-ratchet: OK (3,325 findings, baseline entry removed).

…opulations

Deletes terminal-tail-redraw-wall-time: its result equality duplicates the
randomized equivalence suite and its complexity claim is pinned by the
join-counting scaling suite; it only added a 3x wall-clock race.

Shrinks scaling suites whose bounds are exact or log-bounded formulas in n to
the smallest population that still separates linear from superlinear work, and
pairs a worktree-poll test's scans so it no longer waits out the 5 s scan timeout.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 41778267-96ad-4f06-a4d9-3dbcbb08545b
Commits

Reviewing files that changed from the base of the PR and between 4343dc2 and 22dc637.

Files selected for processing: 10
  • config/flaky-test-pattern-baseline.txt
  • config/scripts/ci-shard-timings.json
  • config/scripts/vitest-node-runtime-files.mjs
  • src/main/acp/history/acp-history-scaling.test.ts
  • src/main/native-chat/agent-session-journal/journal-checkpoint-scaling.test.ts
  • src/main/native-chat/agent-session-journal/journal-input-legacy-baseline.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-input-order-projection.test.ts
  • src/main/runtime/orca-runtime-tests/mobile-creation-and-orchestration-part-04.spec.ts
  • src/main/runtime/orchestration/chat-worker-legacy-failure-read.test.ts
  • src/main/runtime/terminal-tail-redraw-wall-time.test.ts
Files with no reviewable changes: 4
  • config/flaky-test-pattern-baseline.txt
  • config/scripts/vitest-node-runtime-files.mjs
  • src/main/runtime/terminal-tail-redraw-wall-time.test.ts
  • config/scripts/ci-shard-timings.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

Scaling tests use revised populations, schedule combinations, and growth bounds. The worktree polling test now asserts that overlapping polls each trigger a scan. The terminal-tail wall-time comparison test and its related baseline, timing, and runtime include entries are removed.

Merge Risk: Low · up to 22dc6

The change is mergeable with a bounded test-coverage gap: the revised polling test can pass without exercising overlapping scans. Wait for the second scan to start before resolving the first to protect that behavior.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title names the main change: deleting the redraw wall-time test and shrinking oversized scaling populations. The changeset deletes terminal-tail-redraw-wall-time.test.ts and shrinks several scalin…
Description check Passed The description follows the required template closely. It has a clear What Changed section with a per-file table, a Why section explaining the reasoning for each decision, a Testing section with repor…
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 6 files.

Full details: Title check

Explanation

The title names the main change: deleting the redraw wall-time test and shrinking oversized scaling populations. The changeset deletes terminal-tail-redraw-wall-time.test.ts and shrinks several scaling suites, so the title matches the primary change. The stated runtime saving is also reflected in the description. The title is 96 characters and 15 words, a little long, but it is clear and specific.

Full details: Description check

Explanation

The description follows the required template closely. It has a clear What Changed section with a per-file table, a Why section explaining the reasoning for each decision, a Testing section with reported pnpm test, oxlint/oxfmt, and flaky-test ratchet results, and a Risk-related rationale. The Linked Issue section is missing: it says 'Fixes #' with no issue number, and the author did not link an issue. The ELI5, Visual Proof, Risk Level, AI Disclosure, Review, and Agent skill upstream boundary sections are also missing or unfilled. The Visual Proof section needs N/A with a reason, since this is not a UI change. The Risk section needs a Level and a revert note. The Checklist items are not ticked. The description is mostly complete on substance, but the template sections need to be filled in.

Resolution

Add an ELI5 section in plain language. Replace the empty 'Fixes #' line with a linked issue, or explain why none applies. Write 'N/A' with a reason under Visual Proof, since this change has no UI impact. Under Risk, set the Level (Low, Medium, or High) and describe how to back out the change. Fill in or mark the AI Disclosure section if applicable. Complete the Agent skill upstream boundary checkbox and the Checklist items.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment on lines +413 to 414
const freshPolling = runtime.getWorktreePs()
staleScan.resolve(MOCK_GIT_WORKTREES)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Wait for the fresh scan to start before resolving staleScan.

runtime.getWorktreePs() can yield before the underlying listWorktrees call. The test resolves staleScan immediately after starting freshPolling, so it does not prove that the fresh scan started while the stale scan was pending. A sequential implementation can still reach two total calls and satisfy the new assertion. Add a start barrier for both scans, then resolve staleScan after the second scan call is observed. (raw.githubusercontent.com)

@nwparker nwparker changed the title test: delete the redraw wall-time race and shrink oversized scaling populations (~90 s per run) test: delete the redraw wall-time race and shrink oversized scaling populations (~105 s per run) Nov 2, 2026
@nwparker
nwparker merged commit 3a00c74 into main Nov 2, 2026
47 checks passed
@nwparker
nwparker deleted the test/shrink-expensive-tests branch November 2, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant