[PR #8264] [MERGED] fix(game): keep the draft's sheet spends when the GM rewrites after the dice #8255

Closed
opened 2026-10-26 04:04:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8264
Author: @kolacheee
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @kolacheee

Base: staging ← Head: fix/dice-rewrite-keeps-costs


📝 Commits (3)

  • c155c98 fix(game): keep the draft's sheet spends when the GM rewrites after the dice
  • 65b913c fix(game): match an unnamed cost to the player, and skip a discarded branch's
  • 23f6918 fix(game): a party cost that names somebody never stands in for the draft's

📊 Changes

3 files changed (+138 additions, -1 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+14 -1)
➕ packages/server/src/services/game/dice-rewrite-costs.ts (+63 -0)
➕ scripts/regressions/game-dice-rewrite-costs.regression.ts (+61 -0)

📄 Description

Linked issue

Closes #8263

Why this change

  • In a ruleset game, a turn that rolls checks is written twice. Only the rewrite's commands run, and the rewrite can silently drop a spend or use the draft wrote. In a playtest it dropped Wild Shape and Bardic Inspiration, so neither was ever paid.

What changed

  • Before: a [sheet: op="spend" ...] or [sheet: op="use" ...] in the GM's draft was paid only if the rewrite after the dice copied it, and nothing said when it didn't.
  • After: the draft's spends and uses are always paid, once. A cost the rewrite repeats isn't paid twice, and a failed rewrite still pays them. The rewrite is told these costs are kept as written. Harm, healing and conditions stay the rewrite's to decide.
  • The rewrite's raw output is logged under [generate/game/raw], next to the draft.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • New regression scripts/regressions/game-dice-rewrite-costs.regression.ts covers: a dropped spend is put back, a repeated one is kept once whatever its case or attribute order, a use counts as a cost, a failed rewrite still pays, and a draft with no costs leaves the rewrite unchanged.
  • tsc --noEmit on the server is clean, and prettier was run on the changed files.
  • Found in a laptop playtest on a real model (Gemini). The draft's spends were missing from the saved reply after the rewrite.

🔄 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-Engine/pull/8264 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/dice-rewrite-keeps-costs` --- ### 📝 Commits (3) - [`c155c98`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c155c9834ea7c62ab3e7023dfc77cb83f30d146f) fix(game): keep the draft's sheet spends when the GM rewrites after the dice - [`65b913c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/65b913ce6be9d608e61669480d4fc77c5a6cc381) fix(game): match an unnamed cost to the player, and skip a discarded branch's - [`23f6918`](https://github.com/Pasta-Devs/Marinara-Engine/commit/23f6918bfd80be968f83f3ba74799407b63427d9) fix(game): a party cost that names somebody never stands in for the draft's ### 📊 Changes **3 files changed** (+138 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+14 -1) ➕ `packages/server/src/services/game/dice-rewrite-costs.ts` (+63 -0) ➕ `scripts/regressions/game-dice-rewrite-costs.regression.ts` (+61 -0) </details> ### 📄 Description ## Linked issue Closes #8263 ## Why this change - In a ruleset game, a turn that rolls checks is written twice. Only the rewrite's commands run, and the rewrite can silently drop a `spend` or `use` the draft wrote. In a playtest it dropped Wild Shape and Bardic Inspiration, so neither was ever paid. ## What changed - Before: a `[sheet: op="spend" ...]` or `[sheet: op="use" ...]` in the GM's draft was paid only if the rewrite after the dice copied it, and nothing said when it didn't. - After: the draft's spends and uses are always paid, once. A cost the rewrite repeats isn't paid twice, and a failed rewrite still pays them. The rewrite is told these costs are kept as written. Harm, healing and conditions stay the rewrite's to decide. - The rewrite's raw output is logged under `[generate/game/raw]`, next to the draft. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - New regression `scripts/regressions/game-dice-rewrite-costs.regression.ts` covers: a dropped spend is put back, a repeated one is kept once whatever its case or attribute order, a `use` counts as a cost, a failed rewrite still pays, and a draft with no costs leaves the rewrite unchanged. - `tsc --noEmit` on the server is clean, and prettier was run on the changed files. - Found in a laptop playtest on a real model (Gemini). The draft's spends were missing from the saved reply after the rewrite. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 04:04:08 +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-Engine#8255
No description provided.