mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #2165] [Feature]: Speed up the ruleset package regression by caching repeated catalog parses and shippedUpTo results #2160
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#2160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2165
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
The ruleset package regression (
scripts/tests/ruleset-package.regression.mjs) takes 10-17 min in CI and about 15m42s locally. Profiling shows three hot spots, all repeated work with the same inputs:assertRulesetSheetHooksinscripts/ruleset-package-checks.mjsre-parses multi-MB catalog text withJSON.parsein nine loops on each of its 959 calls.shippedUpTo(minor)in the test is called 505 times with only 192 distinct arguments.Proposed package or change
Repository test code only, no package change.
parsedCatalogFile(text)helper (bounded 64-entry map keyed by the text, result deep-frozen, reusing the existingdeepFreezeandPARSED_CATALOG_CACHE_SIZE) replaces the nineJSON.parse(String(text))calls inassertRulesetSheetHooks;countedNamesis declared once per call and filled lazily. Freezing makes any later mutation of a cached parse throw (ES modules are strict).shippedUpTobyminor, returning astructuredCloneof the document and a newMapof sources so callers keep their own copies. AVERIFY_MEMO=1mode re-derives each memoised result and compares it withisDeepStrictEqual, printing the comparison count.A prototype measured 15m42s → 10m03s with 301/301 checks passing, and
VERIFY_MEMO=1found all 651 memoised results identical to fresh ones.Why should this be optional?
Not a package. The test's assertions and coverage are unchanged; only repeated parsing and derivation are cached.
Alternatives considered
Splitting the test across CI jobs would cut wall-clock but not compute, and adds workflow complexity. The ruleset workflow is already gated by paths (#2163).
Additional context
Follows #2163 (the ruleset workflow gate). This PR touches
scripts/ruleset-*.mjsand the test, so the gated ruleset workflow runs on it.Template check