[GH-ISSUE #1806] [Issue]: Pull Request Checks spends most of its run in the Gacha Forge bundle rebuild regression #1764

Closed
opened 2026-11-07 16:36:30 +07:00 by bsakaguchi · 0 comments
Owner

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

Summary

The Pull Request Checks job takes about 8.5 minutes, and about 6.5 of those are one command: tests/gacha-forge-bundle-rebuild.regression.mjs. Every PR waits on it, including PRs that don't touch Gacha Forge.

Affected package

catalog/repository (CI). The slow test covers gacha-forge, and the slow code is scripts/gacha-forge-bundle-patches.mjs.

Expected behavior

The rebuild regression finishes in seconds, so the Pull Request Checks run is bounded by lint, typecheck and the remaining regressions (each under a minute).

Actual behavior

In run 40664480102, the "Test and validate the packages, catalog and repository gates" step took 6 min 36 s of the 8 min 32 s job. Run locally on 4 cores, the same command hit run-parallel.mjs's 600 s ceiling; the next slowest command was packages/pixelforge/test-brief.mjs at 49 s.

Two causes:

  1. rebuildGachaBundles undoes and redoes ~815 ledger edits on client.js (1.9 MB) and server.mjs (1.0 MB) with String.prototype.indexOf and string concatenation. The bundles hold non-ASCII text, so they are two-byte strings, and one rebuild takes ~4 s. A CPU profile puts ~3.7 s of that in swapGachaBundleText.
  2. The regression rebuilds three times per listed source (54 sources), so about 163 rebuilds in all.

Steps to reproduce

  1. npm ci
  2. time node tests/gacha-forge-bundle-rebuild.regression.mjs
  3. To time a single rebuild, call rebuildGachaBundles(new URL("packages/gacha-forge/", ...)) on a clean checkout. It leaves the tree unchanged.

Environment

  • Marinara Engine version: n/a (CI only)
  • Package version: gacha-forge as of staging 8bd08a6
  • Install type: other (GitHub Actions ubuntu-latest, Node 24; reproduced locally on Node 22, 4 cores)
  • OS + version: Ubuntu (GitHub-hosted runner)
  • Browser or app shell: n/a

Logs, screenshots, or video

Local run-parallel.mjs timing, slowest commands:

600.0 node tests/gacha-forge-bundle-rebuild.regression.mjs: failed (timed out after 600s)
 49.2 node packages/pixelforge/test-brief.mjs
 10.8 node scripts/validate-catalog.mjs
 10.6 npm run test:saucelings

Additional context

Proposed fix: swap bytes (Buffers) instead of strings in the rebuild. A UTF-8 match always starts on a character boundary, so the matches and the output are the same. Also change all sources at once in the regression, each with its own proof string, so it needs 4 rebuilds instead of ~163.

Limiting the job to changed packages was considered but not proposed. This is the required merge gate, and once the rebuild test is fast the remaining time is mostly fixed costs (checkout, lint, typecheck).

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 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1806 ## Summary The Pull Request Checks job takes about 8.5 minutes, and about 6.5 of those are one command: `tests/gacha-forge-bundle-rebuild.regression.mjs`. Every PR waits on it, including PRs that don't touch Gacha Forge. ## Affected package catalog/repository (CI). The slow test covers `gacha-forge`, and the slow code is `scripts/gacha-forge-bundle-patches.mjs`. ## Expected behavior The rebuild regression finishes in seconds, so the Pull Request Checks run is bounded by lint, typecheck and the remaining regressions (each under a minute). ## Actual behavior In run [40664480102](https://github.com/Pasta-Devs/Marinara-Agents/actions/runs/40664480102), the "Test and validate the packages, catalog and repository gates" step took 6 min 36 s of the 8 min 32 s job. Run locally on 4 cores, the same command hit `run-parallel.mjs`'s 600 s ceiling; the next slowest command was `packages/pixelforge/test-brief.mjs` at 49 s. Two causes: 1. `rebuildGachaBundles` undoes and redoes ~815 ledger edits on `client.js` (1.9 MB) and `server.mjs` (1.0 MB) with `String.prototype.indexOf` and string concatenation. The bundles hold non-ASCII text, so they are two-byte strings, and one rebuild takes ~4 s. A CPU profile puts ~3.7 s of that in `swapGachaBundleText`. 2. The regression rebuilds three times per listed source (54 sources), so about 163 rebuilds in all. ## Steps to reproduce 1. `npm ci` 2. `time node tests/gacha-forge-bundle-rebuild.regression.mjs` 3. To time a single rebuild, call `rebuildGachaBundles(new URL("packages/gacha-forge/", ...))` on a clean checkout. It leaves the tree unchanged. ## Environment - Marinara Engine version: n/a (CI only) - Package version: gacha-forge as of `staging` 8bd08a6 - Install type: other (GitHub Actions `ubuntu-latest`, Node 24; reproduced locally on Node 22, 4 cores) - OS + version: Ubuntu (GitHub-hosted runner) - Browser or app shell: n/a ## Logs, screenshots, or video Local `run-parallel.mjs` timing, slowest commands: ``` 600.0 node tests/gacha-forge-bundle-rebuild.regression.mjs: failed (timed out after 600s) 49.2 node packages/pixelforge/test-brief.mjs 10.8 node scripts/validate-catalog.mjs 10.6 npm run test:saucelings ``` ## Additional context Proposed fix: swap bytes (Buffers) instead of strings in the rebuild. A UTF-8 match always starts on a character boundary, so the matches and the output are the same. Also change all sources at once in the regression, each with its own proof string, so it needs 4 rebuilds instead of ~163. Limiting the job to changed packages was considered but not proposed. This is the required merge gate, and once the rebuild test is fast the remaining time is mostly fixed costs (checkout, lint, typecheck). ## 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-11-07 16:36:30 +07:00
  • closed this issue
  • added the
    bug
    label
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-Agents#1764
No description provided.