Skip to content

v1.92.60.0 test-free-shards: --ci-run --jobs k sub-shards inside one CI job (k=1 default) (GSTA-203 PR 2) - #3730

Merged
capy-ai[bot] merged 8 commits into
mainfrom
gsta203-pr2-subshards
Nov 2, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
gsta203-pr2-subshards

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3730,
  "head": "f058f179fbf8c83033c3dd3856d58e0a9158e3b9",
  "version": "1.92.51.0",
  "base": "main",
  "spend_usd": 0.32,
  "session_kind": "unattended",
  "queue_mode": "stamp-at-merge",
  "head_tree": "5eb596dc33ff4524026694e9059fed23597d605a",
  "product_patch_id": "d343695cdce2c5eb51c59802a314ffbf59a1d3a3",
  "gstack_version": "1.92.51.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 488,
    "rules": "97c1e5fe49607f73",
    "base": "a563f476793b61edbb064b853d52cb125a1996c4",
    "registry": "a563f476793b61edbb064b853d52cb125a1996c4",
    "gate_scan": {
      "tagged": 0,
      "head": "f058f179fbf8c83033c3dd3856d58e0a9158e3b9"
    },
    "reasons": [
      "runtime=488"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @5eb596dc33ff (1 checks, current for f058f179fbf8)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41375537272/job/125054833962",
    "pregate.json/remote_gate: remote-gate tree=5eb596dc33ff tests=3630"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, CONTRIBUTING.md and changelog.d for the --ci-run --jobs sub-shard runner; re-audited current after the a563f47 base merge"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 4,
    "fixed": 0,
    "scope": "frozen",
    "fix_checks": 3,
    "rounds": 4
  }
}

What changed

Before and after: CI today at p50 196 s is unchanged because k=1 stays the default; shard 1 of 21 on standard-8 took 245.6 s and 256.0 s at k=1 and 100.8 s and 102.5 s at k=4 with identical counts

bun run scripts/test-free-shards.ts --ci-run <plan> --shard N --jobs k can now split one planned CI shard into k sub-shards inside the same job. The default is k=1, and no workflow passes --jobs yet, so CI runs exactly as before. PR 3 of GSTA-203 picks k per shard and per runner.

Before After (this PR, measured)
CI today (Free Tests free-suite job, ubicloud-standard-2, runs 41162917030..41218474772, n=609 jobs, main 0cd2b4a audit) running p50 196 s, p90 258 s; job p50 259 s; 21 jobs per run ≈ 91 job-minutes ≈ $0.18 per run at $0.002/min unchanged: k=1 is the default and no workflow changes
One planned shard (shard 1 of 21, 72 files) on one ubicloud-standard-8 VM, commit 4e96f92, Bun 1.4.2, two alternating rounds k=1: 245.6 s and 256.0 s wall (≈ $0.034 per shard at $0.008/min) k=4: 100.8 s and 102.5 s wall (≈ $0.014 per shard), 2.4x faster

All four proof runs passed with the same counts: 1,329 tests (1,326 pass, 3 skip), 8,874 expect() calls, 72 counted files, zero per-file count differences between k=1 and k=4, and no retry. The k=4 split was one serial sub-shard of 3 files plus three parallel sub-shards of 23 files each. The proof VM (ubirun-gsta203-1793470196-3d9d0880-t2) cost about $0.11 and was destroyed afterward. Those VM numbers come from a test command on a VM, not a GitHub job, so they leave out the job's waiting and setup time.

Why

GSTA-203 is the plan to make CI much faster. The audit showed that free-suite jobs spend most of their time running tests one file after another on a machine with idle cores. Running several sub-shards at once inside one job uses those cores without adding jobs, waiting time or setup time. This PR builds the runner and its safety rails; PR 3 turns it on.

Blast radius

  • New module scripts/lib/shard-jobs.ts (with a module-size ratchet entry), wired into scripts/test-free-shards.ts only for --ci-run. scripts/lib/shard-engine.ts and every workflow file are unchanged.
  • Every CI shard's child now also writes a Bun JUnit report, which is read for per-file test and expect() counts. The console stream is byte-identical with or without it (checked on Bun 1.4.2 and 1.4.4 on Linux; Windows is covered by this PR's windows-smoke check and by windows-free-tests at 84f93c9, run 41233367723).
  • Test copy lists (test/test-free-shards.test.ts, test/ubicloud-pregate-remote.test.ts), the ship-measure touchfiles entry, scripts/test-pr-profile.ts (free-only path) and scripts/harness-version.json (non-behavioral note) each gain the new file.

Behavior changes

  • k=1 behaves as before. The result JSON gains two additive fields: outcome.counts (per-file tests, pass, fail, skip, todo and expects from JUnit) and outcome.inFlight on a timeout.
  • --jobs is accepted only with --ci-run. A bad value, or k larger than the shard's file count, fails with FREE_JOBS_INVALID. So PR 3 must pass k per shard, and the exclusive host-state shard stays at k=1.
  • At k>1, serial-only files run alone after the parallel sub-shards, inside what is left of the same wall. A sub-shard that hits its wall prints FREE_SUBSHARD_TIMEOUT with the file, k, runner, run id and a serial reproduce command. Sub-shard records that fail validation print FREE_SUBSHARD_REJECTED, and --ci-verify fails closed on missing or altered sub-shard records.
  • The JUnit counts made the preregistered fallback (parsing the console stream) unnecessary. SLOW_UNDER_LOAD starts empty.
  • Windows --jobs adoption belongs to PR 3.

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-31 Approve the GSTA-203 plan v2 (20x-faster CI) with build conditions H1-H3, autoplan run autoplan-20261031171417 gate_rev 2 “Do it” (Garry (via GStack Minder)) approved PR 2 of the plan: --ci-run --jobs k sub-shards inside one CI job, k=1 default, build condition H2 in full; Ubicloud proof within the $10 lane cap none
2026-10-15 Lane spend for focused runs “it's fine run as many $93 paid gates as you want who cares” (Garry (CREW rule 5)) standing approval standing; this PR spent Ubicloud only, under the $10 lane cap none

Source: gstack-approvals record for gsta203-pr2-subshards (display only; not an approval citation).

Pre-Landing Review

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=4 fixed=0 scope=frozen fix_checks=3

Gate edits: three untagged test copy-list hunks (test/helpers/touchfiles-data.ts, test/test-free-shards.test.ts, test/ubicloud-pregate-remote.test.ts), each adding scripts/lib/shard-jobs.ts to an existing list. No gate was loosened.

Reviewers: specialists, red team and native adversarial passes on anthropic/claude-opus-5-5; outside voice on openai/gpt-6.1-sol. The review loop stopped at its fix-cycle cap, and the lane's parent ruled under crew rule 23 that none of the items below reaches the blocking floor (fail a test, break production, or lose data or secrets). They ship as informational notes, unfixed. Item 4 came in with commit 8ab672c, the last fix commit in this PR.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  1. INFORMATIONAL scripts/lib/shard-jobs.ts:114 A ../-prefixed JUnit path whose stripped remainder is a planned file is credited without the root check (exact-match early return). Pinned on purpose by test/shard-jobs.test.ts:303, which stays as it is. Counts are evidence only.
  2. INFORMATIONAL scripts/lib/shard-jobs.ts:111 The root check ignores how many ../ segments a printed path has, so a same-named directory outside the root could be credited. Unreachable with the child's cwd at the repo root; counts are evidence only.
  3. INFORMATIONAL scripts/lib/shard-jobs.ts:111 Absolute JUnit paths are compared as exact strings, so a drive-letter case difference, ./ or a trailing slash on the root marks that file's counts incomplete. Bun prints relative paths with cwd at the repo root.
  4. INFORMATIONAL scripts/lib/shard-jobs.ts:332 Introduced by 8ab672c: the strict wallTimeoutMs < shardWallMs comparison gives nearly every real serial timeout the 'lower --jobs' advice, including all-serial shards and a slow serial file after a fast parallel phase. Message text only.

Base merge

main at a563f47 (v1.92.51.0, #3806) was merged in once under GStack Minder's rule 19 grant, as merge commit f058f17 with no rebase, because #3771 is stacked on this branch. The one conflict was the scripts/test-pr-profile.ts entry in scripts/harness-version.json: both FREE_ONLY_PR_FILES additions are kept, and the entry is re-pinned to the merged blob with one non-behavioral note. One scoped fix-check on that resolution found nothing.

Documentation

Scope: re-audit after merging origin/main a563f47 (GSTA-203 PR 1). Reviewed docs/TESTING_INTERNALS.md (real-home tripwire bullets, Sub-shards inside one CI job, Windows free lane), CONTRIBUTING.md and the changelog fragment against main's windows-smoke/windows-free-tests text.

Result: current, no edits. The default k = 1 keeps every workflow unchanged, including the nightly windows-free-tests serial --ci-run, and windows-smoke stays the required Windows PR check.

Debt: when a workflow first adopts --jobs, the docs should name it.

Earlier audit (docs-203-1, before the base merge):

Status: updated: one factual correction in docs/TESTING_INTERNALS.md, no blockers.

Scope: base 5ba425a to head f7eb79f on gsta203-pr2-subshards: 4 commits, 11 committed files, nothing staged, unstaged or untracked. I read the new --ci-run --jobs k sub-shard runner (scripts/lib/shard-jobs.ts, scripts/test-free-shards.ts), the changelog fragment, and every authored doc that mentions the free runner, --ci-run or GSTACK_FREE_JOBS. The banned-terms check found no list.

Documentation health:

  • docs/TESTING_INTERNALS.md: Updated. I checked the new "Sub-shards inside one CI job" section against the code (flag limits, sub-shard ids, serial trailing sub-shard, wall budget, merge before the 5-file retry cap, --ci-verify records, JUnit counts), and it is accurate. The "Real-home tripwire" bullets now say that parallel sub-shards at --jobs k > 1 share one HOME under the phase guard, while a --jobs 1 CI shard and the trailing serial sub-shard each own their window.
  • changelog.d/gsta203-pr2-subshards.md: Current. Read only.
  • CONTRIBUTING.md, CLAUDE.md, AGENTS.md, docs/TEST_PORTFOLIO.md, docs/PROJECT_STRUCTURE.md, docs/troubleshooting.md: Current.

Coverage debt:

  • --ci-run --jobs k: reference and explanation in TESTING_INTERNALS; no how-to row in CONTRIBUTING's command table (no workflow passes --jobs yet).
  • FREE_JOBS_INVALID / FREE_SUBSHARD_TIMEOUT / FREE_SUBSHARD_REJECTED: reference in TESTING_INTERNALS only; no troubleshooting.md entries.
  • scripts/lib/shard-jobs.ts: not in docs/PROJECT_STRUCTURE.md's tree, which already leaves out other free-runner lib modules.

Diagram drift: none. No diagrams name the free runner's modules.

garrytan and others added 4 commits October 31, 2026 18:09
… default), per-file JUnit counts (GSTA-203 PR 2)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ister shard-jobs.ts in ship-measure touchfiles

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…icter --ci-verify records, unique count paths, no serial launch without wall

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s FREE_ONLY entry is non-behavioral

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits October 31, 2026 19:11
…text names the wall the parallel phase left

Adversarial pass 2 (GSTA-203 PR 2): a plain relative path now matches a planned
file exactly, and an absolute or ../-prefixed path matches only when its prefix is
the child's root, so an unplanned browse/test/x.test.ts is never credited to
test/x.test.ts. The serial sub-shard's FREE_SUBSHARD_TIMEOUT text says how much of
the shard wall the parallel phase left it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ds (docs audit docs-203-1)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	scripts/harness-version.json
@github-actions github-actions Bot changed the title test-free-shards: --ci-run --jobs k sub-shards inside one CI job (k=1 default) (GSTA-203 PR 2) v1.92.60.0 test-free-shards: --ci-run --jobs k sub-shards inside one CI job (k=1 default) (GSTA-203 PR 2) Nov 2, 2026
@capy-ai
capy-ai Bot merged commit 68195c3 into main Nov 2, 2026
83 of 85 checks passed
@capy-ai

capy-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Flaky: free-suite (6) failed on attempt 1 from a Bun runtime segfault (panic: Segmentation fault in a pty worker and in bin/gstack-pregate), which cascaded into 9 test failures. Rerunning only that shard at the same head (c67821d) passed. Logged in the crew flaky ledger.

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