Skip to content

test(machine-profile): split the contract test in two to shorten the integration lane - #4552

Merged
devswha merged 2 commits into
mainfrom
test/b6-split-machine-profile
Nov 24, 2026
Merged

devswha merged 2 commits into
mainfrom
test/b6-split-machine-profile

Conversation

@devswha

@devswha devswha commented Nov 23, 2026

Copy link
Copy Markdown
Owner

What

Test bundle B6 of the test-suite plan (T8): server/machine-profile.contract.test.ts (105 tests, ~172 s in CI) alone decided when the integration lane ended. It is split, move-only, into two files of about equal runtime:

  • server/machine-profile-lifecycle.contract.test.ts (42 tests): start and refusal rules, state-folder ownership, folder and socket safety, an ordinary server beside a profile.
  • server/machine-profile-api.contract.test.ts (63 tests; git sees it as the rename): herdr socket selection, /api/session and /api/machines, who can reach the profile, how failed herdr calls are worded.
  • server/machine-profile.test-helpers.ts: the setup both halves use, moved unchanged with export added (like server/websocket.test-helpers.ts). Helpers only one half uses stay in that half.
  • scripts/ci-test-timings.json: the old entry (152) becomes machine-profile-api 77 and machine-profile-lifecycle 67, by the measured ratio. scripts/ci-tests.ts already routes every *.contract.test.ts to the integration suite.
  • server/conventions.test.ts: the "start the server only through entryCommand" rule skips *.test-helpers.ts as it already skips *.test.ts. Moving launch() into the shared helper tripped it; a test helper runs from a checkout and is never compiled into the binary, which is what the rule protects.

No production code changes.

Evidence

Same tests, same results. The original file on the unchanged base (origin/main 1d71a71) through bun run check run (its own herdr session), against both new files run at the same time, each on its own session:

pass skip fail tests
original file 100 1 4 105
both new files 100 1 4 105

The (result, test name) pairs match exactly. The skip is the Windows-only test. The 4 failures fail identically on the base and only on this PC: herdr session discovery skips sockets under the required TMPDIR in ~/.cache (throwawayPath); they pass in CI (main run 45279571403 had 0 failures).

Time (local, loaded P620)

Run Seconds
original file alone 188.4
lifecycle half 83.4
api half 96.0
both halves at once 96.1

Integration lane. Replaying main run 45279571403's per-file times through the runner's longest-first queue (8 shards): before 171.7 s (the real run ended at 172.0 s, with the old file alone keeping shard 1 busy for 171.7 s while the other shards ended about 161.6 s); after about 162.0 s. The floor is now the total work over 8 shards (161.8 s); the next longest file is server/pending-input.contract.test.ts at 154.1 s, so no single file decides the lane's end any more. This PR's own Integration job gives the measured after-time.

Move-only. git diff --color-moved=zebra origin/main...HEAD marks 535 of 572 added and 535 of 553 removed lines as moved; the rest are imports, export keywords, one copied afterEach cleanup line, a comment on where the Windows test lives, the two timings entries and the conventions filter. No test body changed.

Validation

…integration lane

server/machine-profile.contract.test.ts ran alone on one integration shard for
~172 s while the other seven ended at ~162 s. Its cases move unchanged into
machine-profile-lifecycle.contract.test.ts (42) and
machine-profile-api.contract.test.ts (63); the setup both use moves into
machine-profile.test-helpers.ts.

The timings table names the two halves, and the entryCommand convention skips
*.test-helpers.ts as it skips *.test.ts: a test helper runs from a checkout,
never in the compiled binary.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e12967f and a1e3fca.

Files selected for processing: 5

  • scripts/ci-test-timings.json
  • server/conventions.test.ts
  • server/machine-profile-api.contract.test.ts
  • server/machine-profile-lifecycle.contract.test.ts
  • server/machine-profile.test-helpers.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devswha
devswha merged commit 1e20091 into main Nov 24, 2026
22 checks passed
@devswha

devswha commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head a1e3fca9e. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

Test-only move (split of server/machine-profile.contract.test.ts). CodeRabbit hit its review limit on this head; reviews that ran: a gate review by omo-native-gate-reviewer (APPROVE, re-checked move-only, cleanup per file and the conventions exemption) at a1e3fca's parent, per the test-bundles-b3-b6 lane brief (owner OK 2026-11-24). Head adds only a merge of origin/main.

@devswha
devswha deleted the test/b6-split-machine-profile branch November 24, 2026 00:40
@devswha

devswha commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Measured in this PR's CI (Integration tests job): server/machine-profile-api.contract.test.ts 86.2 s and server/machine-profile-lifecycle.contract.test.ts 71.4 s, against 171.7 s for the single file on main run 45279571403. All 2,331 integration tests passed (0 fail, 112 skip). That runner ran the lane one file at a time (1,064 s total), so its lane end is not comparable with the 8-shard main runs; the per-file times are.

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