Skip to content

fix(ci): reduce confirmation fixture API startup cost - #4051

Merged
schlessera merged 3 commits into
mainfrom
fix/2930-confirmation-fixture-cost
Nov 16, 2026
Merged

schlessera merged 3 commits into
mainfrom
fix/2930-confirmation-fixture-cost

Conversation

@schlessera

@schlessera schlessera commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #2930

What changed

The confirmation fixture replays stable fake API responses through shell builtins after its existing stateful fake produces them once. Candidate responses are invalidated by PR commands; every virtual clock tick updates the clock response before renewal callbacks. Only the cancellation, cap and valid confirmation modes use this path. Failure-injection modes retain the stateful executable.

Why this shape

The maintainer required attributing and reducing fixture cost under controlled oversubscription, with unchanged deadlines. The dominant cost was repeatedly starting the Bun fake gh handler for the same four responses during cap-mode renewal. Each call still crosses a real executable boundary. All real local Git operations, remote CAS publications, sixty renewal ticks, authority/proof checks, original assertions, offline boundary, 27-second work deadline, 30-second test cap and owned process/output/scenario joins remain.

Proof

Measured source base: e1ce188d79dd47c88a4478359d38277098444a21. Bun 1.4.4 (38afee6c8), the same dependency state (the named fixture imports repository tooling and runtime built-ins) and invocation wrapper/preload on both variants. Observational timing probes were temporary and are absent from this diff: wall time around each fake gh child exit, each real GitReservationStore.git operation and each scenario. No deadlines, clocks, assertions or scheduling ticks were changed for those probes.

Controlled load: test process and all descendants pinned with taskset -c 0,1; 0, 2 or 6 owned shell busy loops pinned to those same two CPUs give 0×, 1× or 3× oversubscription. Each load owner terminated and joined its exact recorded PIDs in finally. Other CPUs remained available. Runs used:

GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=commit.gpgsign GIT_CONFIG_VALUE_0=false \
  taskset -c 0,1 bun run test ./tests/integration-command.test.ts -t 'confirmation executable'

Target: at least 10% margin (2.7 seconds) against the unchanged 27-second work watchdog at 3× oversubscription, i.e. every case at or below 24.3 seconds, for ten consecutive runs. Main: 0/10 pass; repaired: 10/10 pass, maximum 23.062 seconds, minimum margin 3.938 seconds (14.6%). All repaired runs retain all 55 assertions. Each main failure is the explicit work-watchdog refusal, with cleanup joined; no dangling-process or late missing-cwd notice.

Attribution

Representative matched observations, milliseconds; gh is summed awaited fake-executable time, Git is summed real synchronous Git operation time. Mode totals also include setup, process anchoring and final reads/cleanup, so component totals are not expected to sum to the mode total.

Variant / load Cancellation mode (total / gh / Git) Cap mode (total / gh / Git) Valid mode (total / gh / Git)
main 0× 587 / 283 / 82 4215 / 2712 / 1263 805 / 490 / 98
main 1× 1941 / 596 / 280 13006 / 7889 / 4359 2484 / 1448 / 381
main 3× 4169 / 1385 / 537 22890 / 13905 / 7690 not reached
fixed 0× 692 / 245 / 76 1779 / 359 / 1186 773 / 445 / 103
fixed 1× 1540 / 662 / 252 6581 / 1106 / 4383 1920 / 1064 / 273
fixed 3× 3994 / 1293 / 530 12183 / 2286 / 8517 5282 / 2526 / 727

The 3× main cap sample is truncated by the watchdog, so it performs fewer operations than the repaired sample. The original full case never reaches valid mode at 3×; a separate original-source diagnostic selecting only valid mode measured 5520 ms total, 2732 ms awaited fake gh and 613 ms Git; its existing valid-mode assertions passed.

Cap-mode operation timings explain the cost rather than attributing a passing retry. Values below are aggregate milliseconds per operation class, from the same samples:

Operation Main 0× Main 1× Main 3× (truncated) Repaired 3×
candidate API 679 1984 3594 706
main-ref API 643 1916 3402 397
server-clock API 657 1898 3252 381
CI-run API 648 1882 3261 297
push 504 1924 3255 3521
ls-remote 193 621 997 1088
fetch 161 461 948 1034
show 85 290 520 615
ls-tree 72 251 482 553
hash-object 92 247 510 523
mktree 82 265 473 563
commit-tree 74 299 502 616

Ten consecutive 3× runs

Run Main case seconds (all fail) Repaired case seconds (all pass)
1 27.075 21.473
2 27.065 19.291
3 27.174 23.062
4 27.070 22.360
5 27.060 20.022
6 27.082 18.777
7 27.081 18.751
8 27.044 19.890
9 27.114 21.811
10 27.065 21.421

Restored mutation

After ten repaired runs, restored the complete original fixture cost (the original fake-gh executable, without replay) under the same 3× load. The unchanged named confirmation case failed with Integration fixture work deadline exceeded; owned cleanup joined inside the 30-second test cap at 27,063.59 ms, beyond the 24,300 ms target. Restored the repair afterward; timing probes were then removed. This is the expected watchdog failure, not a module-load or setup error.

Local verification

  • Focused uninstrumented bun run test ./tests/integration-command.test.ts: 20 pass, 0 fail, 1,125 assertions, 41.44 s. Test bodies, assertions, watchdog and cleanup hooks were also compared byte-for-byte with main and are unchanged.
  • Complete bun run test ./tests: 2,041 pass, 64 skip, 158 fail, 203 files, exit 1, 454.15 s. The changed confirmation fixture passed. This is not full green proof.
  • Replayed all 28 failed files on then-current origin/main a9bcdbd6734c1733390570e2a68c10afde3b00a9: 68 pass, 2 skip, 156 fail, exit 1. All 156 failure names match the head run. The confirmation fixture is unchanged between the measured main source and this control revision. The remaining two head failures were missing zip for artifact seeding; that tool became available between observations and those cases passed in the control. No source flake/regression claim follows from that environment change.
  • Local limits include denied nested worker/user namespaces, missing Chrome runtime support and incomplete native SDK extraction. A private frozen dependency install installed the JS dependencies but exited 1 with EDQUOT on two native SDK archives. The initial dependency-absent root attempt was stopped before that install; its module-load errors are not behavioral proof. No gate or assertion was weakened.
  • bun run check:pr --base origin/main: passed, including 656 fast-invariant tests across 25 files, 0 failures. Its exact printed receipt is below. The PR head is b17b174bd91af671a3d7e7905a12802285b0dc6c; the branch's merge base is the measured main revision above. The later main change concerns Claude title context, with no confirmation-fixture change.
  • Hosted draft feedback passed: run 43761505985, admitted head b17b174bd91af671a3d7e7905a12802285b0dc6c, planned base a9bcdbd6734c1733390570e2a68c10afde3b00a9. Verified the actual head checkout and aggregate: verify and all four selected unit shards succeeded, covering 656 tests across 25 files. On pinned Bun 1.4.2, unit shard 1 ran the complete tests/integration-command.test.ts: 20 pass, 0 fail, 1,125 assertions; the named confirmation case passed in 5,219.10 ms. Pack/runtime/runtime_host/browser/layout/captures/endurance were planner-unselected and intentionally skipped. This covers the requested selected fixture verification; it does not reclassify the separate environment-limited full local root run as green. Draft feedback remains diagnostic, not candidate confirmation.
{"version":1,"kind":"brain-check-pr-receipt","head":"b17b174bd91af671a3d7e7905a12802285b0dc6c","base":"origin/main","mode":"focused","startedAt":"2026-11-15T20:59:48.571Z","finishedAt":"2026-11-15T21:02:03.220Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":20802.145070000002},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":157.8844140000001},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":125.68123600000399},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":17.139818000003288},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":113519.774584}]}

Checklist

  • Exact-head draft feedback inspected: verify and all selected unit shards passed; coverage and intentional skips recorded above.
  • Candidate confirmation: the orchestrator requests it before landing.
  • Local preflight and behavioral/mutation receipts recorded; acceptance criteria covered above.
  • PR and issue milestone 0.45.0 read back.
  • Test fixture only: no consumer changeset, machine contract, product documentation, fail-closed authority guard or provider history change.
  • Existing assertions and deadlines unchanged; leakage gate passed.

Anything left open

Ready for the orchestrator's candidate confirmation and landing. The existing exact-head local receipt remains unchanged; main advances inspected since its run do not change the fixture or files under scripts/. PR and issue milestones were read back as 0.45.0; the claim is retained. bun scripts/collisions.ts --json --pr 4051 refreshed for head b17b174bd91af671a3d7e7905a12802285b0dc6c: 14 closure overlaps on tests/integration-command.test.ts (typecheck/unit) with #3056, #3059, #3622, #4002, #4018, #4028, #4038, #4041, #4046, #4050, #4057, #4060, #4064, #4065. No direct path or unknown collisions.

@schlessera
schlessera marked this pull request as ready for review November 16, 2026 15:15
@schlessera
schlessera merged commit 5c9869c into main Nov 16, 2026
24 of 25 checks passed
@github-actions

Copy link
Copy Markdown

This PR's squash 5c9869caad2fd5fabf1ee8e5dd892344b1fa0dbc landed on main while main was red at 05bf0d6a02fb12fd1ead402b8a7638031ddcbeec (incident #4098) without being a declared fix. Merge blocking while red is cooperative; this report is the detection.

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: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: confirmation fixture still reaches its work watchdog on main

1 participant