[GH-ISSUE #8038] [Feature]: Split ruleset-combat-director.regression.ts so the pool can run its halves side by side #7534

Closed
opened 2026-10-24 04:03:58 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Promansis on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8038

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

scripts/regressions/ruleset-combat-director.regression.ts is one 1,857-line file that runs 123 s alone and 131–300 s inside the 4-worker CI pool, which makes it the longest single unit in the Node regression lane. Because one file is one process, the pool cannot spread it: shard 1 of complete-node-regressions is only as fast as this file plus its queue. The file already has a natural seam: its console.log("… passed.") sits at line 1394, after which four more sections run (contests, Engine-played party windows, dice-pool fights, initiative as a number). Measured solo: 47 s up to that line, 76 s after it.

Do this only if #8036 (cache the live-less sheet evaluation per command) does not land, or if the file still exceeds about 120 s in the pool afterwards. With that cache the whole file runs in 60 s solo and the split is not worth its extra process.

Proposed solution

  • Move the shared top of the file (lines 1–~270: the two ruleset fixtures, the party, engineUnit, start/started, view, bestiaryOf and the other helpers) to scripts/regressions/fixtures/ruleset-combat-director-fixtures.ts, following fixtures/avatar-2d-fixtures.ts. Helper files there are not discovered by the runner (only *.regression.{ts,mjs,js} are).
  • Keep the first part as ruleset-combat-director.regression.ts (sections up to the current console.log) and move the four sections after it into ruleset-combat-director-engine-play.regression.ts with its own closing console.log. No assertion is changed, added or removed; git diff --stat should show the moved lines and the import block only.
  • Timeouts in scripts/run-regressions.mjs regressionTimeoutMs: give the new file its own entry (about 240 s for the 76 s half, 180 s for the 47 s half, both at the pool's 2.3× worst case) and update regression-timeout-policy.regression.mjs accordingly. Its "each shard takes one of the three slowest files" assertion derives the slowest set from the policy, so it keeps holding without edits.
  • --list --shard dealing is slow-first, so the two halves land in different shards automatically. Confirm on the PR run that the three node-regressions i/3 durations are closer together than before (shard 1 was 5–7 min against 4–6 for the others).

Proof: node scripts/run-regressions.mjs --filter ruleset-combat-director runs both files; --filter regression-timeout-policy passes; the two shard listings show the files on different shards.

Alternatives considered

  • Keeping one file and raising the timeout (#8037): stops the pool timeout but leaves shard 1 bound by one process.
  • Fewer seeds per section: cuts coverage the sections were written to prove (the picker never stalls across 40 seeds, pools across 20).
  • Making the engine cheaper (#8036): the better fix, which is why this issue is conditional on it.

Additional context

  • Timings from PR #8033 (issue #8032) shard logs and a local profile; see #8036 for where the time goes.
  • Both halves import the same packages/shared and packages/server modules, so the split costs one extra process start (about 1.5 s CPU) and nothing else.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8038 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? `scripts/regressions/ruleset-combat-director.regression.ts` is one 1,857-line file that runs 123 s alone and 131–300 s inside the 4-worker CI pool, which makes it the longest single unit in the Node regression lane. Because one file is one process, the pool cannot spread it: shard 1 of `complete-node-regressions` is only as fast as this file plus its queue. The file already has a natural seam: its `console.log("… passed.")` sits at line 1394, after which four more sections run (contests, Engine-played party windows, dice-pool fights, initiative as a number). Measured solo: 47 s up to that line, 76 s after it. **Do this only if #8036 (cache the live-less sheet evaluation per command) does not land, or if the file still exceeds about 120 s in the pool afterwards.** With that cache the whole file runs in 60 s solo and the split is not worth its extra process. ## Proposed solution - Move the shared top of the file (lines 1–~270: the two ruleset fixtures, the party, `engineUnit`, `start`/`started`, `view`, `bestiaryOf` and the other helpers) to `scripts/regressions/fixtures/ruleset-combat-director-fixtures.ts`, following `fixtures/avatar-2d-fixtures.ts`. Helper files there are not discovered by the runner (only `*.regression.{ts,mjs,js}` are). - Keep the first part as `ruleset-combat-director.regression.ts` (sections up to the current `console.log`) and move the four sections after it into `ruleset-combat-director-engine-play.regression.ts` with its own closing `console.log`. No assertion is changed, added or removed; `git diff --stat` should show the moved lines and the import block only. - Timeouts in `scripts/run-regressions.mjs` `regressionTimeoutMs`: give the new file its own entry (about 240 s for the 76 s half, 180 s for the 47 s half, both at the pool's 2.3× worst case) and update `regression-timeout-policy.regression.mjs` accordingly. Its "each shard takes one of the three slowest files" assertion derives the slowest set from the policy, so it keeps holding without edits. - `--list --shard` dealing is slow-first, so the two halves land in different shards automatically. Confirm on the PR run that the three `node-regressions i/3` durations are closer together than before (shard 1 was 5–7 min against 4–6 for the others). Proof: `node scripts/run-regressions.mjs --filter ruleset-combat-director` runs both files; `--filter regression-timeout-policy` passes; the two shard listings show the files on different shards. ## Alternatives considered - Keeping one file and raising the timeout (#8037): stops the pool timeout but leaves shard 1 bound by one process. - Fewer seeds per section: cuts coverage the sections were written to prove (the picker never stalls across 40 seeds, pools across 20). - Making the engine cheaper (#8036): the better fix, which is why this issue is conditional on it. ## Additional context - Timings from PR #8033 (issue #8032) shard logs and a local profile; see #8036 for where the time goes. - Both halves import the same `packages/shared` and `packages/server` modules, so the split costs one extra process start (about 1.5 s CPU) and nothing else. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-24 04:03:58 +07:00
Author
Owner

@Promansis commented on GitHub (Oct 22, 2026):

Not needed. With #8036 merged (PR #8045), ruleset-combat-director.regression.ts runs in about 55 s inside the 4-worker CI pool, against 131–300 s before:

Run Director in the pool Job
PR #8045 at e9ebf9a8d 56.0 s 119678441872
PR #8045 at 54b2246b2 124.1 s 119724308944
staging at 1172159e9 54.9 s 119733394457

The 124 s run was a slow runner, not the file: every slow file took longer in that job (server-signal-shutdown 58.0 s against 40.6–43.7 s, native-export-memory 42.6 s against 21.4–26.1 s), and the job took 17 min against 11–12 min. This issue's bar was about 120 s in the pool, so the split is not worth its extra process. Reopen it if the director climbs back over that bar.

<!-- gh-comment-id:6337094603 --> @Promansis commented on GitHub (Oct 22, 2026): Not needed. With #8036 merged (PR #8045), `ruleset-combat-director.regression.ts` runs in about 55 s inside the 4-worker CI pool, against 131–300 s before: | Run | Director in the pool | Job | | --- | --- | --- | | PR #8045 at e9ebf9a8d | 56.0 s | 119678441872 | | PR #8045 at 54b2246b2 | 124.1 s | 119724308944 | | `staging` at 1172159e9 | 54.9 s | 119733394457 | The 124 s run was a slow runner, not the file: every slow file took longer in that job (`server-signal-shutdown` 58.0 s against 40.6–43.7 s, `native-export-memory` 42.6 s against 21.4–26.1 s), and the job took 17 min against 11–12 min. This issue's bar was about 120 s in the pool, so the split is not worth its extra process. Reopen it if the director climbs back over that bar.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7534
No description provided.