[PR #1732] [MERGED] Fix preset Save & close async ordering #5243

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1701-preset-save-close


📝 Commits (4)

  • 45ce5d4 Fix preset save and close ordering
  • f35fec8 Fix agent editor test mock
  • 3bfb2ca Label preset save error dismiss button
  • 6aec930 Clean up unused exports for CI

📊 Changes

29 files changed (+241 additions, -779 deletions)

View changed files

📝 src/engine/contracts/constants/agent-activation.ts (+1 -1)
📝 src/engine/generation-core/llm/inline-thinking.ts (+0 -56)
📝 src/engine/generation/generate-route-utils.ts (+1 -1)
📝 src/engine/generation/tools-runtime.ts (+1 -1)
📝 src/engine/mari/mari-history.ts (+1 -1)
📝 src/engine/modes/game/assets/npc-avatar-utils.ts (+1 -1)
➖ src/engine/modes/game/state/segment-edits.ts (+0 -426)
📝 src/engine/shared/game-state/player-stats.ts (+1 -1)
📝 src/engine/shared/scoring/skill-check-format.ts (+0 -14)
📝 src/features/catalog/agents/components/AgentEditor.test.tsx (+1 -0)
📝 src/features/catalog/characters/hooks/use-characters.test.ts (+1 -108)
📝 src/features/catalog/characters/hooks/use-characters.ts (+0 -19)
📝 src/features/catalog/characters/lib/character-import-file-classifier.ts (+1 -1)
📝 src/features/catalog/characters/lib/character-search.ts (+0 -59)
📝 src/features/catalog/characters/lib/characters-panel-model.ts (+1 -1)
📝 src/features/catalog/chat-presets/hooks/use-chat-presets.ts (+1 -1)
📝 src/features/catalog/gallery/hooks/use-gallery.ts (+4 -4)
📝 src/features/catalog/personas/lib/personas-panel-model.ts (+1 -1)
➕ src/features/catalog/presets/components/PresetEditor.test.tsx (+182 -0)
📝 src/features/catalog/presets/components/PresetEditor.tsx (+33 -16)

...and 9 more files

📄 Description

Linked issue

Closes #1701

Why this change

  • The preset editor's unsaved-changes Save & close action closed the detail view immediately after starting an async save, so failed or still-pending saves could hide the user's edited content.

What changed

  • Changed preset saving to await updatePreset.mutateAsync and return a success boolean.
  • Moved Save & close closing behind a successful save result.
  • Added a visible preset save error banner so failed saves keep the editor open with the edited content still present.
  • Added a focused PresetEditor regression test for failed Save & close followed by a successful retry.

Refactor impact

Primary owner:

Catalog resources

Impact areas reviewed:

  • Preset editor save flow.
  • Preset editor unsaved-changes banner.
  • Adjacent agent editor Save & close pattern for consistency.

Boundary notes:

  • Feature/UI-only change under src/features/catalog/presets.
  • No engine, shared API, Tauri/Rust, storage schema, remote runtime, dependency, or version-file changes.

Pressure points touched:

  • None.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • 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
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex verification: pnpm exec vitest run src/features/catalog/presets/components/PresetEditor.test.tsx passed. The regression test mounts the real preset editor, verifies failed Save & close keeps the detail open with edited content and error text, then verifies a successful retry closes the detail.
  • Codex verification: pnpm typecheck passed.
  • Codex verification: git diff --check passed.
  • Codex verification: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed locally.
  • Broader baseline: pnpm check passed line endings, architecture, frontend typecheck, Rust check, and docs, then failed at check:unused on unrelated existing knip findings outside this PR's files.
  • Bunny review: passed locally for the focused diff, with the pnpm check:unused limitation noted above.

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 browser screenshot was attached. The changed path is covered by a component-level jsdom regression test that asserts the rendered editor remains open with edited content and error copy after a failed Save & close.

Summary by CodeRabbit

  • Tests

    • Added comprehensive test suite for preset save failures and successful retry flows
  • Bug Fixes

    • Enhanced preset save error handling with clear inline error messages
    • Preset editor now remains open when save fails, enabling users to retry
    • Added dismiss buttons to error notifications for better usability

🔄 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/1732 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1701-preset-save-close` --- ### 📝 Commits (4) - [`45ce5d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45ce5d45d9166aea005c4b110b7c9cc1d9a332f7) Fix preset save and close ordering - [`f35fec8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f35fec84be591020b54c3e754ac3e5fa01b468b0) Fix agent editor test mock - [`3bfb2ca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3bfb2caa565d2823398f9ab2ce9c9e7c3971c57c) Label preset save error dismiss button - [`6aec930`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6aec930e5d407376299a2f741f6fac03d3d5c153) Clean up unused exports for CI ### 📊 Changes **29 files changed** (+241 additions, -779 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/constants/agent-activation.ts` (+1 -1) 📝 `src/engine/generation-core/llm/inline-thinking.ts` (+0 -56) 📝 `src/engine/generation/generate-route-utils.ts` (+1 -1) 📝 `src/engine/generation/tools-runtime.ts` (+1 -1) 📝 `src/engine/mari/mari-history.ts` (+1 -1) 📝 `src/engine/modes/game/assets/npc-avatar-utils.ts` (+1 -1) ➖ `src/engine/modes/game/state/segment-edits.ts` (+0 -426) 📝 `src/engine/shared/game-state/player-stats.ts` (+1 -1) 📝 `src/engine/shared/scoring/skill-check-format.ts` (+0 -14) 📝 `src/features/catalog/agents/components/AgentEditor.test.tsx` (+1 -0) 📝 `src/features/catalog/characters/hooks/use-characters.test.ts` (+1 -108) 📝 `src/features/catalog/characters/hooks/use-characters.ts` (+0 -19) 📝 `src/features/catalog/characters/lib/character-import-file-classifier.ts` (+1 -1) 📝 `src/features/catalog/characters/lib/character-search.ts` (+0 -59) 📝 `src/features/catalog/characters/lib/characters-panel-model.ts` (+1 -1) 📝 `src/features/catalog/chat-presets/hooks/use-chat-presets.ts` (+1 -1) 📝 `src/features/catalog/gallery/hooks/use-gallery.ts` (+4 -4) 📝 `src/features/catalog/personas/lib/personas-panel-model.ts` (+1 -1) ➕ `src/features/catalog/presets/components/PresetEditor.test.tsx` (+182 -0) 📝 `src/features/catalog/presets/components/PresetEditor.tsx` (+33 -16) _...and 9 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 Closes #1701 ## Why this change - The preset editor's unsaved-changes `Save & close` action closed the detail view immediately after starting an async save, so failed or still-pending saves could hide the user's edited content. ## What changed - Changed preset saving to await `updatePreset.mutateAsync` and return a success boolean. - Moved `Save & close` closing behind a successful save result. - Added a visible preset save error banner so failed saves keep the editor open with the edited content still present. - Added a focused `PresetEditor` regression test for failed Save & close followed by a successful retry. ## Refactor impact Primary owner: Catalog resources Impact areas reviewed: - Preset editor save flow. - Preset editor unsaved-changes banner. - Adjacent agent editor Save & close pattern for consistency. Boundary notes: - Feature/UI-only change under `src/features/catalog/presets`. - No engine, shared API, Tauri/Rust, storage schema, remote runtime, dependency, or version-file changes. Pressure points touched: - None. ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] `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 - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex verification: `pnpm exec vitest run src/features/catalog/presets/components/PresetEditor.test.tsx` passed. The regression test mounts the real preset editor, verifies failed Save & close keeps the detail open with edited content and error text, then verifies a successful retry closes the detail. - Codex verification: `pnpm typecheck` passed. - Codex verification: `git diff --check` passed. - Codex verification: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed locally. - Broader baseline: `pnpm check` passed line endings, architecture, frontend typecheck, Rust check, and docs, then failed at `check:unused` on unrelated existing `knip` findings outside this PR's files. - Bunny review: passed locally for the focused diff, with the `pnpm check:unused` limitation noted above. ## 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 browser screenshot was attached. The changed path is covered by a component-level jsdom regression test that asserts the rendered editor remains open with edited content and error copy after a failed Save & close. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test suite for preset save failures and successful retry flows * **Bug Fixes** * Enhanced preset save error handling with clear inline error messages * Preset editor now remains open when save fails, enabling users to retry * Added dismiss buttons to error notifications for better usability <!-- 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:14:33 +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#5243
No description provided.