Skip to content

ci: scale Vitest test and hook timeouts by a fixed factor inside the browser repetition job #4192

Closed

Description

@schlessera

Context

The maintainer ruled on 2026-11-17 (#4191) that a test watchdog is a catch-all for the worst case, and that a run which applies CPU load on purpose multiplies test deadlines by a fixed factor. #4191 implements that for the determinism job, which repeats changed Bun test files: the factor lives in DETERMINISM_PARTITIONS (scripts/proof-shards.ts), the command scales Bun's per-test cap, explicit test and hook timeouts and watchdogMs watchdogs (scripts/test-determinism.ts, scripts/test-deadlines.ts, scripts/test-deadline-preload.ts), and the decision record has the rule and the measured basis (docs/decisions/ci-utility.md, "Test watchdogs are a worst-case catch-all").

The same ruling covers the browser repetition job of #4163, which repeats a pull request's changed Vitest specs under burners inside the pinned container. That job was not on main when #4191 was implemented, so its part was left out. Its command is scripts/browser-determinism.ts, its numbers are BROWSER_DETERMINISM_PARTITIONS in scripts/proof-shards.ts (step limit 20 minutes, measured load ratio 1.8), and its passes run through scripts/browser-determinism-inside.mjs.

Blocked by #4163
Blocked by #4191

Scope

  • One owner holds the browser job's deadline factor, beside its other numbers in BROWSER_DETERMINISM_PARTITIONS, derived from that job's own measured slowdown with margin. It is not the Bun job's factor: the measured ratios differ (1.8 against 6.84).
  • Inside the repetition run, Vitest's testTimeout and hookTimeout are multiplied by it. Check against the pinned Vitest how a per-test timeout option and expect.poll/vi.waitFor timeouts behave, and say which of them scale and which do not.
  • The factor reaches the specs through the environment variable watchdogMs already reads (BRAIN_TEST_DEADLINE_FACTOR), so an in-spec watchdog scales the same way in both jobs. The helper has to be importable from a spec that runs in the browser, or have a browser-side equivalent with the same contract.
  • The job's step limit still bounds the whole job after scaling, and a test asserts that against the owner's numbers.
  • The decision record's "What stays unscaled" list and the testing process doc are updated.

Out of scope

  • Product timings and the specs that assert them. The composer microphone's hold and similar promises are asserted on controlled time and are never scaled.
  • Raising existing spec timeouts in bulk.
  • The number of burners, the repetition count and the partition capacity of the browser job.
  • The Bun job's factor.

Acceptance criteria

  • A fixture spec that takes about half its Vitest timeout unloaded passes under the browser repetition command with the scaling, and fails with the factor set to one. Both receipts are in the PR.
  • A fixture spec that truly hangs still fails under the command, within the scaled timeout.
  • A test asserts that the factor covers the measured load ratio with margin and that one hung spec waiting out its scaled timeout after a full capacity still fits the step limit.
  • The decision record states the factor, the hosted runs it rests on and what stays unscaled in the browser job.
  • The pull request's own hosted browser_determinism job passes with the scaling in effect.

Verification

  • bun run check:pr --base origin/main, with failing-first and mutation receipts.
  • The pull request's own hosted browser_determinism job.

Contract impact

None. CI tooling, test helpers and process documents only.

Activity

  1. added this to the 0.45.0 milestone on Nov 17, 2026
  2. added
    type: choreTooling, CI, release plumbing, dependencies.
    area: ciCI workflows, the gates they run, release scripts, packaging.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 17, 2026
  3. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #4163, #4191 are closed, so scripts/sync-project.ts is removing the blocked label.

  4. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 17, 2026
  5. self-assigned this
    on Nov 17, 2026
  6. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation. Claim token: claim-4e63ec69. Branch: chore/4192-browser-deadline-factor.

    Maintainer-directed issue selection; checking shared CI tooling overlap before implementation.

  7. schlessera commented on Nov 17, 2026

    @schlessera
    OwnerAuthor

    Implemented and merged in PR #4236 as squash 29e3cb0dc89d880143205edab2ae01e4f12c52c7; final PR head c3360d7885ef9ede40bb6f6bec168778b34d13c0. Both issue and PR retain milestone 0.45.0.

    Candidate confirmation 44180834432 passed, including this PR's own browser repetition job. Its log confirms Deadline factor 3, testTimeout=45000 ms, hookTimeout=90000 ms and BRAIN_TEST_DEADLINE_FACTOR=3; both repetitions passed. The earlier reviewed-head run passed all five repetitions. The PR body contains the log, actual checkout/tree and local failing-first/mutation/preflight receipts. Recorded independent review remains clean, with refusal:null after clean merges of main.

    The squash's main run 44184262171 completed failed: all browser partitions, the new five-test witness, fast categories and other heavy categories passed; native runtime_host reached the existing 15-minute proof-step timeout. No failing top-level product assertion was printed before cutoff. Incident #4242 contains the failure and parent-versus-squash command timings; recovery remains open there. The failed job was not rerun or reported as green. The browser scaling acceptance criteria are satisfied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ciCI workflows, the gates they run, release scripts, packaging.type: choreTooling, CI, release plumbing, dependencies.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions