[PR #1719] [MERGED] Fix eager TTS and regex reads #5231

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1719
Author: @Promansis
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @Promansis

Base: refactor ← Head: fix/issue-1715-eager-tts-regex-reads


📝 Commits (1)

  • d36dce5 Fix eager TTS and regex reads

📊 Changes

4 files changed (+111 additions, -2 deletions)

View changed files

📝 src/features/catalog/agents/hooks/use-regex-scripts.ts (+3 -0)
📝 src/features/modes/shared/chat-ui/components/ChatMessage.tsx (+2 -2)
➕ src/shared/hooks/use-tts.test.tsx (+98 -0)
📝 src/shared/hooks/use-tts.ts (+8 -0)

📄 Description

Linked issue

Closes #1715

Why this change

  • Large chat timelines could trigger eager tts_config reads from passive message render consumers, and regex script reads were refetching more aggressively than needed.

What changed

  • Added a cache-only TTS config hook for chat message controls so rendered messages subscribe to existing query data without owning the config read.
  • Switched shared chat messages to use the cache-only TTS config hook.
  • Increased regex script query freshness and disabled window-focus refetch while preserving mutation invalidation.
  • Added regression coverage for cache-only TTS config consumers.

Refactor impact

Primary owner:

shared mode UI, shared hooks, catalog agents

Impact areas reviewed:

  • Conversation and roleplay chat message TTS controls
  • TTS config loading ownership in autoplay/settings surfaces
  • Regex script query invalidation paths for create, update, reorder, and delete

Boundary notes:

  • Shared chat UI still uses shared hooks and shared API-backed hooks only.
  • TTS command ownership remains behind src/shared/api/tts-api.ts.
  • Regex scripts still load through the catalog hook and storageApi.
  • No Rust, engine, or remote-runtime boundary changes.

Pressure points touched:

  • src/features/modes/shared/chat-ui/components/ChatMessage.tsx
  • src/shared/hooks/use-tts.ts
  • src/features/catalog/agents/hooks/use-regex-scripts.ts

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

  • Agent ran git diff --check upstream/refactor...HEAD: no whitespace errors.
  • Agent ran pnpm exec vitest run src/shared/hooks/use-tts.test.tsx src/features/catalog/agents/regex-application.test.tsx src/features/modes/shared/chat-ui/components/ChatMessage.test.ts: 3 test files passed, 9 tests passed.
  • Agent ran pnpm typecheck: passed.
  • No browser/Tauri manual verification was performed.

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

No screenshots or recordings; this changes query ownership and caching behavior without a visible UI redesign.


🔄 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/1719 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/issue-1715-eager-tts-regex-reads` --- ### 📝 Commits (1) - [`d36dce5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d36dce5406313fab53439ff158e9f933358389eb) Fix eager TTS and regex reads ### 📊 Changes **4 files changed** (+111 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/features/catalog/agents/hooks/use-regex-scripts.ts` (+3 -0) 📝 `src/features/modes/shared/chat-ui/components/ChatMessage.tsx` (+2 -2) ➕ `src/shared/hooks/use-tts.test.tsx` (+98 -0) 📝 `src/shared/hooks/use-tts.ts` (+8 -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 #1715 ## Why this change - Large chat timelines could trigger eager `tts_config` reads from passive message render consumers, and regex script reads were refetching more aggressively than needed. ## What changed - Added a cache-only TTS config hook for chat message controls so rendered messages subscribe to existing query data without owning the config read. - Switched shared chat messages to use the cache-only TTS config hook. - Increased regex script query freshness and disabled window-focus refetch while preserving mutation invalidation. - Added regression coverage for cache-only TTS config consumers. ## Refactor impact Primary owner: shared mode UI, shared hooks, catalog agents Impact areas reviewed: - Conversation and roleplay chat message TTS controls - TTS config loading ownership in autoplay/settings surfaces - Regex script query invalidation paths for create, update, reorder, and delete Boundary notes: - Shared chat UI still uses shared hooks and shared API-backed hooks only. - TTS command ownership remains behind `src/shared/api/tts-api.ts`. - Regex scripts still load through the catalog hook and `storageApi`. - No Rust, engine, or remote-runtime boundary changes. Pressure points touched: - `src/features/modes/shared/chat-ui/components/ChatMessage.tsx` - `src/shared/hooks/use-tts.ts` - `src/features/catalog/agents/hooks/use-regex-scripts.ts` ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [x] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [x] Rust clippy/tests were run for Rust behavior changes - [x] 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 - Agent ran `git diff --check upstream/refactor...HEAD`: no whitespace errors. - Agent ran `pnpm exec vitest run src/shared/hooks/use-tts.test.tsx src/features/catalog/agents/regex-application.test.tsx src/features/modes/shared/chat-ui/components/ChatMessage.test.ts`: 3 test files passed, 9 tests passed. - Agent ran `pnpm typecheck`: passed. - No browser/Tauri manual verification was performed. ## Docs and release impact - [x] 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 No screenshots or recordings; this changes query ownership and caching behavior without a visible UI redesign. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:14: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#5231
No description provided.