mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6345] [MERGED] feat(game): ruleset catalogs and the sheet's Add from catalog picker (rulesets slice 8a) #7145
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7145
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6345
Author: @kolacheee
Created: 9/19/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @kolacheee
Base:
staging← Head:feat/rulesets-catalogs📝 Commits (10+)
34073bbfeat(game): ruleset catalogs, the shared format, Capability API 1.21 and the catalog route0daff86fix(game): refuse an imported ruleset whose catalog points at a separate file4e40feafeat(game): pick sheet rows from a ruleset's catalogsa168ba5fix(game): answer a repeated catalog request with 304 and tidy the picker note and the plan statusc38bcd9refactor(game): use the shared If-None-Match helper for the catalog routee1999c0fix(docs): tell the editor schema a catalog has exactly one of entries or asset4a0b4dffix(game): add a catalog entry whole or not at all, and tag the catalog answer with its header toobfae63erefactor(game): share the tolerant archive path helper and write the summary pattern as plain ranges325ae69docs(game): drop a stale comment on the catalog addition plan3fa3a5afix(game): refuse at install a ruleset that names a catalog file the package does not declare📊 Changes
22 files changed (+3214 additions, -89 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+19 -16)📝
docs/development/optional-agent-packages.md(+39 -0)📝
docs/examples/rulesets/ember-roads.json(+157 -3)📝
docs/extending/ruleset.schema.json(+377 -0)📝
docs/extending/writing-rulesets.md(+105 -0)➕
packages/client/src/components/rulesets/RulesetCatalogPicker.tsx(+313 -0)📝
packages/client/src/components/rulesets/RulesetSheetEditor.tsx(+72 -26)📝
packages/client/src/hooks/use-capability-packages.ts(+25 -1)➕
packages/client/src/lib/ruleset-catalog.ts(+362 -0)📝
packages/client/src/localization/locales/en.json(+53 -0)📝
packages/server/src/routes/capability-packages.routes.ts(+108 -3)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+136 -29)📝
packages/server/src/services/storage/game-rulesets.storage.ts(+8 -0)📝
packages/shared/src/schemas/capability-package.schema.ts(+27 -2)📝
packages/shared/src/schemas/ruleset.schema.ts(+365 -3)📝
scripts/generate-ruleset-schema.mjs(+12 -0)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+5 -5)➕
scripts/regressions/game-ruleset-catalogs.regression.ts(+664 -0)📝
scripts/regressions/game-ruleset-community.regression.ts(+14 -0)...and 2 more files
📄 Description
Linked issue
Part of #6314 (slice 8a; it does not close the issue). Builds on #6343 (slice 7a, merged).
Why this change
What changed
rows, one per list it writes. In the docs example, one knack adds a row toknacksand a limited-use row totricks. Every row's values are checked against the target list's columns when the ruleset loads, by a new shared helperrulesetListRowIssues, so a catalog can never write what the sheet could not hold._catalog(<catalogId>/<entryId>). Column ids cannot start with_, and every sheet path already keeps unknown row keys, so nothing else had to change to carry it.mechanics. An entry may carry a strict, typed block (kind, range, area, targets, amount, damage type, save, cost, and so on). It is validated (the save and the pools must exist) and shown as one line in the picker, built from the ruleset's own labels. The Engine does not consume it yet; a later combat bridge will. The picker says so.ruleset.json. A package may ship a large one ascatalogs/<id>.json(1 MB, 2000 entries), declared and hash-pinned likeruleset.json. Capability API 1.21 gates that asset family. A package is refused at install, with a readable message, when its ruleset has catalogs on an older declaration or names a catalog file the package does not declare.GET /capability-packages/rulesetsstrips inline entries and reportsentryCount, so that payload stays small. NewGET /capability-packages/rulesets/catalog?rulesetId=&catalogId=&version=returns one catalog's validated entries, for the exact version an imported ruleset's game pinned. A packaged catalog answers a repeated request with 304; its ETag is the pinned file hash, the ruleset version and a digest of the catalog header.hideWhenhides on this sheet are left out, and one commit writes every target list.docs/development/optional-agent-packages.mddocuments the asset family and 1.21, the Ember Roads example gains aknackscatalog (it still rolls 2d6), and the JSON Schema is regenerated.game-ruleset-catalogs(header and entry checks, the row validator,_catalog, the listing, the route for inline and packaged catalogs, 304, refusals, the 1.21 gate) and the client-laneruleset-catalog-picker(filter options,startFrom, already-added detection, overflow planning, the mechanics line).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Commands run locally by the agent:
pnpm check(exit 0),pnpm localization:check, the full node regression lane (pnpm regression:node: 313 of 314 on the first run, wheregallery-recovery.regression.tshit the 30 s timeout while another gate and a review were running on the same machine; it passes alone in under a second and this PR does not touch it), and the two new regressions. Sixteen complete local CodeRabbit sweeps were run before opening (one more was cut short by the CLI's rate limit and not counted). Their findings were fixed (all-or-nothing entries, rows kept out of lists hidden on the sheet, the 304 answer and its ETag, the install-time asset check, no retry on a 4xx, tolerant reads of stored lists, labelled number chips, and three editor schema points), and the last complete one returned no findings. One suggestion was declined: an in-process cache of parsed catalogs. The 304 answer and the client's query cache already avoid the repeated work, and a second cache would need its own invalidation. The e2e suite was checked by reading it: no spec locates or mocks the ruleset sheet editor or the ruleset routes, and every read ofdefinition.catalogstolerates it being absent. Playwright was not run locally.The agent also drove a scratch server on port 7820 with a fresh data folder: imported the Ember Roads example, confirmed the listing carries
entryCount: 6and no entries, and the catalog route returned the six entries. In a character's Stats tab, Add a sheet showed Add from catalog on both fed lists. The picker opened with focus in the search box, three filters, chips and the mechanics line ("Healing · self or touch · allies · 3 · costs 1 Grit"). Choosing three entries showed "Knacks gains 3, with room for 20" and "Limited tricks gains 1, with room for 12"; Add wrote three knacks and one trick in one change,_catalogwas never shown as a column, reopening the picker marked the three as Added, and after saving the character the stored rows carried_catalog. At 375 px the picker fit the screen with nothing past the right edge and the Add button on screen (live geometry, not a screenshot).Still to verify by hand:
catalogs/<id>.json; only the regression covers the packaged path, because no published package has one yet.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
CHANGELOG.md,docs/extending/writing-rulesets.md,docs/development/optional-agent-packages.md, the plan, the example and the generated schema. The[docs-i18n]follow-up is batched for the ruleset slices.UI evidence (if applicable)
To be added by a human: the Add from catalog button and the picker, in light, dark and phone width.
Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.