mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7416] [MERGED] fix(summary): make Write honor the Range summary scope #7723
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#7723
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/7416
Author: @SpicyMarinara
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/summary-write-range📝 Commits (4)
7dcbc90fix(summary): make Write honor the Range summary scope5c1d21ffix(summary): let a refused Write range be changed and say whyd1baad8fix(summary): say why a Write range is refused, and keep one entry per save7cdb301fix(summary): refuse a Write range without positive whole message numbers📊 Changes
8 files changed (+582 additions, -125 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/client/src/components/chat/ChatSummaryPanel.tsx(+43 -9)📝
packages/client/src/hooks/use-chats.ts(+3 -3)📝
packages/client/src/lib/chat-summary-batch.ts(+29 -0)📝
packages/client/src/localization/locales/en.json(+1 -0)📝
packages/server/src/routes/chats.routes.ts(+164 -113)📝
packages/server/src/routes/generate/generate-route-utils.ts(+31 -0)➕
scripts/regressions/summary-write-range.regression.ts(+310 -0)📄 Description
Linked issue
Closes #7410
Why this change
messageIds, norangeStartIndex/rangeEndIndexand nohiddenMessageIds. So it showed no range, and with Hide summarised messages on, it never hid what it summarized. Generate with the same range worked, so the two buttons gave different results for the same scope.What changed
sourceMode: "range",rangeStartIndex,rangeEndIndex). The draft row shows that range while you type.resolveChatSummaryWriteCoverage(lib/chat-summary-batch.ts), and the panel uses it both to show the draft and to save it.code(hidden,invalid,outside,tooLarge), and the panel maps it to a localized message.invalid,outsideandtooLargereuse the existing range messages.hiddenuses one new key,ui.chat.summarypopover.batchRangeAllHidden("Every message in this range is already hidden."). Any other error still shows "Could not save summary entry."selectSummaryRangeMessages(generate-route-utils) turns a range into its non-hidden messages and one-based indices. It returns the errors Generate already used (not found, outside history, more than 500, nothing visible), each with a stablecode.appendSummaryEntryHidingMessages(inchatsRoutes) is the queued hide-then-append step with rollback on failure, moved from Generate. It takes the route's request, so the queue is still keyed byreq.params.id. Inside the queue it checks again whether the entry id already exists, so two saves of the same draft that both pass the route's first check keep one entry.POST /generate-summarynow calls both, and its behavior and response are unchanged.PATCH /summary-entriesreplacecalls both for a new entry withsourceMode: "range". A new range entry whose indices are not positive whole numbers is refused with the codeinvalid, instead of being saved as a range that covers nothing. The server setsmessageIds,messageCountand the range itself, and ignores anyhiddenMessageIdsthe client sends. Edits to an existing entry still go through the plain replace and keep the coverage it already has.scripts/regressions/summary-write-range.regression.tscovers:origin/staging, wheremessageCount,messageIdsandhiddenMessageIdswere all missing.code, and nothing saved.invalid) and saves nothing.hiddencode to its localized message.[Unreleased].Behavior choices for review:
Review follow-up
issue-sweep-5391-5394failed on this branch's first commit. It pins Generate's summary queue aswithChatMetadataPatchQueue(req.params.id, …)followed bymetadataQueueHeld: true, and the shared helper had keyed the queue by achatIdparameter. I left the test as it is and changed the helper to take the route's request, so the queue is keyed exactly as before.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands run:
pnpm check(passes; the one lint warning is already on staging, inHomeProfessorMariChat.tsx),node ./scripts/run-regressions.mjs --filter summary-write-range(fails on staging code and on each fix reverted on its own, passes with this branch),node ./scripts/run-regressions.mjs --filter issue-sweep-5391-5394(passes),node ./scripts/run-regressions.mjs(580/581; the one failure,termux-sharp, isERR_PNPM_NO_OFFLINE_TARBALLfor@img/sharp-wasm32in this offline sandbox, and this PR changes no dependencies),pnpm localization:check(passes),coderabbit review --agent --committed --base-commit <merge-base>.Manual verification notes
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No files under
docs/changed, so no[docs-i18n]follow-up is needed.Local CodeRabbit
I ran
coderabbit review --agent --committed --base-commit <merge-base>three times, after each round of fixes. It reported 6 findings in all: 4 fixed, 2 rejected.Fixed:
code, and the panel shows a localized message (see What changed).0was refused as "not found", and a fractional or missing index fell through to the plain replace and was saved as a range that covers nothing. A new range entry now needs positive whole numbers, or it is refused with the codeinvalid. The only caller is the panel, which always sends whole numbers for a range draft and sends nosourceModewhen editing, so no existing caller breaks.Rejected:
hiddenMessageIdsleaves them out, so deleting A unhides them while B is still on. This PR doesn't introduce that:appendSummaryEntryHidingMessagesis staging's Generate block moved as is (hiddenMessageIds= whatbulkSetHiddenFromAInewly flipped), andgetChatSummaryMessageIdsToUnhideAfterDeletealready behaves that way for two overlapping Generate summaries on staging. Write now behaves like Generate, which is what #7410 asks for. Changing who owns a hidden message changes delete and unhide for every summary, so it belongs in its own issue.removeMessagesuses per-message interruption queues), so a deletion can still land between selection and save. The range is also whatever the user picked from the panel, which can be out of date in the same way.GitHub CodeRabbit had hit its review limit when I checked the PR, so its review is still pending.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.