[PR #6201] [MERGED] fix(game): enforce an Experience's widget requirement, whole-number seeds, seed-safe imports, Escape over a stacked dialog, and a skipped-entry notice #7090

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6201
Author: @kolacheee
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @kolacheee

Base: staging ← Head: fix/experience-setup-followups


📝 Commits (10+)

  • 00e1bb5 fix(game): enforce Experience custom widget requirement
  • bbf48e5 fix(game): accept only whole-number world seeds and keep imported seeds
  • cd5115a fix(game): keep Escape from dismissing setup behind a stacked dialog
  • 808f0bc fix(game): report imported lorebook entries missing on this machine
  • ae5a5f3 fix(game): keep the player's widget setup choice across Experience toggles
  • 66af4d4 fix(game): word the locked widget line as approved
  • 19e8b27 test(e2e): wait for the ordinary setup import before toggling the Experience
  • 356d14c docs: state the real Experience seed and import rules
  • 29d9fcd docs(changelog): record the seed contract and the preserved imported seed
  • def84dc test(e2e): give the Experience setup follow-up cases their own budgets

📊 Changes

14 files changed (+683 additions, -170 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 docs/development/optional-agent-packages.md (+14 -9)
📝 e2e/game-experience-setup.e2e.ts (+289 -118)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+36 -24)
📝 packages/client/src/components/game/LegacyExperienceSetupDialog.tsx (+6 -1)
📝 packages/client/src/components/game/NewGameExperienceChooser.tsx (+5 -2)
📝 packages/client/src/components/ui/Modal.tsx (+21 -2)
📝 packages/client/src/lib/game-experience-setup.ts (+14 -4)
📝 packages/client/src/lib/game-setup-share.ts (+2 -2)
➕ packages/client/src/lib/modal-overlay-registry.ts (+64 -0)
📝 packages/client/src/localization/locales/en.json (+7 -7)
📝 scripts/regressions/experience-setup-config.regression.ts (+2 -1)
➕ scripts/regressions/game-experience-seed.regression.ts (+102 -0)
➕ scripts/regressions/setup-escape-overlay-guard.regression.ts (+117 -0)

📄 Description

Important

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

Linked issue

Closes #6200

Follow-up to #6193 for #6181, built on #6193's merged head. It carries the parts of #6181 that #6193 did not, as listed on #6196 when that PR was closed as superseded.

Why this change

  • #6193 shipped the Experience setup seam. A few parts of it do not match what the Pixelforge package owner ruled, and two of them are plain defects. This PR fixes those parts and nothing else.
  • The widget requirement is enforced, not advisory. #6193 treats an Experience's declared custom-widgets requirement as a default that yields the moment the player touches the control, and the line beside it says the setting can be changed. The package owner's ruling of 2026-09-14 is that a declared requirement is enforced while the Experience is on. The reason: an Experience-owned game never renders the widget rail, so an editable control only lets the server design widgets nobody sees and tells the Game Master to emit widget commands every turn. Enforcement must not cost the player anything, so their own earlier choice is kept untouched and handed back the moment the Experience is turned off.
  • The seed is an unsigned whole number. #6193 accepts any finite number in the seed field, so 1.5, -3, 1e3 and 0x10 are written into the package's config. The package reads the value as an unsigned integer, so the number the player sees can differ from the number the world is built from. Refusing bad input is visible; a silently different world is not.
  • Importing an ordinary setup file blanked the prefilled seed. A file with no Experience in it set the seed field to an empty string, and turning an Experience on afterwards blocked Start with no hint that Randomize fixes it. #6193's browser test never hit this because its import fixture always carries an Experience.
  • Escape dismissed two dialogs at once. With the malformed-JSON repair dialog open over the legacy Experience setup dialog, one press closed the repair dialog and cancelled the setup behind it, discarding the player's answers.
  • Imported lore-entry picks that do not exist here were dropped silently, while a missing Experience gets a notice.
  • The active-Experience line still described the old model ("{{name}} will run this game."), which the wizard change was meant to retire.
  • Nothing in the browser lane proved the pre-seam fallback: a game-surface package with no setup block must still get its own setup dialog.

What changed

  1. Widget requirement enforced. In GameSetupWizard.tsx the touched flag is gone and the value is derived: a declared requirement wins while its Experience is active, the player's own choice is stored separately and never overwritten, and it returns by itself when the Experience is turned off. The toggle is disabled while locked, with the file's existing disabled styling and an aria-pressed state. A setup-file import still restores the underlying choice but cannot unlock the control. The line beside it reads "{{name}} turns custom HUD widgets off for this game." (or "on"); the old override and state strings are removed.
  2. Seed contract. parseExperienceSeed accepts an integer from 0 to 4294967295 or a digits-only string, and returns null for everything else. The module exports MAX_EXPERIENCE_SEED and an isExperienceSeed guard, the input uses step=1 min=0 max=4294967295 instead of step="any", and the invalid-seed message names the range. The share resolver uses the same guard, so an unusable stored seed never reaches the wizard.
  3. Imports keep the prefilled seed. The seed field is replaced only when the imported file carries a usable seed for an installed Experience; otherwise the random default stays.
  4. Escape closes the top dialog only. A small module-level count of open Modal overlays (packages/client/src/lib/modal-overlay-registry.ts) is registered by Modal while it is open, and the legacy dialog's window key handler returns early while anything is stacked above it.
  5. Experiences-block wording. The two lines now describe the seam: "Play this game through a downloaded experience. The setup below still applies, and the experience adds its own controls here when it needs them." and "{{name}} is on for this game. It uses everything you set below, plus the settings shown here."
  6. Skipped-entry notice. After a setup-file import, once every lorebook query has succeeded, a role="status" line reports how many of the file's selected entries are not available on this machine. It is held at zero while entries are loading or if the fetch failed, so a load error never reads as missing entries.
  7. Coverage. New lanes scripts/regressions/game-experience-seed.regression.ts (accepted and refused seed inputs, the validator) and scripts/regressions/setup-escape-overlay-guard.regression.ts (the overlay registry and its call sites). The e2e spec gains the locked and restored widget control, a fractional seed blocking Start, an ordinary import keeping the seed, the skipped-entry notice, and a pre-seam fallback case where a package with no setup block still opens the legacy dialog and Back returns to the wizard.

Docs and CHANGELOG match: the package-author seed paragraph states the real contract, the widget paragraph describes enforcement and restore, and the import paragraph covers the preserved seed and the skipped entries.

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

Run before opening, on the rebased tree: every piece of pnpm check, pnpm version:check, git diff --check, the lanes experience-setup-config, game-experience-seed, setup-escape-overlay-guard, experience-lore-entries, capability-package-lifecycle, prompt, open-issues and assigned-issue-sweep, e2e/game-experience-setup.e2e.ts on desktop and mobile Chromium, and a local CodeRabbit sweep. Mobile WebKit cannot launch on the author's Fedora host, so CI proves that lane.

Still to verify by hand:

  • Manually verify that an Experience declaring a widget requirement sets the custom HUD widgets control, disables it, and shows the line naming that Experience; that clicking it does nothing; and that turning the Experience off re-enables it at the earlier value with the line gone.
  • Manually verify that importing a setup file while such an Experience is active does not unlock or change the locked control.
  • Manually verify that typing 1.5, -1, 1e3, 0x10, 12abc or 4294967296 into the world seed blocks Start with the range message, and that 0 and 4294967295 are accepted.
  • Manually verify that importing an ordinary Game Mode setup file leaves the prefilled random seed in place.
  • Manually verify that with a malformed-JSON repair dialog over Experience setup, one Escape closes only the repair dialog and the setup answers survive, and a second Escape closes setup.
  • Manually verify that importing a setup file referencing lorebook entries missing on this machine shows the skipped-entry count, and that no count appears while the picker is loading or after a load error.
  • Manually verify that a game-surface package with no setup block still opens the legacy setup dialog and that Back returns to the wizard.
  • Check light and dark mode and a narrow viewport for the locked toggle, the requirement line and the skipped-entry notice.

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)

docs/development/optional-agent-packages.md changed (seed contract, enforced requirement, import rules) and CHANGELOG.md gained entries under [Unreleased]. No version bump. The [docs-i18n] follow-up for the docs page is batched with the other pending pages rather than filed per PR.

UI evidence (if applicable)

Screenshots of the locked widget control with its line, the seed field rejecting a fractional value, the skipped-entry notice, and the legacy dialog for a package without a setup block, to be added by the author.

Summary by CodeRabbit

  • New Features

    • Experience-controlled HUD widget settings are enforced while active and restore the player’s previous choice when disabled.
    • Setup imports report lorebook entries unavailable locally.
    • World seeds support validated unsigned whole numbers from 0 to 4,294,967,295.
  • Bug Fixes

    • Setup imports preserve prefilled seeds when no valid seed is provided.
    • Invalid seed formats are rejected.
    • Escape dismisses only the topmost dialog when modals are stacked.
  • Documentation

    • Updated setup documentation and changelog entries.

🔄 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/6201 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/14/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/experience-setup-followups` --- ### 📝 Commits (10+) - [`00e1bb5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/00e1bb5b61f57ffd6e27f10735ffe6aff4e1abea) fix(game): enforce Experience custom widget requirement - [`bbf48e5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bbf48e51d9431b9fc905503e7c91a322c808bcd9) fix(game): accept only whole-number world seeds and keep imported seeds - [`cd5115a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd5115a4621f9c4eed5c65c375b138d31932b1ff) fix(game): keep Escape from dismissing setup behind a stacked dialog - [`808f0bc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/808f0bce132aaac0e570775eec9a5d460cf44d49) fix(game): report imported lorebook entries missing on this machine - [`ae5a5f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ae5a5f3737cd41fb9b61ae35c60620f184651205) fix(game): keep the player's widget setup choice across Experience toggles - [`66af4d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/66af4d469e983875826a406f8252adff6cbfbaf7) fix(game): word the locked widget line as approved - [`19e8b27`](https://github.com/Pasta-Devs/Marinara-Engine/commit/19e8b275406a484a2dcab283a71a3ff8582ed0bc) test(e2e): wait for the ordinary setup import before toggling the Experience - [`356d14c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/356d14cd4119b95b5c9f74932af700a5d6c448b0) docs: state the real Experience seed and import rules - [`29d9fcd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/29d9fcd91005620de54c117e3702fbd5d87e426d) docs(changelog): record the seed contract and the preserved imported seed - [`def84dc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/def84dc439ac85a919bb9f3a698ddb0d8028fc8e) test(e2e): give the Experience setup follow-up cases their own budgets ### 📊 Changes **14 files changed** (+683 additions, -170 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `docs/development/optional-agent-packages.md` (+14 -9) 📝 `e2e/game-experience-setup.e2e.ts` (+289 -118) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+36 -24) 📝 `packages/client/src/components/game/LegacyExperienceSetupDialog.tsx` (+6 -1) 📝 `packages/client/src/components/game/NewGameExperienceChooser.tsx` (+5 -2) 📝 `packages/client/src/components/ui/Modal.tsx` (+21 -2) 📝 `packages/client/src/lib/game-experience-setup.ts` (+14 -4) 📝 `packages/client/src/lib/game-setup-share.ts` (+2 -2) ➕ `packages/client/src/lib/modal-overlay-registry.ts` (+64 -0) 📝 `packages/client/src/localization/locales/en.json` (+7 -7) 📝 `scripts/regressions/experience-setup-config.regression.ts` (+2 -1) ➕ `scripts/regressions/game-experience-seed.regression.ts` (+102 -0) ➕ `scripts/regressions/setup-escape-overlay-guard.regression.ts` (+117 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6200 Follow-up to #6193 for #6181, built on #6193's merged head. It carries the parts of #6181 that #6193 did not, as listed on #6196 when that PR was closed as superseded. ## Why this change - #6193 shipped the Experience setup seam. A few parts of it do not match what the Pixelforge package owner ruled, and two of them are plain defects. This PR fixes those parts and nothing else. - **The widget requirement is enforced, not advisory.** #6193 treats an Experience's declared custom-widgets requirement as a default that yields the moment the player touches the control, and the line beside it says the setting can be changed. The package owner's ruling of 2026-09-14 is that a declared requirement is enforced while the Experience is on. The reason: an Experience-owned game never renders the widget rail, so an editable control only lets the server design widgets nobody sees and tells the Game Master to emit widget commands every turn. Enforcement must not cost the player anything, so their own earlier choice is kept untouched and handed back the moment the Experience is turned off. - **The seed is an unsigned whole number.** #6193 accepts any finite number in the seed field, so 1.5, -3, 1e3 and 0x10 are written into the package's config. The package reads the value as an unsigned integer, so the number the player sees can differ from the number the world is built from. Refusing bad input is visible; a silently different world is not. - **Importing an ordinary setup file blanked the prefilled seed.** A file with no Experience in it set the seed field to an empty string, and turning an Experience on afterwards blocked Start with no hint that Randomize fixes it. #6193's browser test never hit this because its import fixture always carries an Experience. - **Escape dismissed two dialogs at once.** With the malformed-JSON repair dialog open over the legacy Experience setup dialog, one press closed the repair dialog and cancelled the setup behind it, discarding the player's answers. - **Imported lore-entry picks that do not exist here were dropped silently**, while a missing Experience gets a notice. - **The active-Experience line still described the old model** ("{{name}} will run this game."), which the wizard change was meant to retire. - **Nothing in the browser lane proved the pre-seam fallback**: a game-surface package with no setup block must still get its own setup dialog. ## What changed 1. **Widget requirement enforced.** In `GameSetupWizard.tsx` the touched flag is gone and the value is derived: a declared requirement wins while its Experience is active, the player's own choice is stored separately and never overwritten, and it returns by itself when the Experience is turned off. The toggle is disabled while locked, with the file's existing disabled styling and an `aria-pressed` state. A setup-file import still restores the underlying choice but cannot unlock the control. The line beside it reads "{{name}} turns custom HUD widgets off for this game." (or "on"); the old override and state strings are removed. 2. **Seed contract.** `parseExperienceSeed` accepts an integer from 0 to 4294967295 or a digits-only string, and returns null for everything else. The module exports `MAX_EXPERIENCE_SEED` and an `isExperienceSeed` guard, the input uses `step=1 min=0 max=4294967295` instead of `step="any"`, and the invalid-seed message names the range. The share resolver uses the same guard, so an unusable stored seed never reaches the wizard. 3. **Imports keep the prefilled seed.** The seed field is replaced only when the imported file carries a usable seed for an installed Experience; otherwise the random default stays. 4. **Escape closes the top dialog only.** A small module-level count of open `Modal` overlays (`packages/client/src/lib/modal-overlay-registry.ts`) is registered by `Modal` while it is open, and the legacy dialog's window key handler returns early while anything is stacked above it. 5. **Experiences-block wording.** The two lines now describe the seam: "Play this game through a downloaded experience. The setup below still applies, and the experience adds its own controls here when it needs them." and "{{name}} is on for this game. It uses everything you set below, plus the settings shown here." 6. **Skipped-entry notice.** After a setup-file import, once every lorebook query has succeeded, a `role="status"` line reports how many of the file's selected entries are not available on this machine. It is held at zero while entries are loading or if the fetch failed, so a load error never reads as missing entries. 7. **Coverage.** New lanes `scripts/regressions/game-experience-seed.regression.ts` (accepted and refused seed inputs, the validator) and `scripts/regressions/setup-escape-overlay-guard.regression.ts` (the overlay registry and its call sites). The e2e spec gains the locked and restored widget control, a fractional seed blocking Start, an ordinary import keeping the seed, the skipped-entry notice, and a pre-seam fallback case where a package with no setup block still opens the legacy dialog and Back returns to the wizard. Docs and CHANGELOG match: the package-author seed paragraph states the real contract, the widget paragraph describes enforcement and restore, and the import paragraph covers the preserved seed and the skipped entries. ## 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 Run before opening, on the rebased tree: every piece of `pnpm check`, `pnpm version:check`, `git diff --check`, the lanes `experience-setup-config`, `game-experience-seed`, `setup-escape-overlay-guard`, `experience-lore-entries`, `capability-package-lifecycle`, `prompt`, `open-issues` and `assigned-issue-sweep`, `e2e/game-experience-setup.e2e.ts` on desktop and mobile Chromium, and a local CodeRabbit sweep. Mobile WebKit cannot launch on the author's Fedora host, so CI proves that lane. Still to verify by hand: - Manually verify that an Experience declaring a widget requirement sets the custom HUD widgets control, disables it, and shows the line naming that Experience; that clicking it does nothing; and that turning the Experience off re-enables it at the earlier value with the line gone. - Manually verify that importing a setup file while such an Experience is active does not unlock or change the locked control. - Manually verify that typing 1.5, -1, 1e3, 0x10, 12abc or 4294967296 into the world seed blocks Start with the range message, and that 0 and 4294967295 are accepted. - Manually verify that importing an ordinary Game Mode setup file leaves the prefilled random seed in place. - Manually verify that with a malformed-JSON repair dialog over Experience setup, one Escape closes only the repair dialog and the setup answers survive, and a second Escape closes setup. - Manually verify that importing a setup file referencing lorebook entries missing on this machine shows the skipped-entry count, and that no count appears while the picker is loading or after a load error. - Manually verify that a game-surface package with no setup block still opens the legacy setup dialog and that Back returns to the wizard. - Check light and dark mode and a narrow viewport for the locked toggle, the requirement line and the skipped-entry notice. ## 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) `docs/development/optional-agent-packages.md` changed (seed contract, enforced requirement, import rules) and `CHANGELOG.md` gained entries under `[Unreleased]`. No version bump. The `[docs-i18n]` follow-up for the docs page is batched with the other pending pages rather than filed per PR. ## UI evidence (if applicable) Screenshots of the locked widget control with its line, the seed field rejecting a fractional value, the skipped-entry notice, and the legacy dialog for a package without a setup block, to be added by the author. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Experience-controlled HUD widget settings are enforced while active and restore the player’s previous choice when disabled. - Setup imports report lorebook entries unavailable locally. - World seeds support validated unsigned whole numbers from 0 to 4,294,967,295. - **Bug Fixes** - Setup imports preserve prefilled seeds when no valid seed is provided. - Invalid seed formats are rejected. - Escape dismisses only the topmost dialog when modals are stacked. - **Documentation** - Updated setup documentation and changelog entries. <!-- 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:16:26 +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#7090
No description provided.