[PR #2166] [MERGED] chore(ci): cache catalog parses and memoise shippedUpTo in the ruleset regression #2161

Closed
opened 2026-11-08 01:48:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/2166
Author: @Promansis
Created: 11/7/2026
Status: ✅ Merged
Merged: 11/7/2026
Merged by: @Promansis

Base: staging ← Head: chore(ci)/ruleset-test-speed


📝 Commits (2)

  • bc49138 chore(ci): cache catalog parses and memoise shippedUpTo in the ruleset regression
  • 7cce2b5 Merge branch 'staging' into chore(ci)/ruleset-test-speed

📊 Changes

2 files changed (+46 additions, -11 deletions)

View changed files

📝 scripts/ruleset-package-checks.mjs (+27 -11)
📝 scripts/tests/ruleset-package.regression.mjs (+19 -0)

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #2165

Why this change

  • The ruleset regression (scripts/tests/ruleset-package.regression.mjs) is the slowest job in CI, at about 15m42s locally. Most of that time goes to repeating the same work:
    • assertRulesetSheetHooks re-parses every catalog file nine times per call.
    • shippedUpTo(minor) rebuilds the whole shipped package for each of its ~500 calls, which ask for only a handful of minors.
  • This is CI speed item A2. A1 (#2164) gated the ruleset job on ruleset paths.

What changed

  • scripts/ruleset-package-checks.mjs:
    • New parsedCatalogFile(text): each catalog text is parsed once into a 64-entry cache, keyed by the text and deep-frozen. It reuses the existing deepFreeze and PARSED_CATALOG_CACHE_SIZE. The nine JSON.parse(String(text)) calls in assertRulesetSheetHooks now use it.
    • The freezing is deliberate. The module is strict, so a check that wrote to a shared parse would throw instead of leaking into the next walk.
    • The 1.239 usesOf counter names are now gathered once per call, lazily.
  • scripts/tests/ruleset-package.regression.mjs:
    • shippedUpTo(minor) is memoised per minor and returns [structuredClone(doc), new Map(sources)], so each caller still edits its own copy. Sources values are strings.
    • VERIFY_MEMO=1 rebuilds on every call, checks the memo against the fresh build with isDeepStrictEqual, and prints the number of memo checks at the end.
  • No assertion, check or coverage changes, and no packages or generated outputs are touched.
  • This PR touches scripts/ruleset-*.mjs and the ruleset test, so the ruleset workflow runs on it (A1's gate).

Package and security impact

  • Affected package IDs: none (repository scripts and tests only)
  • Engine compatibility impact: none
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Agent-run, local (Linux, MARINARA_ENGINE_ROOT=/home/damo/dev/Marinara-Engine):

  • node scripts/tests/ruleset-package.regression.mjs: exit 0, 301 regression checks passed lines, 9m52s (was 15m42s).
  • VERIFY_MEMO=1 node scripts/tests/ruleset-package.regression.mjs: exit 0, 301 lines, memo checks: 651.
  • npm run check: exit 0.
  • Throwaway probe (not committed):
    • The catalogs differ between shippedUpTo(749) and shippedUpTo(813), and each matches its fresh build.
    • A caller's edits to its copy don't reach the memo.
    • assertRulesetSheetHooks passes for 749, then 813, then 749 again.
  • Self-review (Opus): no blocking findings. One overclaiming comment was reworded.
    • Left as a follow-up: catalogEntryList keeps its own parse cache, so texts are parsed twice. It's only worth merging the two caches if CI memory becomes a problem.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/2166 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 11/7/2026 **Status:** ✅ Merged **Merged:** 11/7/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `chore(ci)/ruleset-test-speed` --- ### 📝 Commits (2) - [`bc49138`](https://github.com/Pasta-Devs/Marinara-Agents/commit/bc491387545d933b7ee6bf998203003781b11321) chore(ci): cache catalog parses and memoise shippedUpTo in the ruleset regression - [`7cce2b5`](https://github.com/Pasta-Devs/Marinara-Agents/commit/7cce2b53b0c6760c87af7b86553bfe05e1d48caa) Merge branch 'staging' into chore(ci)/ruleset-test-speed ### 📊 Changes **2 files changed** (+46 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `scripts/ruleset-package-checks.mjs` (+27 -11) 📝 `scripts/tests/ruleset-package.regression.mjs` (+19 -0) </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #2165 ## Why this change - The ruleset regression (`scripts/tests/ruleset-package.regression.mjs`) is the slowest job in CI, at about 15m42s locally. Most of that time goes to repeating the same work: - `assertRulesetSheetHooks` re-parses every catalog file nine times per call. - `shippedUpTo(minor)` rebuilds the whole shipped package for each of its ~500 calls, which ask for only a handful of minors. - This is CI speed item A2. A1 (#2164) gated the ruleset job on ruleset paths. ## What changed - `scripts/ruleset-package-checks.mjs`: - New `parsedCatalogFile(text)`: each catalog text is parsed once into a 64-entry cache, keyed by the text and deep-frozen. It reuses the existing `deepFreeze` and `PARSED_CATALOG_CACHE_SIZE`. The nine `JSON.parse(String(text))` calls in `assertRulesetSheetHooks` now use it. - The freezing is deliberate. The module is strict, so a check that wrote to a shared parse would throw instead of leaking into the next walk. - The 1.239 `usesOf` counter names are now gathered once per call, lazily. - `scripts/tests/ruleset-package.regression.mjs`: - `shippedUpTo(minor)` is memoised per minor and returns `[structuredClone(doc), new Map(sources)]`, so each caller still edits its own copy. Sources values are strings. - `VERIFY_MEMO=1` rebuilds on every call, checks the memo against the fresh build with `isDeepStrictEqual`, and prints the number of memo checks at the end. - No assertion, check or coverage changes, and no packages or generated outputs are touched. - This PR touches `scripts/ruleset-*.mjs` and the ruleset test, so the ruleset workflow runs on it (A1's gate). ## Package and security impact - Affected package IDs: none (repository scripts and tests only) - Engine compatibility impact: none - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Agent-run, local (Linux, `MARINARA_ENGINE_ROOT=/home/damo/dev/Marinara-Engine`): - `node scripts/tests/ruleset-package.regression.mjs`: exit 0, 301 `regression checks passed` lines, **9m52s** (was 15m42s). - `VERIFY_MEMO=1 node scripts/tests/ruleset-package.regression.mjs`: exit 0, 301 lines, `memo checks: 651`. - `npm run check`: exit 0. - Throwaway probe (not committed): - The catalogs differ between `shippedUpTo(749)` and `shippedUpTo(813)`, and each matches its fresh build. - A caller's edits to its copy don't reach the memo. - `assertRulesetSheetHooks` passes for 749, then 813, then 749 again. - Self-review (Opus): no blocking findings. One overclaiming comment was reworded. - Left as a follow-up: `catalogEntryList` keeps its own parse cache, so texts are parsed twice. It's only worth merging the two caches if CI memory becomes a problem. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-08 01:48:20 +07:00
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#2161
No description provided.