[PR #1622] [MERGED] Normalize chat preset boolean flags #5154

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1523-chat-preset-boolish


📝 Commits (2)

  • e7932be Normalize chat preset boolean flags
  • 2ea7509 Fix chat preset flag normalization in new chat flows

📊 Changes

9 files changed (+203 additions, -47 deletions)

View changed files

📝 src-tauri/src/commands/storage/shared.rs (+44 -0)
📝 src/app/shell/useStartNewChat.ts (+8 -7)
📝 src/engine/contracts/types/chat-preset.ts (+4 -0)
📝 src/features/catalog/characters/hooks/use-start-chat-from-character.ts (+2 -4)
📝 src/features/catalog/chat-presets/hooks/use-chat-presets.test.ts (+81 -1)
📝 src/features/catalog/chat-presets/hooks/use-chat-presets.ts (+35 -7)
📝 src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx (+23 -21)
📝 src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx (+4 -3)
📝 src/features/modes/shared/chat-ui/components/NewChatConnectionGate.tsx (+2 -4)

📄 Description

Linked issue

Closes #1523

Why this change

  • Imported or legacy chat-settings preset rows can store boolean flags as strings such as "false".
  • The Chat Settings drawer and setup wizard used those raw truthy values, so every preset could render as Default and default/active selection logic could choose the wrong row.

What changed

  • Normalized isDefault, default, isActive, and active at the Rust storage typed-field boundary for chat-presets.
  • Normalized chat preset flags again in useChatPresets so UI code gets booleans even before older rows are rewritten.
  • Updated Chat Settings drawer and Roleplay setup wizard preset selection/rendering to use boolish flag checks.
  • Added Rust and Vitest coverage for text boolean coercion and legacy alias handling.

Refactor impact

Primary owner:

Rust storage normalization; catalog chat preset hook; shared mode chat UI.

Impact areas reviewed:

  • Chat Settings drawer preset dropdown, default/star controls, save/rename/delete guards.
  • Roleplay setup wizard preset defaulting/dropdown labels.
  • Storage/import boundary for chat preset boolean-ish fields.

Boundary notes:

  • Storage normalization stays in src-tauri shared storage typed-field handling.
  • Feature UI continues to use catalog hooks and existing storage API wrappers.
  • No raw Tauri invoke, remote runtime, HTTP dispatch, or engine-to-React boundary changes.

Pressure points touched:

  • src-tauri/src/commands/storage/shared.rs typed JSON/flag normalization.
  • src/features/catalog/chat-presets/hooks/use-chat-presets.ts catalog hook normalization.
  • src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx shared mode UI.
  • src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx shared mode UI.

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

  • cargo test --manifest-path src-tauri/Cargo.toml chat_preset_defaults_normalize_boolish_flags
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm exec vitest run src/features/catalog/chat-presets/hooks/use-chat-presets.test.ts
  • pnpm typecheck
  • pnpm check:architecture
  • git diff --check
  • Browser/Tauri manual UI verification was not run; behavior is covered by storage/hook tests and typecheck.

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

Not added. The visible change is corrected dropdown/default-control behavior for legacy/imported preset flags, covered by focused hook/storage tests.


🔄 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/1622 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 5/30/2026 **Status:** ✅ Merged **Merged:** 5/30/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/issue-1523-chat-preset-boolish` --- ### 📝 Commits (2) - [`e7932be`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e7932be613ba173316e8fc38a156a5898b951985) Normalize chat preset boolean flags - [`2ea7509`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2ea75095fe164c6b7d4b224d092267c36ce3224c) Fix chat preset flag normalization in new chat flows ### 📊 Changes **9 files changed** (+203 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/shared.rs` (+44 -0) 📝 `src/app/shell/useStartNewChat.ts` (+8 -7) 📝 `src/engine/contracts/types/chat-preset.ts` (+4 -0) 📝 `src/features/catalog/characters/hooks/use-start-chat-from-character.ts` (+2 -4) 📝 `src/features/catalog/chat-presets/hooks/use-chat-presets.test.ts` (+81 -1) 📝 `src/features/catalog/chat-presets/hooks/use-chat-presets.ts` (+35 -7) 📝 `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` (+23 -21) 📝 `src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx` (+4 -3) 📝 `src/features/modes/shared/chat-ui/components/NewChatConnectionGate.tsx` (+2 -4) </details> ### 📄 Description ## Linked issue Closes #1523 ## Why this change - Imported or legacy chat-settings preset rows can store boolean flags as strings such as `"false"`. - The Chat Settings drawer and setup wizard used those raw truthy values, so every preset could render as `Default` and default/active selection logic could choose the wrong row. ## What changed - Normalized `isDefault`, `default`, `isActive`, and `active` at the Rust storage typed-field boundary for `chat-presets`. - Normalized chat preset flags again in `useChatPresets` so UI code gets booleans even before older rows are rewritten. - Updated Chat Settings drawer and Roleplay setup wizard preset selection/rendering to use boolish flag checks. - Added Rust and Vitest coverage for text boolean coercion and legacy alias handling. ## Refactor impact Primary owner: Rust storage normalization; catalog chat preset hook; shared mode chat UI. Impact areas reviewed: - Chat Settings drawer preset dropdown, default/star controls, save/rename/delete guards. - Roleplay setup wizard preset defaulting/dropdown labels. - Storage/import boundary for chat preset boolean-ish fields. Boundary notes: - Storage normalization stays in `src-tauri` shared storage typed-field handling. - Feature UI continues to use catalog hooks and existing storage API wrappers. - No raw Tauri invoke, remote runtime, HTTP dispatch, or engine-to-React boundary changes. Pressure points touched: - `src-tauri/src/commands/storage/shared.rs` typed JSON/flag normalization. - `src/features/catalog/chat-presets/hooks/use-chat-presets.ts` catalog hook normalization. - `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` shared mode UI. - `src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx` shared mode UI. ## Validation - [ ] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [ ] `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 - [ ] 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 - `cargo test --manifest-path src-tauri/Cargo.toml chat_preset_defaults_normalize_boolish_flags` - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm exec vitest run src/features/catalog/chat-presets/hooks/use-chat-presets.test.ts` - `pnpm typecheck` - `pnpm check:architecture` - `git diff --check` - Browser/Tauri manual UI verification was not run; behavior is covered by storage/hook tests and typecheck. ## 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 ## UI evidence Not added. The visible change is corrected dropdown/default-control behavior for legacy/imported preset flags, covered by focused hook/storage tests. --- <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:47 +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#5154
No description provided.