[PR #4862] [MERGED] refactor: simplify internal utility ownership #6522

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4862
Author: @Xelvanis
Created: 8/10/2026
Status: ✅ Merged
Merged: 8/10/2026
Merged by: @SpicyMarinara

Base: staging ← Head: chore/internal-simplification-batch


📝 Commits (6)

  • 07c1713 refactor: inline tool registry generation
  • fe3db94 refactor: centralize card prompt text normalization
  • 3d09c64 refactor: remove duplicate terrain export
  • f785b9e refactor: remove inline thinking re-export
  • 047e7a5 test: tolerate formatted retry batch call
  • 4736805 Merge branch 'staging' into chore/internal-simplification-batch

📊 Changes

18 files changed (+37 additions, -89 deletions)

View changed files

📝 packages/server/src/routes/chats.routes.ts (+1 -5)
📝 packages/server/src/routes/encounter.routes.ts (+2 -5)
📝 packages/server/src/routes/game.routes.ts (+1 -1)
📝 packages/server/src/routes/generate.routes.ts (+2 -2)
📝 packages/server/src/routes/generate/dry-run-route.ts (+1 -5)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+1 -5)
📝 packages/server/src/routes/lorebooks.routes.ts (+1 -5)
📝 packages/server/src/routes/prompts.routes.ts (+1 -5)
📝 packages/server/src/services/generation/character-prompt-context.ts (+1 -1)
📝 packages/server/src/services/generation/game-gm-prompt-runtime.ts (+1 -1)
📝 packages/server/src/services/generation/generation-text-utils.ts (+0 -5)
➖ packages/server/src/services/llm/inline-thinking.ts (+0 -2)
➕ packages/server/src/services/prompt/card-text.ts (+5 -0)
📝 packages/server/src/services/prompt/marker-expander.ts (+1 -5)
📝 packages/server/src/services/turn-games/turn-game-bot-runner.service.ts (+1 -2)
📝 packages/shared/scripts/generate-feature-registries.mjs (+17 -38)
📝 packages/shared/src/features/tactical-combat/index.ts (+0 -1)
📝 scripts/regressions/prompt.regression.ts (+1 -1)

📄 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 #4861

Why this change

  • Remove duplicated internal ownership and forwarding surfaces while preserving current behavior.
  • Restore the aggregate prompt regression lane, which failed because one source assertion was sensitive to multiline formatting.

What changed

  • Inlined the feature registry's sole fixed writer recipe while preserving byte-identical generated output.
  • Consolidated all exact cardPromptText implementations under one neutral prompt-layer owner.
  • Removed the redundant explicit TERRAIN_DATA re-export.
  • Removed the server-local inline-thinking forwarding file and imported the shared implementation directly.
  • Allowed whitespace before the unchanged first argument in the retry-batch source assertion.

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

Additional regression proof:

  • pnpm regression:prompt — passed, including prompt attachments and context fitting.
  • pnpm regression:spatial — passed both spatial regression scripts.
  • Generated tool registry output remained byte-for-byte identical.
  • git diff --check origin/staging..HEAD — passed.
  • Independent code review and Bunny closure completed with no outstanding findings.

Manual verification notes

  • Not run: this is internal source and regression maintenance with no UI, browser state, or interaction change.

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)

Not applicable; no UI changes.

Summary by CodeRabbit

  • Refactor

    • Centralized prompt text processing for consistent trimming and comment handling across chats, encounters, prompts, lorebooks, and generation workflows.
    • Consolidated thinking-block processing through a shared service.
    • Simplified built-in tool registry generation.
    • Streamlined public APIs by removing obsolete exports.
  • Bug Fixes

    • Improved consistency when preparing prompt content and handling non-text values.
  • Tests

    • Updated regression coverage to tolerate formatting variations in retry execution calls.

🔄 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/4862 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 8/10/2026 **Status:** ✅ Merged **Merged:** 8/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `chore/internal-simplification-batch` --- ### 📝 Commits (6) - [`07c1713`](https://github.com/Pasta-Devs/Marinara-Engine/commit/07c171348a9c8acbe04f9c62a5c1fbe1da3c9df5) refactor: inline tool registry generation - [`fe3db94`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe3db9472f4e8f276ff95a646fe660171f7acd74) refactor: centralize card prompt text normalization - [`3d09c64`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3d09c64329e51b66990ac832b82b37d937e274aa) refactor: remove duplicate terrain export - [`f785b9e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f785b9e81a4e447258c6dc7571fd5c0fedc39372) refactor: remove inline thinking re-export - [`047e7a5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/047e7a5a7a3a71ef9d4b942fcc01264257d058ce) test: tolerate formatted retry batch call - [`4736805`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4736805fe2ac4f30b5f87752882358aa22aef74a) Merge branch 'staging' into chore/internal-simplification-batch ### 📊 Changes **18 files changed** (+37 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/chats.routes.ts` (+1 -5) 📝 `packages/server/src/routes/encounter.routes.ts` (+2 -5) 📝 `packages/server/src/routes/game.routes.ts` (+1 -1) 📝 `packages/server/src/routes/generate.routes.ts` (+2 -2) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+1 -5) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+1 -5) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+1 -5) 📝 `packages/server/src/routes/prompts.routes.ts` (+1 -5) 📝 `packages/server/src/services/generation/character-prompt-context.ts` (+1 -1) 📝 `packages/server/src/services/generation/game-gm-prompt-runtime.ts` (+1 -1) 📝 `packages/server/src/services/generation/generation-text-utils.ts` (+0 -5) ➖ `packages/server/src/services/llm/inline-thinking.ts` (+0 -2) ➕ `packages/server/src/services/prompt/card-text.ts` (+5 -0) 📝 `packages/server/src/services/prompt/marker-expander.ts` (+1 -5) 📝 `packages/server/src/services/turn-games/turn-game-bot-runner.service.ts` (+1 -2) 📝 `packages/shared/scripts/generate-feature-registries.mjs` (+17 -38) 📝 `packages/shared/src/features/tactical-combat/index.ts` (+0 -1) 📝 `scripts/regressions/prompt.regression.ts` (+1 -1) </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 #4861 ## Why this change - Remove duplicated internal ownership and forwarding surfaces while preserving current behavior. - Restore the aggregate prompt regression lane, which failed because one source assertion was sensitive to multiline formatting. ## What changed - Inlined the feature registry's sole fixed writer recipe while preserving byte-identical generated output. - Consolidated all exact `cardPromptText` implementations under one neutral prompt-layer owner. - Removed the redundant explicit `TERRAIN_DATA` re-export. - Removed the server-local inline-thinking forwarding file and imported the shared implementation directly. - Allowed whitespace before the unchanged first argument in the retry-batch source assertion. ## Validation - [x] `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` Additional regression proof: - `pnpm regression:prompt` — passed, including prompt attachments and context fitting. - `pnpm regression:spatial` — passed both spatial regression scripts. - Generated tool registry output remained byte-for-byte identical. - `git diff --check origin/staging..HEAD` — passed. - Independent code review and Bunny closure completed with no outstanding findings. ### Manual verification notes - Not run: this is internal source and regression maintenance with no UI, browser state, or interaction change. ## Docs and release impact - [x] 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) Not applicable; no UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Centralized prompt text processing for consistent trimming and comment handling across chats, encounters, prompts, lorebooks, and generation workflows. - Consolidated thinking-block processing through a shared service. - Simplified built-in tool registry generation. - Streamlined public APIs by removing obsolete exports. - **Bug Fixes** - Improved consistency when preparing prompt content and handling non-text values. - **Tests** - Updated regression coverage to tolerate formatting variations in retry execution calls. <!-- 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:11:14 +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#6522
No description provided.