[PR #2218] [MERGED] Fix game asset prompt safeguards #5482

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2218
Author: @cha1latte
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2137-game-asset-prompts


📝 Commits (10+)

  • 51cdb00 Fix game asset prompt safeguards
  • 2bdaaf8 Record issue 2137 PR verification
  • c67d3f2 Merge upstream refactor into issue 2137 fix
  • bf27853 Tighten game asset nonhuman prompt cues
  • 40b67fa Broaden explicit animal subject cues
  • 6f72a33 Add game asset request payload coverage
  • fc15d5e Merge remote-tracking branch 'upstream/refactor' into fix/issue-2137-game-asset-prompts
  • 850e33f Remove duplicate storage type aliases
  • 7ce2c50 Merge upstream refactor into issue 2137 fix
  • bbecb7d Keep issue 2137 proof ledger focused

📊 Changes

3 files changed (+302 additions, -79 deletions)

View changed files

➕ src/features/modes/game/api/game-api.test.ts (+138 -0)
📝 src/features/modes/game/api/game-api.ts (+12 -79)
➕ src/features/modes/game/api/game-asset-prompts.ts (+152 -0)

📄 Description

Linked issue

Closes #2137

Why this change

  • Game mode asset generation regressed from the legacy web app by sending generated NPC/background/illustration image requests without per-kind negative prompts.
  • NPC portrait prompts also lost the species-preservation rule, making non-human NPCs more likely to render as humans and human NPCs with animal-like names more likely to drift into creature subjects.

What changed

  • Moved game asset prompt construction into game-asset-prompts.ts.
  • Restored per-kind negative prompts for portrait, background, and illustration requests and forwards them to imageGenerationApi.generate.
  • Restored NPC portrait species safeguards, including negative-control paths so human NPCs with animal-like names or costume descriptors stay human/humanoid by default.
  • Added focused regression coverage for negative prompts, request-payload forwarding, non-human description preservation, explicit non-human names, human-name negative controls, and tag-format prompts.

Refactor impact

Primary owner:

game mode

Impact areas reviewed:

  • Game asset prompt preview item construction.
  • Game asset generation request payloads.
  • Image-generation wrapper boundary.

Boundary notes:

  • Feature code still calls the existing shared imageGenerationApi wrapper; no raw Tauri or remote-runtime fetch was added.
  • No engine, Rust, storage, provider credential, schema, dependency, or release metadata changes.

Pressure points touched:

  • src/features/modes/game/api/game-api.ts
  • src/features/modes/game/api/game-asset-prompts.ts

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Codex proof: pnpm test src/features/modes/game/api/game-api.test.ts passed with 6 focused regression cases.
  • Codex proof: pnpm typecheck passed.
  • Codex proof: pnpm check passed after the final diff.
  • No image provider credential/manual generation test was needed for the core claim because this bug is proven at request-payload construction before provider dispatch.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix only; no new discoverable workflow or setting.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A. This is a non-UI request-payload regression; the proof is focused Vitest coverage of prompt construction and request-payload forwarding.

Summary by CodeRabbit

  • Tests

    • Added comprehensive test suite validating image generation prompt safeguards across asset types and negative prompt inclusion.
  • Refactor

    • Reorganized image prompt generation logic for improved consistency. Enhanced character portrait handling to better preserve species attributes and prevent unintended depictions.

🔄 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/2218 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2137-game-asset-prompts` --- ### 📝 Commits (10+) - [`51cdb00`](https://github.com/Pasta-Devs/Marinara-Engine/commit/51cdb00ad60e6051e413ae4a520317444cf746ba) Fix game asset prompt safeguards - [`2bdaaf8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2bdaaf8d21ecb3f01f1ddac2262c49d9555f15df) Record issue 2137 PR verification - [`c67d3f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c67d3f29f44a144b4add78df4195d4235396190e) Merge upstream refactor into issue 2137 fix - [`bf27853`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bf2785374ae1a5e938caf6d366c3dd749af24aae) Tighten game asset nonhuman prompt cues - [`40b67fa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/40b67fa10081006a0dcce04b3875ac6ddfb695cd) Broaden explicit animal subject cues - [`6f72a33`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6f72a339caafc0b76e48317ae8aa753084788e89) Add game asset request payload coverage - [`fc15d5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc15d5e776b914030463b2ab14bf9bc3a984bb91) Merge remote-tracking branch 'upstream/refactor' into fix/issue-2137-game-asset-prompts - [`850e33f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/850e33fdbd28892984d423134007a15d369dda61) Remove duplicate storage type aliases - [`7ce2c50`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7ce2c50d318d9fc0187b1521a1cbf19a6b5e13ea) Merge upstream refactor into issue 2137 fix - [`bbecb7d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bbecb7da98c4b3645f55f4f5f8ab1eadaa40bef9) Keep issue 2137 proof ledger focused ### 📊 Changes **3 files changed** (+302 additions, -79 deletions) <details> <summary>View changed files</summary> ➕ `src/features/modes/game/api/game-api.test.ts` (+138 -0) 📝 `src/features/modes/game/api/game-api.ts` (+12 -79) ➕ `src/features/modes/game/api/game-asset-prompts.ts` (+152 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #2137 ## Why this change - Game mode asset generation regressed from the legacy web app by sending generated NPC/background/illustration image requests without per-kind negative prompts. - NPC portrait prompts also lost the species-preservation rule, making non-human NPCs more likely to render as humans and human NPCs with animal-like names more likely to drift into creature subjects. ## What changed - Moved game asset prompt construction into `game-asset-prompts.ts`. - Restored per-kind negative prompts for portrait, background, and illustration requests and forwards them to `imageGenerationApi.generate`. - Restored NPC portrait species safeguards, including negative-control paths so human NPCs with animal-like names or costume descriptors stay human/humanoid by default. - Added focused regression coverage for negative prompts, request-payload forwarding, non-human description preservation, explicit non-human names, human-name negative controls, and tag-format prompts. ## Refactor impact Primary owner: game mode Impact areas reviewed: - Game asset prompt preview item construction. - Game asset generation request payloads. - Image-generation wrapper boundary. Boundary notes: - Feature code still calls the existing shared `imageGenerationApi` wrapper; no raw Tauri or remote-runtime fetch was added. - No engine, Rust, storage, provider credential, schema, dependency, or release metadata changes. Pressure points touched: - `src/features/modes/game/api/game-api.ts` - `src/features/modes/game/api/game-asset-prompts.ts` ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - Codex proof: `pnpm test src/features/modes/game/api/game-api.test.ts` passed with 6 focused regression cases. - Codex proof: `pnpm typecheck` passed. - Codex proof: `pnpm check` passed after the final diff. - No image provider credential/manual generation test was needed for the core claim because this bug is proven at request-payload construction before provider dispatch. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix only; no new discoverable workflow or setting. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A. This is a non-UI request-payload regression; the proof is focused Vitest coverage of prompt construction and request-payload forwarding. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test suite validating image generation prompt safeguards across asset types and negative prompt inclusion. * **Refactor** * Reorganized image prompt generation logic for improved consistency. Enhanced character portrait handling to better preserve species attributes and prevent unintended depictions. <!-- 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-22 04:16:43 +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#5482
No description provided.