Skip to content

fix(free-ci-health): a split shard's overrun compares wall time with its per-job prediction (#3851) - #4051

Closed
prascli wants to merge 2 commits into
garrytan:mainfrom
prascli:fix/3851-shard-overrun-wall-prediction
Closed

prascli wants to merge 2 commits into
garrytan:mainfrom
prascli:fix/3851-shard-overrun-wall-prediction

Conversation

@prascli

@prascli prascli commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Closes the gap described in #3851.

What changed

--ci-verify's shard-overrun warning compared two different units. plan.shards[].predictedMs is the shard's serial seed sum (the packing load), while outcome.elapsedMs is the shard's wall clock. At --shard-jobs k the k sub-shards run in parallel and mergeSubShardOutcomes records the group's wall time, so a healthy shard finishes in about predictedMs / k. At k=4 the 1.5x factor therefore only fired after roughly a 6x slowdown, and the signal was blind exactly where shard splitting is used.

  • shardOverruns takes an optional jobs and measures elapsedMs against predictedMs / max(1, jobs).
  • ciHealthSummary passes the plan shard's jobs through, so the --ci-verify job summary uses the same wall expectation.
  • overrunWarning names the parallel job count, so the number it prints is the wall time it compared. k=1 output is byte-identical.
  • docs/TESTING_INTERNALS.md states the wall-time rule next to the 1.5x / 30 s thresholds.

No behavior change when a plan has no jobs (k=1), which is the default and every plan written before --shard-jobs.

Verification

bun test test/free-seed-ratchet.test.ts   # 12 pass — two new cases: k=4 warns at 1.6x wall, stays quiet at 1.2x
bun test test/shard-jobs.test.ts test/test-free-shards.test.ts test/free-tests-workflow-wiring.test.ts   # 126 pass
bun run typecheck                          # clean
bun run typecheck:test                     # 812 known diagnostics, none new

The new cases fix the reported failure mode: a 400 s serial seed over 4 parallel jobs that takes 160 s (1.6x its 100 s wall prediction) now warns, where before it needed 600 s.

…its per-job prediction (garrytan#3851)

The shard-overrun warning compared a shard's wall clock (`elapsedMs`) with the
plan's `predictedMs`, which is the shard's serial seed sum. At `--shard-jobs k`
the k sub-shards run in parallel, so a healthy shard finishes in about
`predictedMs / k`: at k=4 the 1.5x factor only fired after roughly a 6x
slowdown, and the signal was blind exactly where shard-splitting is used.

`shardOverruns` now divides the prediction by the shard's k, `ciHealthSummary`
passes the plan shard's `jobs` through, and the warning names the parallel job
count so the number it prints is the wall time it compared. k=1 output is
unchanged. `docs/TESTING_INTERNALS.md` states the wall-time rule.

Tests cover a k=4 shard warning at 1.5x its 100 s wall prediction and staying
quiet at 1.2x, and the `--ci-verify` summary carrying the plan's k.
@trunk-io

trunk-io Bot commented Nov 6, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@prascli

prascli commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Added changelog.d/3851-shard-overrun-wall-prediction.md in 1d46e6f. Under changelog_fragments, a non-bot PR that touches no release file must still carry a fragment, so Version Gate ("Check VERSION is not stale vs queue") would have failed without one.

What I could verify locally, on this branch cherry-picked onto eaf1701 (current main):

  • bun test test/free-seed-ratchet.test.ts -- 12 pass
  • test/shard-jobs.test.ts + test/test-free-shards.test.ts + test/free-tests-workflow-wiring.test.ts -- 126 pass
  • bun run typecheck clean; typecheck:test -- 812 known diagnostics, none new
  • bun run gen:skill-docs --host all leaves the tree clean (Skill Docs Freshness)
  • bin/gstack-prose-lint changelog.d/3851-shard-overrun-wall-prediction.md --gate -- ok; added-lines credential scan -- 0 high, 0 advisory

All eight workflows on 1d46e6f are still action_required (awaiting maintainer approval), so nothing has actually run in CI yet.

capy-ai Bot added a commit that referenced this pull request Nov 6, 2026
…rediction over jobs (GST-1653) (#4085)

shardOverruns compared a shard's wall-clock elapsedMs with predictedMs, the
shard's serial seed sum. free-tests.yml plans every shard at --shard-jobs 4,
so the 1.5x warning only fired after about a 6x slowdown. The prediction is
now divided by the plan shard's jobs, ciHealthSummary carries jobs through,
and the warning names the parallel job count. k=1 output is unchanged.

Rewritten on main from #4051, which fixes #3851.

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

capy-ai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thanks @indraoverflow, good catch: the shard-overrun warning was comparing wall time with a serial prediction, so on 4-job shards it was effectively off. We rebuilt it on current main in #4085, which merged as 115e245 with you credited as co-author. Closing this one as superseded; it also resolves #3851.

@capy-ai capy-ai Bot closed this Nov 6, 2026
@prascli

prascli commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Note for anyone landing here later: I renamed my GitHub account from indraoverflow to prascli (same account, user id 11029197), so the commits in this PR now render as unlinked authors. The addresses they carry, indraoverflow <[email protected]> and Indra Prasetya <[email protected]>, no longer resolve to an account after the rename.

For any future attribution of this work, the correct identity is:

Co-authored-by: Indra Prasetya <[email protected]>

The fix itself landed in #4085.

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