[PR #1579] [MERGED] Restore practical Knip export contracts #5125

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

📋 Pull Request Information

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

Base: refactor ← Head: restore/knip-export-contracts


📝 Commits (10+)

  • ed052c7 Restore remote profile JSON import
  • fe15cd6 Use integration facade for TTS API
  • 5c988b3 Narrow local asset helper exports
  • 38590b0 Remove unused asset gateway facade
  • 3e02fb3 Narrow tracker card color internals
  • 835e3c2 Restore shared lorebook entry detection
  • 67f886e Restore agent retry failure toast
  • 2d7f70d Restore shared quote format options
  • 87c8723 Narrow TTS dialogue internals
  • 1e3bf8c Narrow shared helper internals

📊 Changes

31 files changed (+503 additions, -315 deletions)

View changed files

➖ src/engine/capabilities/assets.ts (+0 -9)
📝 src/features/modes/conversation/components/ConversationInput.tsx (+2 -11)
📝 src/features/modes/shared/chat-ui/components/ChatInput.tsx (+2 -10)
📝 src/features/runtime/generation/hooks/use-generate.ts (+19 -1)
📝 src/features/runtime/tracker/components/tracker-metadata.helpers.ts (+0 -18)
📝 src/features/runtime/tracker/hooks/use-featured-character-cards.ts (+1 -1)
📝 src/features/runtime/tracker/hooks/use-tracker-panel-model.ts (+5 -2)
📝 src/features/shell/bot-browser/components/BotBrowserView.tsx (+1 -7)
➕ src/features/shell/settings/components/ProfileImportSection.test.tsx (+140 -0)
📝 src/features/shell/settings/components/ProfileImportSection.tsx (+138 -79)
📝 src/features/shell/settings/components/SettingsPanel.tsx (+10 -4)
📝 src/shared/api/assets-api.ts (+1 -13)
📝 src/shared/api/integration-utility-api.ts (+1 -1)
📝 src/shared/api/local-file-api.ts (+5 -18)
📝 src/shared/api/profile-api.ts (+7 -7)
📝 src/shared/components/ui/SpriteFrameEditor.tsx (+1 -46)
📝 src/shared/components/ui/SpriteGenerationModal.tsx (+1 -42)
📝 src/shared/hooks/use-tts.ts (+1 -1)
📝 src/shared/lib/agent-cadence.ts (+1 -1)
📝 src/shared/lib/backgrounds.ts (+0 -4)

...and 11 more files

📄 Description

Linked issue

Refs #1566

Why this change

  • Continue the practical Knip restoration work by wiring useful shared helpers back into real call sites and narrowing exports that are implementation-only.
  • Reduce false public API surface while preserving behavior across profile import, chat input, sprite cropping, tracker metadata, TTS, and retry feedback paths.

What changed

  • Restored remote-runtime JSON profile import through profileApi.importProfile, while keeping native JSON/ZIP import on the local file-path command.
  • Added invalid Remote Runtime URL protection for profile import UI and JSON-only copy for remote import parse errors.
  • Reused shared helpers for chat input attachments, chat macros, sprite frame crop, tracker metadata normalization, lorebook entry detection, quote format options, and agent retry failure toasts.
  • Narrowed implementation-only exports in local asset helpers, tracker card color helpers, TTS dialogue helpers, local notifications, connection filters, TTS cache, and related utility modules.
  • Removed the unused generic asset gateway facade while keeping the focused gameAssetsApi and visual asset APIs.
  • Added focused tests for profile import remote URL handling, chat macro input resolution, and shared blob/data URL handling.

Refactor impact

Primary owner:

Shared frontend helpers/API, shell settings profile import, chat input UI, runtime generation/tracker helpers.

Impact areas reviewed:

  • Settings profile import native and remote-runtime entrypoints.
  • Chat and shared chat UI input handling, regex macro resolution, translation pass, and attachment reads.
  • Runtime generation retry feedback, tracker metadata normalization, sprite frame crop UI, TTS service/hook imports, and local asset URL helpers.
  • Shared API export surface and Knip-reported public helpers.

Boundary notes:

  • Feature code continues to call shared wrappers/helpers; no raw Tauri or remote-runtime fetches were added.
  • Remote profile import uses the existing profile_import shared API/HTTP dispatch path; local JSON/ZIP import stays on profile_import_file.
  • No Rust command registration or Rust capability implementation changed.
  • Engine asset capability removal only deletes an unused port/facade with no remaining callers.

Pressure points touched:

  • Shared mode UI chat input was touched for macro and attachment helper wiring.
  • Settings import UI was touched for native/remote profile import behavior.
  • No ModeSurface, GameSurface, or src-tauri/src/lib.rs command registration changes.

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

Commands run after rebasing onto current origin/refactor:

  • pnpm test src/features/shell/settings/components/ProfileImportSection.test.tsx --run
  • pnpm test src/shared/lib/chat-macros.test.ts --run
  • pnpm test src/shared/lib/url-blob.test.ts --run
  • pnpm typecheck
  • pnpm check:architecture
  • pnpm lint:eslint
  • pnpm check:unused
  • pnpm build passed with the existing large-chunk warning
  • git diff --check
  • pnpm exec knip --exports --no-config-hints for export-count snapshot; targeted restored/narrowed helpers were not reported

Not manually verified in the native app: Tauri file dialog import flow and remote runtime smoke.

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 changelog update was made because this checkout has no CHANGELOG.md; the branch is mostly internal refactor/export restoration with focused behavior restored for remote JSON profile import.

UI evidence

No screenshots or recordings added. The profile import UI behavior is covered by a focused jsdom component test; native file dialog and remote runtime behavior still need human/manual app QA.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved error notifications when agent retries fail—users now see formatted error messages via toast alerts.
    • Enhanced profile import error handling with context-aware messaging and better file validation feedback.
  • Refactor

    • Reorganized internal API structure to consolidate asset and profile operations into shared objects for improved maintainability.
    • Moved sprite-frame cropping logic to shared utilities for reuse across components.
  • Tests

    • Added test coverage for profile import validation with invalid Remote Runtime URLs.
    • Expanded chat macro tests to verify macro resolution and resolver stability.

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/1579 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `restore/knip-export-contracts` --- ### 📝 Commits (10+) - [`ed052c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed052c75976e1f88d054cff325024c740eacea08) Restore remote profile JSON import - [`fe15cd6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe15cd6cc82c792ed5b0c95853bfc8720732c38b) Use integration facade for TTS API - [`5c988b3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c988b3a31c00cdc66a2527bd0fc5998e1a6c8e1) Narrow local asset helper exports - [`38590b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/38590b0c468962cf2fe07f6ed9c64d3ec5436432) Remove unused asset gateway facade - [`3e02fb3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3e02fb38b453beb417415a3cb5025c1a7746c652) Narrow tracker card color internals - [`835e3c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/835e3c25889453ee99208589fe445acb7144d661) Restore shared lorebook entry detection - [`67f886e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/67f886e37a82ae61d3aa395277cd94c1582aa9bf) Restore agent retry failure toast - [`2d7f70d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2d7f70dbca665e7674a64be0d3502a88bafb3c45) Restore shared quote format options - [`87c8723`](https://github.com/Pasta-Devs/Marinara-Engine/commit/87c87234da4c2bd0633084e7efdc141c96a8ab1d) Narrow TTS dialogue internals - [`1e3bf8c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1e3bf8c68cfc939536be77badc16a7c6716f7d45) Narrow shared helper internals ### 📊 Changes **31 files changed** (+503 additions, -315 deletions) <details> <summary>View changed files</summary> ➖ `src/engine/capabilities/assets.ts` (+0 -9) 📝 `src/features/modes/conversation/components/ConversationInput.tsx` (+2 -11) 📝 `src/features/modes/shared/chat-ui/components/ChatInput.tsx` (+2 -10) 📝 `src/features/runtime/generation/hooks/use-generate.ts` (+19 -1) 📝 `src/features/runtime/tracker/components/tracker-metadata.helpers.ts` (+0 -18) 📝 `src/features/runtime/tracker/hooks/use-featured-character-cards.ts` (+1 -1) 📝 `src/features/runtime/tracker/hooks/use-tracker-panel-model.ts` (+5 -2) 📝 `src/features/shell/bot-browser/components/BotBrowserView.tsx` (+1 -7) ➕ `src/features/shell/settings/components/ProfileImportSection.test.tsx` (+140 -0) 📝 `src/features/shell/settings/components/ProfileImportSection.tsx` (+138 -79) 📝 `src/features/shell/settings/components/SettingsPanel.tsx` (+10 -4) 📝 `src/shared/api/assets-api.ts` (+1 -13) 📝 `src/shared/api/integration-utility-api.ts` (+1 -1) 📝 `src/shared/api/local-file-api.ts` (+5 -18) 📝 `src/shared/api/profile-api.ts` (+7 -7) 📝 `src/shared/components/ui/SpriteFrameEditor.tsx` (+1 -46) 📝 `src/shared/components/ui/SpriteGenerationModal.tsx` (+1 -42) 📝 `src/shared/hooks/use-tts.ts` (+1 -1) 📝 `src/shared/lib/agent-cadence.ts` (+1 -1) 📝 `src/shared/lib/backgrounds.ts` (+0 -4) _...and 11 more files_ </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 Refs #1566 ## Why this change - Continue the practical Knip restoration work by wiring useful shared helpers back into real call sites and narrowing exports that are implementation-only. - Reduce false public API surface while preserving behavior across profile import, chat input, sprite cropping, tracker metadata, TTS, and retry feedback paths. ## What changed - Restored remote-runtime JSON profile import through `profileApi.importProfile`, while keeping native JSON/ZIP import on the local file-path command. - Added invalid Remote Runtime URL protection for profile import UI and JSON-only copy for remote import parse errors. - Reused shared helpers for chat input attachments, chat macros, sprite frame crop, tracker metadata normalization, lorebook entry detection, quote format options, and agent retry failure toasts. - Narrowed implementation-only exports in local asset helpers, tracker card color helpers, TTS dialogue helpers, local notifications, connection filters, TTS cache, and related utility modules. - Removed the unused generic asset gateway facade while keeping the focused `gameAssetsApi` and visual asset APIs. - Added focused tests for profile import remote URL handling, chat macro input resolution, and shared blob/data URL handling. ## Refactor impact Primary owner: Shared frontend helpers/API, shell settings profile import, chat input UI, runtime generation/tracker helpers. Impact areas reviewed: - Settings profile import native and remote-runtime entrypoints. - Chat and shared chat UI input handling, regex macro resolution, translation pass, and attachment reads. - Runtime generation retry feedback, tracker metadata normalization, sprite frame crop UI, TTS service/hook imports, and local asset URL helpers. - Shared API export surface and Knip-reported public helpers. Boundary notes: - Feature code continues to call shared wrappers/helpers; no raw Tauri or remote-runtime fetches were added. - Remote profile import uses the existing `profile_import` shared API/HTTP dispatch path; local JSON/ZIP import stays on `profile_import_file`. - No Rust command registration or Rust capability implementation changed. - Engine asset capability removal only deletes an unused port/facade with no remaining callers. Pressure points touched: - Shared mode UI chat input was touched for macro and attachment helper wiring. - Settings import UI was touched for native/remote profile import behavior. - No `ModeSurface`, `GameSurface`, or `src-tauri/src/lib.rs` command registration changes. ## Validation - [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 - [ ] `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 Commands run after rebasing onto current `origin/refactor`: - `pnpm test src/features/shell/settings/components/ProfileImportSection.test.tsx --run` - `pnpm test src/shared/lib/chat-macros.test.ts --run` - `pnpm test src/shared/lib/url-blob.test.ts --run` - `pnpm typecheck` - `pnpm check:architecture` - `pnpm lint:eslint` - `pnpm check:unused` - `pnpm build` passed with the existing large-chunk warning - `git diff --check` - `pnpm exec knip --exports --no-config-hints` for export-count snapshot; targeted restored/narrowed helpers were not reported Not manually verified in the native app: Tauri file dialog import flow and remote runtime smoke. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No changelog update was made because this checkout has no `CHANGELOG.md`; the branch is mostly internal refactor/export restoration with focused behavior restored for remote JSON profile import. ## UI evidence No screenshots or recordings added. The profile import UI behavior is covered by a focused jsdom component test; native file dialog and remote runtime behavior still need human/manual app QA. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved error notifications when agent retries fail—users now see formatted error messages via toast alerts. * Enhanced profile import error handling with context-aware messaging and better file validation feedback. * **Refactor** * Reorganized internal API structure to consolidate asset and profile operations into shared objects for improved maintainability. * Moved sprite-frame cropping logic to shared utilities for reuse across components. * **Tests** * Added test coverage for profile import validation with invalid Remote Runtime URLs. * Expanded chat macro tests to verify macro resolution and resolver stability. <!-- 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/1579?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:31 +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#5125
No description provided.