[PR #1417] [MERGED] Consolidate engine string reader helper #5082

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

📋 Pull Request Information

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

Base: refactor ← Head: chore/engine-helper-consolidation


📝 Commits (3)

  • 1429f2e Consolidate engine string reader helper
  • f49e345 Keep runtime string reader test in generation
  • a96a2e7 Merge branch 'refactor' into chore/engine-helper-consolidation

📊 Changes

9 files changed (+37 additions, -25 deletions)

View changed files

📝 src/engine/generation/prompt-reviewer.ts (+1 -4)
➕ src/engine/generation/runtime-records.test.ts (+9 -0)
📝 src/engine/generation/runtime-records.ts (+4 -4)
📝 src/engine/modes/chat/core/summaries/auto-summary.service.ts (+1 -5)
📝 src/engine/modes/chat/schedules/schedule.service.ts (+1 -4)
📝 src/engine/modes/roleplay/encounter/encounter-service.ts (+1 -4)
📝 src/engine/modes/roleplay/scene/scene-service.ts (+1 -4)
➕ src/engine/shared/value-readers.test.ts (+16 -0)
➕ src/engine/shared/value-readers.ts (+3 -0)

📄 Description

Linked issue

No linked GitHub issue. This came from the local chore queue item 2026-05-27-engine-duplicate-helper-consolidation.

Why this change

  • Consolidates repeated engine string-reader helpers into one pure lower-layer helper so chat, roleplay, and generation code do not keep duplicate stringValue implementations.

What changed

  • Added src/engine/shared/value-readers.ts with the shared readString helper.
  • Re-exported readString from src/engine/generation/runtime-records.ts so existing generation imports keep working.
  • Migrated prompt review, chat summaries, chat schedules, roleplay scenes, and roleplay encounters to the shared helper.
  • Added focused tests for direct helper behavior and the existing runtime-records compatibility export.

Refactor impact

Primary owner:

Engine shared primitive / generation compatibility.

Impact areas reviewed:

  • src/engine/shared
  • src/engine/generation/runtime-records.ts
  • src/engine/generation/prompt-reviewer.ts
  • src/engine/modes/chat/core/summaries/auto-summary.service.ts
  • src/engine/modes/chat/schedules/schedule.service.ts
  • src/engine/modes/roleplay/scene/scene-service.ts
  • src/engine/modes/roleplay/encounter/encounter-service.ts

Boundary notes:

  • Engine-only TypeScript cleanup.
  • No React, shared API, Tauri, Rust, storage, provider transport, or remote-runtime boundary changes.
  • readString stays in src/engine/shared as a pure deterministic helper. The generation re-export preserves existing import compatibility without moving ownership upward.

Pressure points touched:

  • None. This does not touch ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs, or import modules.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Ran pnpm test -- src/engine/shared/value-readers.test.ts src/engine/generation/runtime-records.test.ts after rebasing onto current origin/refactor; 2 files passed, 3 tests passed.
  • Ran pnpm typecheck; passed.
  • Ran pnpm check:architecture; passed with no dependency violations and Rust structure check passed.
  • Ran pnpm build; passed. Vite still reports existing dynamic-import and large-chunk warnings unrelated to this change.
  • Ran git diff --check origin/refactor...HEAD; passed.
  • No browser or Tauri manual verification was run because this is an engine-only helper cleanup with no visible UI, native, Rust, or remote-runtime behavior.

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

No repo changelog file is present, and this cleanup is not user-facing or release-note-worthy. No docs changes were made.

UI evidence

N/A. No UI behavior changed.

Summary by CodeRabbit

  • Refactor

    • Consolidated duplicate string-reading logic across multiple modules into a shared utility for improved maintainability.
  • Tests

    • Added comprehensive test coverage for the new shared utility and its re-exports.

Review Change Stack


🔄 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/1417 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `refactor` ← **Head:** `chore/engine-helper-consolidation` --- ### 📝 Commits (3) - [`1429f2e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1429f2ebd0de835d642f79df0ddda6707f345fa4) Consolidate engine string reader helper - [`f49e345`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f49e3450303c32419ddd342448970215d6c64b08) Keep runtime string reader test in generation - [`a96a2e7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a96a2e7a2cfcf7e6f765a30b4e0b69959f17f6b6) Merge branch 'refactor' into chore/engine-helper-consolidation ### 📊 Changes **9 files changed** (+37 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/prompt-reviewer.ts` (+1 -4) ➕ `src/engine/generation/runtime-records.test.ts` (+9 -0) 📝 `src/engine/generation/runtime-records.ts` (+4 -4) 📝 `src/engine/modes/chat/core/summaries/auto-summary.service.ts` (+1 -5) 📝 `src/engine/modes/chat/schedules/schedule.service.ts` (+1 -4) 📝 `src/engine/modes/roleplay/encounter/encounter-service.ts` (+1 -4) 📝 `src/engine/modes/roleplay/scene/scene-service.ts` (+1 -4) ➕ `src/engine/shared/value-readers.test.ts` (+16 -0) ➕ `src/engine/shared/value-readers.ts` (+3 -0) </details> ### 📄 Description ## Linked issue No linked GitHub issue. This came from the local chore queue item `2026-05-27-engine-duplicate-helper-consolidation`. ## Why this change - Consolidates repeated engine string-reader helpers into one pure lower-layer helper so chat, roleplay, and generation code do not keep duplicate `stringValue` implementations. ## What changed - Added `src/engine/shared/value-readers.ts` with the shared `readString` helper. - Re-exported `readString` from `src/engine/generation/runtime-records.ts` so existing generation imports keep working. - Migrated prompt review, chat summaries, chat schedules, roleplay scenes, and roleplay encounters to the shared helper. - Added focused tests for direct helper behavior and the existing `runtime-records` compatibility export. ## Refactor impact Primary owner: Engine shared primitive / generation compatibility. Impact areas reviewed: - `src/engine/shared` - `src/engine/generation/runtime-records.ts` - `src/engine/generation/prompt-reviewer.ts` - `src/engine/modes/chat/core/summaries/auto-summary.service.ts` - `src/engine/modes/chat/schedules/schedule.service.ts` - `src/engine/modes/roleplay/scene/scene-service.ts` - `src/engine/modes/roleplay/encounter/encounter-service.ts` Boundary notes: - Engine-only TypeScript cleanup. - No React, shared API, Tauri, Rust, storage, provider transport, or remote-runtime boundary changes. - `readString` stays in `src/engine/shared` as a pure deterministic helper. The generation re-export preserves existing import compatibility without moving ownership upward. Pressure points touched: - None. This does not touch `ModeSurface`, `GameSurface`, shared mode UI, `src-tauri/src/lib.rs`, or import modules. ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Ran `pnpm test -- src/engine/shared/value-readers.test.ts src/engine/generation/runtime-records.test.ts` after rebasing onto current `origin/refactor`; 2 files passed, 3 tests passed. - Ran `pnpm typecheck`; passed. - Ran `pnpm check:architecture`; passed with no dependency violations and Rust structure check passed. - Ran `pnpm build`; passed. Vite still reports existing dynamic-import and large-chunk warnings unrelated to this change. - Ran `git diff --check origin/refactor...HEAD`; passed. - No browser or Tauri manual verification was run because this is an engine-only helper cleanup with no visible UI, native, Rust, or remote-runtime behavior. ## 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 No repo changelog file is present, and this cleanup is not user-facing or release-note-worthy. No docs changes were made. ## UI evidence N/A. No UI behavior changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Consolidated duplicate string-reading logic across multiple modules into a shared utility for improved maintainability. * **Tests** * Added comprehensive test coverage for the new shared utility and its re-exports. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1417?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:13:03 +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#5082
No description provided.