mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5621] [MERGED] feat(client): send the owning chatId on the id-only endpoints #6851
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#6851
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/5621
Author: @kolacheee
Created: 8/29/2026
Status: ✅ Merged
Merged: 8/29/2026
Merged by: @kolacheee
Base:
staging← Head:feat/5615-client-chatid-hints📝 Commits (1)
dabfd67feat(client): send the owning chatId on the id-only endpoints📊 Changes
6 files changed (+43 additions, -19 deletions)
View changed files
📝
packages/client/src/components/chat/AgentSuiteModal.tsx(+1 -1)📝
packages/client/src/components/chat/ChatGallery.tsx(+15 -9)📝
packages/client/src/components/chat/MariContextViewer.tsx(+1 -1)📝
packages/client/src/hooks/use-agents.ts(+4 -2)📝
packages/client/src/hooks/use-gallery.ts(+17 -4)📝
packages/client/src/hooks/use-mari-workspace-context.ts(+5 -2)📄 Description
Closes #5615. The client half of the #5592 close-out: #5614 taught the id-only endpoints to accept an optional owning-chat hint; this makes the client send it, closing the last cold paths that could convert a lazy table to permanently fully-resident.
What changed
Three of the four endpoints get their hint (all pure
packages/client/changes; the server treats a missing value exactly as before, so this is safe to ship independently):DELETE /gallery/:idnow carries?chatId=— and the value is the image row's ownchatId, not the open chat. That distinction is load-bearing: a Game-mode gallery aggregates images from sibling game sessions into one list, so the open chat is the wrong owner for those rows, and a wrong hint 404s the delete. TheuseDeleteGalleryImagemutation widened from a bare id to{ imageId, chatId }; the hook's ambient chatId stays as-is for the react-query cache keys (that's what the list queries are keyed on — the two ids serve different purposes and legitimately differ).DELETE /professor-mari-workspace/context/:idnow carries?chatId=from the context item row's ownchatId(the owning workspace chat — deliberately notsourceChatId, which is the chat the slice was copied from). Same mutation-widening pattern.PATCH /agents/runs/:runIdnow sendschatIdin the body. The mutation variables already carried it (for cache invalidation) — it was just never put on the wire. Also switchedAgentSuiteModal's call from the ambientchat.idto the row's ownrun.chatId, matching the patternRoleplayHUDActionsMenualready used; they're equal today (the runs list is chat-scoped), but the row's own field survives any future cross-chat runs view.The fourth endpoint (
DELETE /game/checkpoint/:id) has no client caller at all — verified by exhaustive search, there is no checkpoint-management UI yet. The server-side hint is already wired (#5614); whenever a checkpoint UI is built, its delete call should pass the checkpoint row'schatIdfrom day one. Nothing to change here.One adjacent (pre-existing) gap fixed alongside, because this PR makes the path it affects explicit: deleting a sibling session's image only invalidated the open chat's gallery caches, so the sibling's own cached list kept showing the deleted image for up to its 5-minute stale window.
onSettlednow also invalidates the owner chat's keys when they differ.Why wrong-owner matters (and why this is still just a perf change)
The server uses the hint purely to scope the storage lookup to one chat's shard instead of loading every chat's — it is not an authorization check. Sending it wrong yields a 404 (nothing acts); omitting it falls back to today's unscoped lookup. So every threaded value here is taken from the resource row itself wherever the surface can display cross-chat rows.
Validation done
pnpm check✅ (guard, localization, prettier, client+server lint/type checks, production build).strict()), and confirmation these three are the complete set of client-reachable hint-bearing routes. It also corrected one of my own audit notes: thepinImage({ ...image, chatId })pattern is deliberate (pinned-mediachatIdmeans "pinned to this chat", filtered by the active chat), so no follow-up issue is warranted there.Manually verify
?chatId=)MARINARA_MAX_RESIDENT_CHATSinstall, confirm none of these actions logsLazy table … is now fully residentSummary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.