mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1407] [MERGED] Collapse slim Chat type duplicate into the engine contract #5074
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5074
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1407
Author: @Romuromylus
Created: 5/27/2026
Status: ✅ Merged
Merged: 5/27/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/refactor-issue-1344-collapse-slim-chat-types📝 Commits (4)
950194fCollapse slim Chat type duplicate into the engine contract232c584Merge branch 'refactor' into fix/refactor-issue-1344-collapse-slim-chat-types2967a4fMerge branch 'refactor' into fix/refactor-issue-1344-collapse-slim-chat-typesfda4979Merge branch 'refactor' into fix/refactor-issue-1344-collapse-slim-chat-types📊 Changes
3 files changed (+11 additions, -78 deletions)
View changed files
📝
src/features/catalog/chats/index.ts(+10 -1)➖
src/features/catalog/chats/types.ts(+0 -76)📝
src/features/modes/shared/chat-ui/hooks/use-chat-surface-data.ts(+1 -1)📄 Description
Why this change
Issue #1344 audit (see issue comment) flagged that
src/features/catalog/chats/types.tsre-declaredChat,ChatFolder,Message,MessageExtra,MessageSwipe,ChatMetadata,MessageRole, andChatModeas a strictly slimmer copy of the canonical types insrc/engine/contracts/types/chat.ts.The slim Chat dropped
personaId,promptPresetId,connectionId,connectedChatId,sortOrder,createdAt. The slim ChatFolder droppedcreatedAtandupdatedAt. Consumers importing through thefeatures/catalog/chatsbarrel were typed against the narrower shape, so an accidental spread or copy that omitted a field the engine considers canonical would not produce a TypeScript error. This is exactly the failure mode behind several of the folder-drop sites in the parity audit (PR #TBD covers the runtime fix; this PR is the type-side cleanup).What changed
src/features/catalog/chats/types.ts(78 lines).src/features/catalog/chats/index.tsto re-exportChat,ChatFolder,ChatMode,ChatMetadata,Message,MessageRole,MessageExtra,MessageSwipefrom../../../engine/contracts/types/chatviaexport type. The other two barrelexport *lines (query-keys and hooks) are unchanged.src/features/modes/shared/chat-ui/hooks/use-chat-surface-data.ts:54so the existing runtime defensivetypeof raw === "string"branch inparseChatCharacterIdssurvives under the narrower engineChat.characterIds: string[]shape. SQLite serialization can hand back a JSON-stringified array, so the runtime guard is load-bearing; the cast preserves it without altering the engine contract.Net diff: 11 insertions, 78 deletions.
Verification
pnpm checkclean locally (architecture + tsc -b + cargo check + docs; 638 modules / 2265 deps cruised, zero boundary violations).pnpm buildproduces the production Vite bundle clean.grep -rn 'from "./types"' src/features/catalog/chats/returns no hits.Follow-ups (deferred, not blocking this PR)
use-chat-surface-data.tslines 162 and 235 still containchat as unknown as { personaId?: unknown }andchat as unknown as { connectedChatId?: unknown }casts that are now provably redundant — engineChatalready exposes both asstring | null. Left in place to keep the diff minimal; small cleanup PR later.parseChatCharacterIds's JSON-string fallback branch (now the only consumer of the load-bearing cast) would harden the contract. Not blocking; the SQLite serialization path that motivates the guard is not exercised by any current test.Linked issue
Refs #1344
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.