Skip to content

chore(ci): scale browser repetition watchdog deadlines - #4236

Merged
schlessera merged 4 commits into
mainfrom
chore/4192-browser-deadline-factor
Nov 17, 2026
Merged

schlessera merged 4 commits into
mainfrom
chore/4192-browser-deadline-factor

Conversation

@schlessera

@schlessera schlessera commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #4192

What changed

The browser repetition command multiplies each resolved Vitest project's default test and hook watchdogs by 3, owned by BROWSER_DETERMINISM_PARTITIONS.deadlineFactor. Browser specs receive BRAIN_TEST_DEADLINE_FACTOR through test.env, and watchdogMs reads it in both browsers and Bun. The command, JSON report and job summary name the factor; --deadline-factor 1 provides an unscaled diagnostic run.

Why this shape

This implements the maintainer's 2026-11-17 watchdog ruling. Three is the smallest integer at least 15% above the browser job's measured slowdown of 1.8; the Bun job keeps its factor of eight. Verified against installed, lockfile-pinned Vitest 4.1.11: browser defaults are 15 s for tests and 30 s for hooks, becoming 45 s and 90 s. Explicit test/suite timeout options, explicit hook arguments, expect.poll and vi.waitFor limits remain independent; watchdogs in those can opt in with watchdogMs. Product assertions on controlled time never scale.

The unchanged 20-minute step accommodates full capacity at the measured ratio, the larger scaled default hang, and measured setup: 300 * 1.8 + 30 * 3 + 135 = 765 < 1200 seconds. Several hangs or exceptionally long explicit caps remain bounded by the step itself.

The real hosted selection requires a changed spec in an existing browser project. The small witness is in packages/ui-kit/tests/visual/deadline-scaling.visual.tsx; expanding the selector and Vitest project inventory solely to avoid that path would broaden this change. This PR therefore requires independent review. The negative fixtures live separately under tests/fixtures/browser-deadlines/ and are never included by ordinary browser projects.

Proof

  • Failing first: the owner's numbers test failed on the original tree because deadlineFactor: 3 was missing.
  • Mutation: replacing project.config.testTimeout *= factor with *= 1 made resolved Vitest projects scale their own default caps and expose the factor to browser watchdogs fail on PROJECT_DEFAULTS_AND_BROWSER_ENV_SCALE (15,000 instead of 45,000 and 1,700 instead of 5,100). Restored the source; all 51 focused tests passed, including the real pinned-container tests.
  • Chromium witness: five repetitions passed, five cases each. It checks the actual collected default cap, browser-side helper, unchanged explicit test option, independent explicit polling/waitFor limits, and the 600 ms product assertion on a controlled clock. Its earlier failure (expected 45000 to be 15000) caught an invalid browser environment read before the helper was corrected.
  • bun run build and bun run typecheck passed (Node heap set to 8 GiB for the latter).
  • bun run check:pr --base origin/main: receipt below. An initial planning attempt encountered rootless-container cache permissions; after restoring ownership, actual Vitest discovery completed and preflight was run again.

Fixed-work and hang receipts use Bun 1.4.2, real Node 24, the pinned offline Playwright container, and CPU 15. The diagnostic loaded comparison intentionally uses three burners on that one CPU, a stronger load than the job's one per CPU; both compared runs use the identical fixture and load.

fixture=harbour::tests/fixtures/browser-deadlines/deadline-work.repeat.js
bun scripts/browser-determinism.ts "$fixture" --config-root tests/fixtures/browser-deadlines --cpu-list 15 --repetitions 2 --burners 0 --deadline-factor 1
# exit 0: 618 ms and 612 ms of work against the written 1,000 ms timeout
bun scripts/browser-determinism.ts "$fixture" --config-root tests/fixtures/browser-deadlines --cpu-list 15 --repetitions 2 --burners 3 --deadline-factor 1
# exit 1, first repetition: 2,451 ms of CPU work; Test timed out in 1000ms
bun scripts/browser-determinism.ts "$fixture" --config-root tests/fixtures/browser-deadlines --cpu-list 15 --repetitions 2 --burners 3
# exit 0: both repetitions passed, 2,470 ms and 2,464 ms; scaled timeout 3,000 ms
bun scripts/browser-determinism.ts harbour::tests/fixtures/browser-deadlines/deadline-hang.repeat.js --config-root tests/fixtures/browser-deadlines --cpu-list 15 --repetitions 2 --burners 1
# exit 1, first repetition: Test timed out in 3000ms; no second repetition

The automated container proof also runs a default hook past its written 700 ms cap under its scaled 2,100 ms cap, and verifies that an explicit 80 ms hook timeout still fails at 80 ms. Callers assert child exit codes and inspect the actual runner result.

Hosted acceptance passed in this PR's own CI run 44164773198, attempt 1, reviewed head dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba. Job 134328341117, browser_determinism (1) completed successfully. Its actual log at 20:05:39 UTC says:

Deadline factor 3: visual (chromium); testTimeout=45000 ms, hookTimeout=90000 ms; BRAIN_TEST_DEADLINE_FACTOR=3.

All five repetitions of the changed deadline-scaling.visual.tsx passed. The Bun determinism (1) job (134328341432) also passed: both changed harness files ran five times under load; the complete run and draft gates succeeded. This meets the hosted scaling acceptance criterion.

{"version":1,"kind":"brain-check-pr-receipt","head":"c3360d7885ef9ede40bb6f6bec168778b34d13c0","base":"origin/main","mode":"focused","startedAt":"2026-11-17T21:12:44.136Z","finishedAt":"2026-11-17T21:14:33.614Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14218.354619999998},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":171.7494080000033},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":156.69370200000048},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":24.24157600000035},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":94889.148712}]}

Off-main qualification

PR-hosted replay: https://github.com/schlessera/brain-kit/actions/runs/44164773198, attempt 1, head dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba (completed successfully). Its own browser_determinism (1) selects the new visual witness and repeats it with scaling; its determinism (1) repeats the changed harness tests. The successful browser factor log is recorded above; this is completed qualification. The local factor-one/factor-three comparison above supplies the unscaled control. This is the same PR-hosted repetition qualification used by #4193.

The original successful PR run's synthetic merge is 8b187a9963feeb988b4de1378e02fbad2973aaeb, with base d226c76700e837f22c5b79d207f0c2d1fbe20ef2. Main advanced by #4231 after the local checkout was prepared; it changes close-request behavior and its pointer spec, with no overlapping paths. Both repetition jobs actually checked out 8b187a9963feeb988b4de1378e02fbad2973aaeb, whose immutable parents are d226c76700e837f22c5b79d207f0c2d1fbe20ef2 and dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba, tree 52b17120214591c6b075e0808b3ae6daed1994af. GitHub commit metadata and the fetched Git object agree.

At head dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba, collisions.ts --json --pr 4236 reports closure collisions with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4179, #4196, #4198, #4199, #4232, #4233, #4234, #4235. There are no path or unknown collision reports. The closure with #4179 includes the shared CI decision record.

Guard containment

A missing or malformed factor refuses only that repetition invocation before burners start. The diagnostic identifies the invalid factor in stderr/CI logs; there is no durable global latch. A corrected plan works on the next invocation without manual recovery. Unknown/partial runner results remain failed proof. The existing job step remains the outer hang bound.

Checklist

  • Complete selected pre-merge hosted proof passed; exact candidate checkout/run evidence recorded below. Post-merge main failed in runtime_host as recorded below.
  • Clean independent review recorded at dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba; no findings, refusal null. The subsequent clean merge of main preserves its coverage.
  • Issue and PR target release milestone 0.45.0 (read back before landing).
  • CI tooling, helpers, fixtures and process docs only; no consumer changeset or integration-contract change.
  • Public text and tree pass the leakage gate; no provider-facing history changes.

Anything left open

Landing is complete. The independent review remains clean and recorded. Optional draft heavy feedback was not required by the hybrid policy. The required PR-hosted browser repetition acceptance passed, and ordinary browser proof passed on the squash. The squash main run failed in runtime_host; the separate recovery is tracked in #4242 with the exact failure and parent timing comparison. This PR does not claim a green main run.

Refresh after review: 5f241dfa248d9a4ee6d867f1749e5b12b993902b is a clean two-parent merge of reviewed head dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba and main 743f1547503e9ed5078ca7a533691aade0676618, tree 730592aa9834fa07c982765212963d13abd03661. The tree exactly matches git merge-tree --write-tree; no conflicts or additional edits were made. The scaled-default function, owner declaration and decision section each occur once. The newer main work is #4231 and #4233, with no overlapping paths in this PR. proof-system.ts classify --base dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba --head 5f241dfa248d9a4ee6d867f1749e5b12b993902b reports no intervening proof-system change, so the successful qualification above remains applicable.

Pre-confirmation collision check at refreshed head 5f241dfa248d9a4ee6d867f1749e5b12b993902b: closure reports with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4179, #4196, #4198, #4199, #4234, #4235. No new source changes follow the recorded review.

Refreshed-head hosted scaling acceptance: run 44166808889, attempt 1, head 5f241dfa248d9a4ee6d867f1749e5b12b993902b; browser_determinism (1), job 134337045730 succeeded. Its log again shows Deadline factor 3: visual (chromium); testTimeout=45000 ms, hookTimeout=90000 ms; BRAIN_TEST_DEADLINE_FACTOR=3. All five repetitions passed. Its actual checkout is 5cb86f652198e59e3d35eb42526be1b7e2ecd368, parents 743f1547503e9ed5078ca7a533691aade0676618 and 5f241dfa248d9a4ee6d867f1749e5b12b993902b, tree 730592aa9834fa07c982765212963d13abd03661, verified against immutable GitHub commit metadata and the fetched Git object.

Second clean refresh after reservation holder #4179 landed: head 8567252f4e2410f808926a8fe199d26751e4af12 merges previous head 5f241dfa248d9a4ee6d867f1749e5b12b993902b with main d84fca3e08dfa7c5b65973f931ab08d740537d02, tree f3bfdab3ccd48037eb8bdcdaeb2d600ed7c811c4. Again the tree exactly matches git merge-tree --write-tree, with no conflicts or added edits, and each changed owner/function/decision block occurs once. Classification from the reviewed head through this head remains “not a proof-system change”; the successful ancestor qualification and independent review remain valid. The fresh preflight receipt above passed all 1,230 affected fast invariants.

Latest-head draft proof: CI run 44172935365, attempt 1, head 8567252f4e2410f808926a8fe199d26751e4af12, completed successfully, including both repetition jobs and draft gates. Browser job 134357213207 logs factor 3, testTimeout=45000 ms, hookTimeout=90000 ms, and BRAIN_TEST_DEADLINE_FACTOR=3; all five repetitions passed. This is additional hosted scaling evidence on the latest cleanly refreshed head.

Third clean refresh after #4196 landed: c3360d7885ef9ede40bb6f6bec168778b34d13c0 merges previous head 8567252f4e2410f808926a8fe199d26751e4af12 with main ade18f34fbfeb03f49a993268966974fd361cc69, tree 950819c9292888d58c227f76c408fe0924638e8f. The computed merge tree matches exactly, without conflicts or extra edits; the changed owner/function/decision blocks each occur once. Classification from the reviewed head still reports no intervening proof-system change. Fresh preflight passed all 1,230 invariants. The new main work adds per-review line-comment counts and does not modify this PR's scaling implementation.

Landing and post-merge receipt

Merged through bun scripts/integrate.ts confirm 4236 --issues schlessera/brain-kit#4192: exit 2, parsed JSON merged:true. Final PR head is c3360d7885ef9ede40bb6f6bec168778b34d13c0. Only clean two-parent merges followed the reviewed implementation head; review-receipt.ts check 4236 still reports zero findings and refusal:null.

Candidate run 44180834432, attempt 1, passed all selected jobs, including verify, pack, eight unit partitions and both repetition jobs. Its actual candidate checkout was 5562793d637df20c8974d4ce00bb47ee50590119, with parents ade18f34fbfeb03f49a993268966974fd361cc69 and c3360d7885ef9ede40bb6f6bec168778b34d13c0, tree 950819c9292888d58c227f76c408fe0924638e8f.

On this final head, browser_determinism job 134385074579 passed both selected repetitions of the changed witness. Its log at 21:36:08 UTC reads:

Deadline factor 3: visual (chromium); testTimeout=45000 ms, hookTimeout=90000 ms; BRAIN_TEST_DEADLINE_FACTOR=3.

The landed squash is 29e3cb0dc89d880143205edab2ae01e4f12c52c7, parent ade18f34fbfeb03f49a993268966974fd361cc69, tree 950819c9292888d58c227f76c408fe0924638e8f: exact equality with the proved candidate tree. It is an ancestor of remote main. The integration reservation was released. Issue #4192 is closed; both the issue and PR retain milestone 0.45.0, read back after closure.

The squash's automatic main run 44184262171, attempt 1, is completed, failed. Verify, pack, all four unit partitions, all three browser partitions, both layout partitions, captures, endurance and runtime passed. Browser jobs checked out the actual squash. Browser (1), job 134397037996 ran the new witness at the ordinary factor of one: all five tests passed in 793 ms.

Runtime_host job 134397038181 reached the existing 15-minute proof-step timeout during native reference pool allocation. The two preceding commands exited zero after 548606 ms and 290398 ms; no failing top-level product assertion was printed before cutoff. The aggregate consequently failed. The two repetition jobs are intentionally skipped on main. This failed run was not rerun or represented as green. Canonical incident #4242 records the failure and parent comparison; its post-merge-only category does not invalidate the passing candidate confirmation or browser scaling acceptance.

@schlessera schlessera added this to the 0.45.0 milestone Nov 17, 2026
@schlessera schlessera added type: chore Tooling, CI, release plumbing, dependencies. area: ci CI workflows, the gates they run, release scripts, packaging. labels Nov 17, 2026
@uploads-sh

uploads-sh Bot commented Nov 17, 2026

Copy link
Copy Markdown

No uploads on this PR yet

This PR changes UI files (packages/ui-kit/tests/visual/deadline-scaling.visual.tsx). Screenshots help reviewers see what changed.

  • From the CLI: uploads put before.png after.png --pr 4236
  • From an agent: ask it to attach screenshots with uploads.sh
  • By hand: drag images into the PR description and they're imported automatically
Tips for agents

Label each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one put per shot:

uploads put after.png --pr 4236 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4236 --app ios --screen "Chat" --state after

No CLI? With the Uploads MCP, call sign_upload_url for files on disk (or put) with repo, pr: 4236 and the same screen, state and caption fields.

This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with uploads list --pr 4236. More in the github-screenshots skill or the agent docs.

Workspace admins can turn this comment off in Settings → GitHub · docs

@schlessera

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head dd94a2c against base d226c76. Reviewer: agent. No findings.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4236,
  "head": "dd94a2c2c5d7e059c7c51a0b1ce0347cd4ead6ba",
  "base": "d226c76700e837f22c5b79d207f0c2d1fbe20ef2",
  "reviewer": "agent",
  "outcome": "no-findings",
  "findings": []
}

@schlessera

Copy link
Copy Markdown
Owner Author

Pre-confirmation collision check at head 8567252f4e2410f808926a8fe199d26751e4af12: closure collisions with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4196, #4198, #4199, #4234, #4235, #4237, #4238. The independent review remains valid after clean merges of main; no findings or unreviewed source edits. Both the PR and #4192 retain milestone 0.45.0.

@schlessera

Copy link
Copy Markdown
Owner Author

Pre-confirmation collision check at c3360d7885ef9ede40bb6f6bec168778b34d13c0: closure collisions with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4198, #4199, #4234, #4235, #4237, #4238, #4240. Independent review remains valid after clean main merges; the new preflight receipt passed all 1,230 invariants.

@schlessera

Copy link
Copy Markdown
Owner Author

Out-of-scope finding recorded as #4241: the reservation holder's unit partition failed browser-file discovery before tests ran, and that caller discards the child diagnostics. The receipt does not identify a timeout or product-test failure. No failed job was rerun and no source change was added here. This PR's latest-head draft run 44178043328 is successful; confirmation continues waiting for the shared reservation.

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

Labels

area: ci CI workflows, the gates they run, release scripts, packaging. type: chore Tooling, CI, release plumbing, dependencies.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant