Skip to content

test: let Vitest projects own test deadlines - #10391

Merged
gensokyo-dev merged 5 commits into
mainfrom
ci/test-ci-optimization-20261113
Nov 13, 2026
Merged

gensokyo-dev merged 5 commits into
mainfrom
ci/test-ci-optimization-20261113

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Built test shards fail on most PRs and on scheduled main runs because per-test
deadlines are hard-coded to the speed of one host. This PR moves test deadlines
to the Vitest project policy and removes the per-test literals that only
shortened them.

Problem and expected behavior

In the last 80 failed CI runs, semanticFingerprintAccumulation.test.ts timed
out 25 times, on main and on unrelated PRs. asyncChunkCapacity.test.ts,
byteEntropyWindowsIdentity.test.ts, and a deferredRuntime.test.ts cleanup
hook (Vitest's 10-second hook default) also timed out on main. These
130,000-element regressions do 20–35 seconds of linear work on an idle core:
about 190–270 µs per element, profiled locally. Their explicit 30_000
deadline left no headroom on a shared runner.

A literal 30_000 also disables vitest.config.ts's coverage-aware 60-second
default. That is why scheduled full-qualification shards 5/6 and 6/6 failed with
"Test timed out in 30000ms" while coverage was enabled.

The suite had 533 literal test deadlines in 259 files: 164 at exactly the
30-second default and 137 below it. A deadline exists to turn a hang into a
named failure. A deadline below the project default catches no hang that the
default would not also catch; it only adds false failures under contention.

Change and scope

  • vitest.config.ts owns deadlines per project group: 30 s for source
    projects and 120 s for built projects, which launch compiled CLI, MCP, and
    provider processes. Coverage doubles every deadline, and so does hosted CI
    (kept from test(ci): double test deadlines on hosted runners #10417, which doubled the root deadline on hosted runners), so
    source tests still get test(ci): double test deadlines on hosted runners #10417's 60 s on hosted CI. Hooks share their project's deadline
    instead of Vitest's 10-second default.
  • A long-running tag ({ tags: ["long-running"] } or
    // @module-tag long-running) gives bounded workloads that need more 300 s,
    doubled under coverage. It replaces the 150–240-second literals and
    vi.setConfig({ testTimeout: 180_000 }).
  • An AST codemod (oxc-parser, not regex) removed 581 test, suite, and hook
    deadlines at or below their project deadline, plus 15 constants left unused.
    It converted 26 longer ones to the tag. Every affected test now has a
    deadline at least as long as before, with or without coverage. Comments that
    only justified a removed literal went with it. The one explaining a
    long-running parity sequence remains next to its tag.
  • Kept: deadlines derived from an operation budget (for example
    CHROME_STARTUP_TIMEOUT_MS + 30_000, 2 * preparationBudget + 30_000),
    where the test must outlive the inner deadline whose diagnostics it checks.
    Also kept: the opt-in 30-minute real buildComputer deadline.
  • semanticFingerprintAccumulation drops the explicit 60 s from test(ci): double test deadlines on hosted runners #10417; the
    built-project deadline (120 s, 240 s on hosted CI) now covers it. It also analyzes its 130,000-callable source once
    and shares the result across both projection modes. Projection does not
    mutate the analysis (checked with a deep-equality probe). The file goes from
    70 s to 54 s locally.
  • Four wide-input tests used a short deadline as their only guard against a
    slow but terminating implementation: environmentStateWriteCopies, two
    environmentStateWriteExplain tests, and the cyclic-inheritance bound in
    getter_aliases. They now assert the same budgets as elapsed time. The
    composed-body test keeps its exact read count instead. The other short
    deadlines were reviewed: their tests already bound time through an inner
    operation deadline, an elapsed assertion, or a result that names the
    applied limit, or they guard only against a hang.
  • tests/support/testDeadlines.ts holds the base deadlines that the config
    applies. Probe tests in a source project and a built project read each
    collected test's task.timeout, covering untagged tests and test, suite,
    and module tags. CI runs them with and without coverage.
  • docs/development/testing.md documents the deadline policy.

Not included: making semantic-graph projection or static analysis faster per
element. That is product performance work beyond this CI fix. Job-level
timeout-minutes remain as runner backstops.

Contribution scope: not applicable. This changes test infrastructure only.

Contract and boundary impact

  • Semantic owner and earliest changed stage: vitest.config.ts project policy
    now owns test and hook deadlines; tests no longer restate them.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: none.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: ciTestProjects.test.ts resolves the real config
    under each coverage flag form. It asserts the root, source-project, and
    built-project test and hook deadlines, plus the long-running tag deadline.
    tests/boundary/filesystem/testDeadlines*.test.ts and
    tests/evaluation/testDeadlines.test.ts check the deadline Vitest applies
    to collected tests.
  • Codemod equivalence: for all 280 changed test files, the syntax trees of the
    base and changed versions were compared after stripping test timeouts,
    tags, and the removed constants. 274 are identical. The 6 that differ are
    the intentional manual edits listed above. Every edited callee resolves to
    Vitest's it/test/describe, a hook, or a .extend/.skipIf alias.
  • Base reproduction: on cdc4541ef,
    npm run test:focused -- tests/boundary/javascript/semanticFingerprintAccumulation.test.ts
    failed both cases with "Test timed out in 30000ms" (70.5 s, 2.7 GB peak
    RSS). Failing CI jobs include 131987684430 and 131991573508 (scheduled
    main, coverage).
  • Resolution probe (now committed as tests): a test read task.timeout. Without coverage:
    source 30,000, built 120,000, and long-running 300,000 for test, suite,
    and module tags. With --coverage.enabled: 60,000, 240,000, and 600,000.
  • Remaining proof gaps: the complete suite was not run locally; CI covers it.

Validation performed

  • npm run check:fast — typecheck and lint passed.
  • vitest run on the deadline probes and the four elapsed-time tests, with and without --coverage.enabled — 6 files, 214 tests passed both ways. Under coverage the elapsed-time tests took at most 381 ms against 1 s and 5 s budgets.
  • npm run docs:check — passed.
  • oxfmt --check on changed files — passed.
  • npm run test:focused -- tests/boundary/filesystem/ciTestProjects.test.ts tests/boundary/javascript/semanticFingerprintAccumulation.test.ts tests/boundary/javascript/asyncChunkCapacity.test.ts tests/boundary/filesystem/installScript.test.ts tests/boundary/filesystem/wideDirectoryTraversal.test.ts tests/boundary/process/electronLaunchRejections.test.ts src/domain/analysisView/environmentStateWriteComposed.test.ts tests/boundary/cli/cliOutput.test.ts — 8 files, 157 tests passed (118.7 s, 3.0 GB peak).

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Open PRs that add a literal
    timeout still work; an explicit timeout still overrides the project deadline.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. A hanging test now
    fails after its project deadline (up to 120 s for built tests) instead of a
    shorter literal; job-level timeouts still bound the run.

Author readiness

Human owner: @gensokyo-dev

The author account is exempt from the readiness declaration (CONTRIBUTING.md); the human owner's review and evidence responsibilities still apply.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

No issue is linked; the failures are documented above from CI job logs.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T20:45:51.100773Z 47412e3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f333023c40

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] This PR appears safe to merge.

Summary

Moves test and hook deadlines into Vitest project policy, while keeping separate checks for work that must finish quickly.

  • Vitest sets test and hook deadlines from each project's policy.
  • Tests use project deadlines instead of scattered timeout literals.
  • Wide-input tests check speed directly and reuse semantic analysis.

No actionable issues found. Tests were not run during this review.

Reviews (3) · Last reviewed commit: "test: check the deadlines Vitest applies..." · Reviewed by Greptile

kaoru0822-kitauji commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

I closed this session's #10384 as superseded and released the #10381 claim. I verified that #10391 at 0b8c9c78dde6053c2fded476e8e81c473fdc9f72 includes equivalent shared real analysis and retains every 130,000-callable count, uniqueness, coverage and Evidence assertion. No parallel deadline implementation is being added.

Additional full-coverage evidence:

Prepared policy integration refs on session-owned branches, preserving peer heads:

  • Desktop 2864514164fb5334d2aa9ccfc898e3eb882cd8fc: tree differs from your policy only by the desktop readiness fix. Seven exact local files with V8 coverage pass: 42 tests / 13 Linux-specific skips.
  • XML ea44c41d7c79126230ac51c26b3e499e7bd5ffba: tree differs only by the peer's two unchanged XML files. Nine focused local files pass, 112 tests including all three XML CLI controls.

Full npm run check and normal hooks pass on both. Full CI qualification of the exact desktop policy integration is in progress; no complete qualification or separate new XML Linux run is claimed. Both earlier integration Apple lanes pass. The helper base remains pinned to cdc4541ef7; newer main Unicode/schema changes do not overlap. No peer branch was modified, duplicate PR opened, or human review attested. #10381 stays open pending a landed replacement.

Additional readiness blocker on this PR: Apple job 132065617702 is cancelled with annotation “The job has exceeded the maximum execution time of 15m0s.” The six format verifiers occupy about 358 s of wall time, iNES reports 73 passes in 50.60 s, and the native/process phase is interrupted about 439 s after it starts, with no failed assertion shown. Scheduled main's Apple job also hit the same cap; both older isolated integration Apple jobs pass. This is a separate aggregate job-budget/capacity issue, not evidence that project-owned test deadlines are wrong. CPU and family memory were not measured. I have not retried it or changed its job budget; please include this limitation in readiness assessment.

Follow-up: the replacement Apple job 132086129289 also exceeded the maximum 15m0s execution time (annotation verified). The complete-policy integration’s Apple job 132081464360 independently hit the same cap: format verifiers occupied about 388 s, iNES passed all 73 tests, and the native/process phase was interrupted after about 432 s with no assertion failure shown. Its coverage shards remain active; 35 other jobs currently pass. I have not started another retry or a competing Apple-job patch while this PR’s maintenance is active.

kaoru0822-kitauji added a commit that referenced this pull request Nov 13, 2026
Integrate the existing policy from PR #10391 at 0b8c9c7 without changing the peer PR branch. Resolve the overlapping fingerprint fixture to the policy owner's exact version; the resulting tree differs from that policy only by the desktop readiness fix.

Validation: seven exact test files with V8 coverage pass (42 tests, 13 Linux-specific skips); full npm run check passes with zero errors. Linux integration qualification remains to run on this merge.
kaoru0822-kitauji added a commit that referenced this pull request Nov 13, 2026
Integrate the existing policy from PR #10391 at 0b8c9c7 without changing the peer PR branch. Resolve the overlapping fingerprint fixture to the policy owner's exact version; the resulting tree differs from that policy only by the two unchanged XML member-count files.

Validation: 112 focused tests across nine files pass, including all three XML CLI controls and ordinary project deadline probes; full npm run check passes with zero errors. No Linux qualification of this new merge is claimed.
@kaoru0822-kitauji

kaoru0822-kitauji commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Compatibility-merge claim withdrawn: your published 82df66d631c69d88d6a30cf2f72cc44fed6fe446 is byte-for-byte identical to the private resolved tree I tested (git diff --exit-code succeeds). I aborted the unpublished merge and checked out your canonical head; no duplicate commit, branch push or PR was made.

Executed on pinned Node 24.22.1/npm 11.16.0:

  • Existing deadline/config probes: 20 tests in four files pass without coverage, and the same 20 pass with V8 coverage, with GITHUB_ACTIONS=true.
  • Direct configuration probes resolve four hosted-runner workers, two local workers, and serial process-boundary files; project deadline scaling is retained. This is local configuration verification, not a hosted performance measurement.
  • Full npm run check: 7,275 files, zero errors; 4,875 typed advisory warnings.
  • npm run docs:check: passes, including all nine README consistency cases.

The earlier two-worker desktop+policy full run 43481241797 has now ended: all six coverage shards and the merged portable gate pass, 48,888 tests passed / 290 deliberate skips. All 32 Linux desktop-source tests pass. The three previously failing wide cases pass in shard 4: async 56.116 s, direct fingerprints 60.179 s, transferred fingerprints 37.194 s. Its aggregate gate fails solely because Apple exceeded its 15-minute job limit. Those observations apply to pinned 2864514164fb5334d2aa9ccfc898e3eb882cd8fc, not this new hosted-worker policy. Current-head test executions have completed with the ZIP-model source timeout and DMG CLI-process timeout documented in the later comments. The aggregate CI job remains queued; no complete CI success is claimed. The two feature PR heads remain unchanged, pending this owner repair and integration. No human review is attested.

@gensokyo-dev
gensokyo-dev force-pushed the ci/test-ci-optimization-20261113 branch from 0b8c9c7 to 82df66d Compare November 13, 2026 19:08
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

New current-head CI evidence at 82df66d631c69d88d6a30cf2f72cc44fed6fe446: Source tests, job 132107534393 has one failed / 29,352 passed / 21 skipped. The only failure is appTaskDraftModel.test.ts’s zipped-model case beside a JSON array of 2,000,000 numbers: 30.833 s, against the source project’s 30,000 ms deadline.

The test file is byte-identical to main 3403338ea0 (git diff --exit-code verified), and both configurations retain the same source deadline. This is source-derived comparison; I have not established a clean-main runtime reproduction or a product hotspot. The case deliberately stays within the admitted 4 MiB view bound and has no elapsed-time performance assertion. It may need the existing long-running workload classification after the producer-cost assessment, with all counts/assertions retained. I am leaving classification and any patch with this PR’s owner to avoid competing changes.

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Additional current-head Apple failure, separate from the earlier job-level cap: job 132111068584 finishes the native phase in 411.97 s with 416 passed / one failed / five skipped. artifactDmgAttachmentRecoveryCli.test.ts:82 fails its first inspect-artifact child process at the explicit 30,000 ms harness deadline, with empty stdout/stderr and SIGKILL. This is not the Vitest deadline.

I ran the unchanged exact file in isolation on native macOS arm64, Node 24.22.1/npm 11.16.0, with the hosted-runner config flag: one passed, 16.58 s wall, 3.27 s user+system CPU for the timed command, peak sampled process-family RSS 0.907 GB. Sampling sums RSS every 200 ms and can double-count shared pages or miss brief peaks; monitor and external OS-service CPU are unmeasured. The real attachment-preservation and final cleanup assertions pass. No CI-context reproduction or speedup is claimed.

Source observation: NativeDmgArtifactReader.ts gives hdiutil commands a 120,000 ms budget while this test's CLI envelope is fixed at 30,000 ms. That mismatch merits assessment against the caller's operation and cleanup budget; the isolated pass does not identify the CI delay. I left source and deadlines unchanged, retained the failure, and kept this investigation in the existing ownership thread.

gensokyo-dev and others added 5 commits November 13, 2026 20:37
Source projects allow 30 seconds and built projects 120 seconds, both
doubled under coverage, and hooks share their project's deadline instead
of Vitest's 10-second default. A long-running tag covers bounded
workloads that need more.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both projection modes read the same 130,000-callable analysis without
changing it, so analyze the source once.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Explicit deadlines at or below the project deadline only shortened it:
a literal 30-second value also disabled the coverage scaling, which timed
out wide-capacity regressions on main. Workloads above the built
deadline use the long-running tag. Deadlines derived from an operation
budget remain.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Four wide-input regressions used a short per-test deadline as their only
check against a slow but terminating implementation. Assert the same
budgets explicitly so the project deadline only detects hangs. The
composed-body test keeps its exact read count instead.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Probes in a source and a built project read each collected test's
deadline, including test, suite, and module long-running tags, so a
change in project inheritance or tag resolution fails directly. Both
the policy and the probes read one set of base deadlines.

Co-Authored-By: gensokyo-dev <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gensokyo-dev
gensokyo-dev force-pushed the ci/test-ci-optimization-20261113 branch from 82df66d to 47412e3 Compare November 13, 2026 20:42
@gensokyo-dev
gensokyo-dev merged commit 87743d6 into main Nov 13, 2026
52 checks passed
@gensokyo-dev
gensokyo-dev deleted the ci/test-ci-optimization-20261113 branch November 13, 2026 21:27
@morluto morluto added the area: tests Test suite and verification label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants