[PR #1600] [MERGED] Fix five catalog/agent editor UX bugs #5135

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/catalog-editor-ux


📝 Commits (10+)

  • 04c9141 Normalize character data on editor load so malformed cards don't crash
  • 2ca4c77 Read regex script enabled and promptOnly as booleans in the agents UI
  • 11c4700 Dock the agent debug overlay clear of the editor body
  • e3a5fab Let the agent editor header name input shrink on narrow viewports
  • 7b41980 Restore the catalog panel when closing the agent editor on mobile
  • 7a04d91 Apply enabled regex scripts on the live transform path
  • 9684041 Fill extension defaults on the character editor parse-failure fallback
  • fb31583 Merge branch 'refactor' into fix/catalog-editor-ux
  • 8e57665 Treat the legacy "1" string as enabled in the regex readers
  • b2d5150 Merge branch 'refactor' into fix/catalog-editor-ux

📊 Changes

15 files changed (+729 additions, -12 deletions)

View changed files

➕ src/features/catalog/agents/components/AgentDebugPanel.test.tsx (+91 -0)
📝 src/features/catalog/agents/components/AgentDebugPanel.tsx (+4 -1)
➕ src/features/catalog/agents/components/AgentEditor.test.tsx (+146 -0)
📝 src/features/catalog/agents/components/AgentEditor.tsx (+1 -1)
➕ src/features/catalog/agents/components/AgentsPanel.test.tsx (+142 -0)
📝 src/features/catalog/agents/components/AgentsPanel.tsx (+2 -1)
📝 src/features/catalog/agents/components/RegexScriptEditor.tsx (+3 -2)
📝 src/features/catalog/agents/hooks/use-regex-scripts.ts (+4 -2)
➕ src/features/catalog/agents/regex-application.test.tsx (+73 -0)
📝 src/features/catalog/agents/regex-application.ts (+4 -2)
➕ src/features/catalog/characters/components/CharacterEditor.test.tsx (+148 -0)
📝 src/features/catalog/characters/components/CharacterEditor.tsx (+24 -1)
➕ src/shared/stores/ui.store.test.ts (+71 -0)
📝 src/shared/stores/ui.store.ts (+5 -1)
📝 src/shared/stores/ui/model.ts (+11 -1)

📄 Description

Why this change

Five UX/correctness bugs in the catalog editors (characters + agents), reported against the refactor. Grouped because they share the catalog-editor surface and are each small, isolated fixes.

What changed

  • #1559 - character editor crash on malformed cards: CharacterEditor set form state straight from raw storage data, so a card whose data had no extensions object threw a TypeError on the first formData.extensions.* read and the editor never mounted. Loaded data now goes through the engine characterDataSchema, so extensions and its defaults always exist. The parse-failure fallback (e.g. a card with no name) also normalizes extensions through characterExtensionsSchema, so nested defaults exist and sliders don't render NaN%.
  • #1555 - regex toggle and apply both misread the enabled flag: the agents list, the editor toggles, AND the live apply path (parseScript -> useApplyRegex, used on send and on display) all compared enabled/promptOnly against the string "true", but storage round-trips a real boolean. So enabled scripts both rendered as disabled in the list AND never transformed text. All readers now use a boolean-tolerant check, and the row type matches the stored shape.
  • #1553 - debug overlay covers the editor: moved the agent debug overlay from bottom-left (over the editor body) to bottom-right with an offset clear of the editor and the sibling thought-bubble panel.
  • #1556 - header Save pushed offscreen on mobile: added min-w-0 to the header name input so it can shrink instead of pushing Save/Delete offscreen on narrow viewports.
  • #1554 - Back drops to chat on mobile: opening an agent closed the right catalog panel on narrow viewports, but the editor Back action never restored it. Back now reopens the Agents panel on mobile via a symmetric store patch.

Verification

  • pnpm check:architecture (dependency-cruiser boundary guard) and pnpm check:frontend (tsc -b) pass on this branch.
  • Co-located regression test per fix (vitest + jsdom), each confirmed RED on the unfixed baseline and GREEN with the fix: a store-action unit (#1554); real-component mounts (#1559, #1556, #1553); list-dimming for #1555; and an apply-path test asserting an enabled boolean script actually rewrites ai_output/user_input text (#1555).
  • Pure UI/engine/store paths with no Tauri-runtime dependency; none call invoke for behaviour.

Follow-ups (deferred, not blocking)

  • #1554: the same open-without-restore asymmetry exists for the sibling detail editors (lorebook/preset/connection/tool/persona/regex) that share openDetailRouteState. Scoped this PR to the Agents flow as reported; mobilePanelReopenPatch() is exported and ready to extend.

Linked issues

Closes #1559
Closes #1555
Closes #1553
Closes #1556
Closes #1554

Summary by CodeRabbit

Bug Fixes

  • Fixed agent name input overflow on narrow viewports, preventing Save/Delete buttons from being pushed off-screen
  • Resolved regex scripts not being applied when stored as boolean values
  • Improved character editor handling of malformed character data missing expected fields
  • Enhanced mobile navigation: closing the agent detail editor now properly reopens the agents catalog panel
  • Repositioned agent debug panel from bottom-left to bottom-right to avoid overlapping other interface elements

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/1600 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `refactor` ← **Head:** `fix/catalog-editor-ux` --- ### 📝 Commits (10+) - [`04c9141`](https://github.com/Pasta-Devs/Marinara-Engine/commit/04c9141ab43d8bb5ac2ff8be4a2bf0ad312f2648) Normalize character data on editor load so malformed cards don't crash - [`2ca4c77`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2ca4c7784c49b28c28de50490fdd742ad450e782) Read regex script enabled and promptOnly as booleans in the agents UI - [`11c4700`](https://github.com/Pasta-Devs/Marinara-Engine/commit/11c470093fe6fb688eca294bfcb8ecc095b1f306) Dock the agent debug overlay clear of the editor body - [`e3a5fab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e3a5fabb86567b4baef788769d74224a368d0c8e) Let the agent editor header name input shrink on narrow viewports - [`7b41980`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7b419809312b4aeecd2abe948a6a8f6bb9fe284d) Restore the catalog panel when closing the agent editor on mobile - [`7a04d91`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7a04d91894f5277738e832f324aaf6cc787881ce) Apply enabled regex scripts on the live transform path - [`9684041`](https://github.com/Pasta-Devs/Marinara-Engine/commit/96840416c5de7a1ae6c5f781ce6877a7a8a247c0) Fill extension defaults on the character editor parse-failure fallback - [`fb31583`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fb31583422e43ecf1e4caf66ffdacbadeeff38f0) Merge branch 'refactor' into fix/catalog-editor-ux - [`8e57665`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e576659511185a084db05fcb1d1d57fff9c7857) Treat the legacy "1" string as enabled in the regex readers - [`b2d5150`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b2d5150a7033c5bbfc2e87993b45c4671fba356e) Merge branch 'refactor' into fix/catalog-editor-ux ### 📊 Changes **15 files changed** (+729 additions, -12 deletions) <details> <summary>View changed files</summary> ➕ `src/features/catalog/agents/components/AgentDebugPanel.test.tsx` (+91 -0) 📝 `src/features/catalog/agents/components/AgentDebugPanel.tsx` (+4 -1) ➕ `src/features/catalog/agents/components/AgentEditor.test.tsx` (+146 -0) 📝 `src/features/catalog/agents/components/AgentEditor.tsx` (+1 -1) ➕ `src/features/catalog/agents/components/AgentsPanel.test.tsx` (+142 -0) 📝 `src/features/catalog/agents/components/AgentsPanel.tsx` (+2 -1) 📝 `src/features/catalog/agents/components/RegexScriptEditor.tsx` (+3 -2) 📝 `src/features/catalog/agents/hooks/use-regex-scripts.ts` (+4 -2) ➕ `src/features/catalog/agents/regex-application.test.tsx` (+73 -0) 📝 `src/features/catalog/agents/regex-application.ts` (+4 -2) ➕ `src/features/catalog/characters/components/CharacterEditor.test.tsx` (+148 -0) 📝 `src/features/catalog/characters/components/CharacterEditor.tsx` (+24 -1) ➕ `src/shared/stores/ui.store.test.ts` (+71 -0) 📝 `src/shared/stores/ui.store.ts` (+5 -1) 📝 `src/shared/stores/ui/model.ts` (+11 -1) </details> ### 📄 Description ## Why this change Five UX/correctness bugs in the catalog editors (characters + agents), reported against the refactor. Grouped because they share the catalog-editor surface and are each small, isolated fixes. ## What changed - **#1559 - character editor crash on malformed cards**: `CharacterEditor` set form state straight from raw storage data, so a card whose `data` had no `extensions` object threw a `TypeError` on the first `formData.extensions.*` read and the editor never mounted. Loaded data now goes through the engine `characterDataSchema`, so `extensions` and its defaults always exist. The parse-failure fallback (e.g. a card with no name) also normalizes `extensions` through `characterExtensionsSchema`, so nested defaults exist and sliders don't render `NaN%`. - **#1555 - regex toggle and apply both misread the enabled flag**: the agents list, the editor toggles, AND the live apply path (`parseScript` -> `useApplyRegex`, used on send and on display) all compared `enabled`/`promptOnly` against the string `"true"`, but storage round-trips a real boolean. So enabled scripts both rendered as disabled in the list AND never transformed text. All readers now use a boolean-tolerant check, and the row type matches the stored shape. - **#1553 - debug overlay covers the editor**: moved the agent debug overlay from bottom-left (over the editor body) to bottom-right with an offset clear of the editor and the sibling thought-bubble panel. - **#1556 - header Save pushed offscreen on mobile**: added `min-w-0` to the header name input so it can shrink instead of pushing Save/Delete offscreen on narrow viewports. - **#1554 - Back drops to chat on mobile**: opening an agent closed the right catalog panel on narrow viewports, but the editor Back action never restored it. Back now reopens the Agents panel on mobile via a symmetric store patch. ## Verification - `pnpm check:architecture` (dependency-cruiser boundary guard) and `pnpm check:frontend` (`tsc -b`) pass on this branch. - Co-located regression test per fix (vitest + jsdom), each confirmed RED on the unfixed baseline and GREEN with the fix: a store-action unit (#1554); real-component mounts (#1559, #1556, #1553); list-dimming for #1555; and an apply-path test asserting an enabled boolean script actually rewrites `ai_output`/`user_input` text (#1555). - Pure UI/engine/store paths with no Tauri-runtime dependency; none call `invoke` for behaviour. ## Follow-ups (deferred, not blocking) - #1554: the same open-without-restore asymmetry exists for the sibling detail editors (lorebook/preset/connection/tool/persona/regex) that share `openDetailRouteState`. Scoped this PR to the Agents flow as reported; `mobilePanelReopenPatch()` is exported and ready to extend. ## Linked issues Closes #1559 Closes #1555 Closes #1553 Closes #1556 Closes #1554 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Bug Fixes - Fixed agent name input overflow on narrow viewports, preventing Save/Delete buttons from being pushed off-screen - Resolved regex scripts not being applied when stored as boolean values - Improved character editor handling of malformed character data missing expected fields - Enhanced mobile navigation: closing the agent detail editor now properly reopens the agents catalog panel - Repositioned agent debug panel from bottom-left to bottom-right to avoid overlapping other interface elements <!-- 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/1600?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:37 +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#5135
No description provided.