[PR #4684] [MERGED] fix(game): make dice results display honestly #6466

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4684
Author: @Gunterlie
Created: 8/6/2026
Status: ✅ Merged
Merged: 8/8/2026
Merged by: @Gunterlie

Base: staging ← Head: roll-system-validation


📝 Commits (6)

  • 49bab9a fix(game): make dice results display honestly
  • 76eb632 fix(game): declare skill check resolution mode
  • 69b4373 fix(game): address dice review findings
  • fcb80b0 fix(game): distinguish invalid dice declarations
  • a6a7769 fix(game): harden implicit d20 validation
  • db0e87e fix(game): reject conflicting dice notation

📊 Changes

14 files changed (+316 additions, -41 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 package.json (+2 -1)
📝 packages/client/src/components/dice/AnimatedDiceRoll.tsx (+20 -3)
📝 packages/client/src/components/dice/AnimatedSkillCheckResult.tsx (+12 -2)
📝 packages/client/src/components/game/GameNarration.tsx (+2 -12)
📝 packages/client/src/lib/game-tag-parser.ts (+81 -13)
📝 packages/client/src/lib/slash-commands.ts (+7 -6)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/services/game/gm-prompts.ts (+2 -2)
📝 packages/server/src/services/game/segment-edits.ts (+3 -0)
📝 packages/server/src/services/game/skill-check.service.ts (+8 -0)
📝 packages/shared/src/types/game.ts (+10 -0)
📝 packages/shared/src/utils/skill-check-format.ts (+26 -2)
➕ scripts/regressions/dice-display.regression.ts (+139 -0)

📄 Description

Linked issue

Closes #4683

Why this change

Game Mode result cards previously guessed how a result was calculated by checking whether the numbers happened to add up. That made valid advantage rolls and non-sum dice pools look mathematically broken, and could mislabel a success count as a dice total. The result now declares its meaning explicitly so the UI can describe it faithfully.

What changed

  • Carry declared dice notation through skill-check results and render the matching die shape.
  • Carry explicit resolution="sum" or resolution="successes" semantics through tags, summaries, narration logs, and the dice card.
  • Show an addition only for declared sum results whose displayed dice and modifier equal the reported total.
  • Display counted pools as N success / N successes, without treating the count as arithmetic.
  • Validate plain d20 model-resolved arithmetic/outcomes before displaying them, while preserving non-d20 declared results the engine cannot independently adjudicate.
  • Add prompt guidance for exact non-d20 notation and resolution mode.
  • Add a client guard for oversized or zero-count /roll inputs.
  • Add deterministic regression coverage and an Unreleased changelog entry.

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

  • pnpm regression:dice passes, including the ambiguous [1, 1] / 2 successes case.
  • pnpm localization:check passes.
  • Shared and client lint pass.
  • Full pnpm check remains blocked by existing Fastify/sharp TypeScript errors in untouched server files (packages/server/src/app.ts, packages/server/src/config/client-static-config.ts, and packages/server/src/utils/sharp.ts).
  • Manual browser, mobile/light-dark, and container verification remain for human review.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

The changed UI needs manual browser screenshots for the PR before it is marked ready for review.

Summary by CodeRabbit

  • New Features

    • Dice cards preserve declared notation and distinguish summed rolls from success-counting pools.
    • Skill-check results show accurate dice breakdowns, modifiers, totals, and localized success counts.
    • Alternate dice systems and pre-rolled checks retain their actual dice information.
  • Bug Fixes

    • Prevented discarded dice and success pools from appearing as misleading addition equations.
    • Improved validation for malformed notation and inconsistent roll totals.
  • Tests

    • Added regression coverage for dice displays, skill checks, modifiers, serialization, and dice-pool formatting.

🔄 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/4684 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/6/2026 **Status:** ✅ Merged **Merged:** 8/8/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `roll-system-validation` --- ### 📝 Commits (6) - [`49bab9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/49bab9aee6cdcd2a746079581b4fb2c3832e70ae) fix(game): make dice results display honestly - [`76eb632`](https://github.com/Pasta-Devs/Marinara-Engine/commit/76eb632291429e0ca3f9ecaca6e529ef15be161f) fix(game): declare skill check resolution mode - [`69b4373`](https://github.com/Pasta-Devs/Marinara-Engine/commit/69b437313404159439985d089af4ef197fe8faab) fix(game): address dice review findings - [`fcb80b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fcb80b098caa7c578fa3805e700ca290000052d6) fix(game): distinguish invalid dice declarations - [`a6a7769`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a6a7769359719b0f73dc3491c9f09fcbfe0b8ddf) fix(game): harden implicit d20 validation - [`db0e87e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db0e87ef96f0dee25d6fcf27db7cb50b6202cf92) fix(game): reject conflicting dice notation ### 📊 Changes **14 files changed** (+316 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `package.json` (+2 -1) 📝 `packages/client/src/components/dice/AnimatedDiceRoll.tsx` (+20 -3) 📝 `packages/client/src/components/dice/AnimatedSkillCheckResult.tsx` (+12 -2) 📝 `packages/client/src/components/game/GameNarration.tsx` (+2 -12) 📝 `packages/client/src/lib/game-tag-parser.ts` (+81 -13) 📝 `packages/client/src/lib/slash-commands.ts` (+7 -6) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/services/game/gm-prompts.ts` (+2 -2) 📝 `packages/server/src/services/game/segment-edits.ts` (+3 -0) 📝 `packages/server/src/services/game/skill-check.service.ts` (+8 -0) 📝 `packages/shared/src/types/game.ts` (+10 -0) 📝 `packages/shared/src/utils/skill-check-format.ts` (+26 -2) ➕ `scripts/regressions/dice-display.regression.ts` (+139 -0) </details> ### 📄 Description ## Linked issue Closes #4683 ## Why this change Game Mode result cards previously guessed how a result was calculated by checking whether the numbers happened to add up. That made valid advantage rolls and non-sum dice pools look mathematically broken, and could mislabel a success count as a dice total. The result now declares its meaning explicitly so the UI can describe it faithfully. ## What changed - Carry declared dice notation through skill-check results and render the matching die shape. - Carry explicit `resolution="sum"` or `resolution="successes"` semantics through tags, summaries, narration logs, and the dice card. - Show an addition only for declared sum results whose displayed dice and modifier equal the reported total. - Display counted pools as `N success` / `N successes`, without treating the count as arithmetic. - Validate plain d20 model-resolved arithmetic/outcomes before displaying them, while preserving non-d20 declared results the engine cannot independently adjudicate. - Add prompt guidance for exact non-d20 notation and resolution mode. - Add a client guard for oversized or zero-count `/roll` inputs. - Add deterministic regression coverage and an Unreleased changelog entry. ## 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) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm regression:dice` passes, including the ambiguous `[1, 1]` / `2 successes` case. - `pnpm localization:check` passes. - Shared and client lint pass. - Full `pnpm check` remains blocked by existing Fastify/sharp TypeScript errors in untouched server files (`packages/server/src/app.ts`, `packages/server/src/config/client-static-config.ts`, and `packages/server/src/utils/sharp.ts`). - Manual browser, mobile/light-dark, and container verification remain for human review. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) The changed UI needs manual browser screenshots for the PR before it is marked ready for review. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Dice cards preserve declared notation and distinguish summed rolls from success-counting pools. * Skill-check results show accurate dice breakdowns, modifiers, totals, and localized success counts. * Alternate dice systems and pre-rolled checks retain their actual dice information. * **Bug Fixes** * Prevented discarded dice and success pools from appearing as misleading addition equations. * Improved validation for malformed notation and inconsistent roll totals. * **Tests** * Added regression coverage for dice displays, skill checks, modifiers, serialization, and dice-pool formatting. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:10:42 +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#6466
No description provided.