Repository navigation
fix(chatbot): redraw record-citation chips after a reload; keep the cited-section scroll to new clicks - #37539
objectstack-fleet[bot] wants to merge 5 commits into
Conversation
…ection scroll to new clicks The /ai history rebuild, the message cache and the useObjectChat store rebuild now keep the data parts one allow-list names (charts and record citations). The record section effect re-runs only when a new opened-state value arrives, not on a navigation that drops the history state. Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
…es not scroll back to the cited section The browser check showed the record-form overlay remounts the record page without the click's history state, so the cited-section effect ran again and scrolled back. The page now remembers the section it last opened beside the component, claimed when the page would move: a redraw at that section marks it again and scrolls nothing. The memory is dropped once no record page is mounted. Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head e2833f9 · 2026-11-26T13:12Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Read: card #37487 (body; comments 7186889924, 7189270058, 7190147175, claim 7190899980, amendment 7191223613, os-dev report 7192922175), the PR body, ① Derived judgmentsAccept set: unchanged, right. The citations list is read back through Allow-list: keeps what a reload needs, drops nothing that was kept before. I checked all three paths against
The other data parts the mapper reads ( Module memory (S5): no leak, bounded, reset correctly. I read
Public surface: widened. That is right as a change, but it is declared wrong (S1).
Pins guard the behaviour.
② Semver levelChangeset level: right. S1 (must-fix) —
③ Boundary flags
Nits (no effect on correctness or the contract):
Implemented-by: VERDICT: FAIL |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
…llow-list drives Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 40bb8ee · 2026-11-26T13:46Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 40bb8ee · 2026-11-26T13:59Z (re-record after the body-only fix) |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: This record covers the same head as the earlier delta record, after a change to the PR body only. It replaces that record on this head. I read the current PR body and every check-run on this head. Nothing was built or run. ① Derived judgmentsThe code is unchanged since the delta record: same head, and the two N1: closed. The jsdoc in N2: accepted by the seat (REWORK 7193228908). ② Semver levelS1: closed.
③ Boundary flagsS2: closed.
Check-runs on this head:
The PR body's check counts were refreshed. Follow-up cards:
SQL push-down does not apply: the diff adds no query. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc Landing: ACCEPT 7194202614 (same-head contract record 7194188712, PASS) at head
Status: ready + auto-merge (merge queue). On MERGED, #37487 closes by |
Requested by Bill · project thread
Fixes #37487
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
Governing text: ruling Q1 on #37144 (draw the persisted, already-verified list; never verify it again); PR #37485 (merged 276174a) and its scope notes on #37487 (S4 on the card, S5 in 7190147175).
plugin-chatbot/src/toolResultParsers.ts):STORED_ANSWER_DATA_PARTSnames the data parts a stored answer keeps through a rebuild, keyed by the message field that carries each between rebuilds:charts(data-chart, positional) andrecordCitations(data-record-citations).storedAnswerParts(content, data)writes them (the charts through the existingchartAnswerParts, then the citations list as one part with the stream's part id). It stays in the eager/coreclosure, so the part type is spelled there, not imported from@objectstack/spec/ai; a test pins it toRECORD_CITATIONS_PART_TYPE.plugin-chatbot/src/mapMessages.ts):storedAnswerData(parts)reads every kept part back (chartsFromParts+extractRecordCitations, the sameRecordCitationsSchemaparse a live part goes through). A refused list is no list./aihistory rebuildhydratedMessagesToChatMessages(app-shell/src/console/ai/AiChatPage.tsx, reader), the message cachesanitizeChatMessagesForCache(app-shell/src/hooks/useChatConversation.ts, writer;CacheableChatMessagegainsrecordCitations), and theuseObjectChatinitialMessagesstore rebuild (plugin-chatbot/src/useObjectChat.ts, writer). The table names the kept parts; a further kept part takes three edits (the entry, its write instoredAnswerParts, its read instoredAnswerData).app-shell/src/views/RecordDetailView.tsx,recordSectionAnchor.ts): the cited-section effect was keyed on the opened-state value or'', so any navigation that dropped history state re-ran it and scrolled back. Two parts:?form=) remounts the record page without the state, so a component-local memory is not enough. The page now keeps the section it last opened beside the component (claimCitedSectionOpen,{ target: RECORD+ANCHOR, opened: CLICK }), claimed at the moment the page would move (focusRecordSectiongains an optionalmayScrollcallback, asked right before scrolling, so an effect re-run before that does not spend it). A redraw at a section already opened marks it again and scrolls nothing. The memory is dropped once no record page has stayed mounted (a zero-delay check after unmount), so a later visit to the same link opens its section again.storedAnswerParts,STORED_ANSWER_DATA_PARTSand the typesStoredAnswerData,StoredAnswerPartfrom@object-ui/plugin-chatbot/coreand the root;storedAnswerDatafrom the root. Named in the changeset.content/docs/frontend/plugins/plugin-chatbot.mdxandui/packages/plugin-chatbot/README.mdwas made false by this change and is rewritten. Changeset.changeset/37487-citations-survive-reload.md(patch,@object-ui/plugin-chatbot,@object-ui/app-shell).Read first, by risk:
ui/packages/plugin-chatbot/src/toolResultParsers.ts:STORED_ANSWER_DATA_PARTSandstoredAnswerParts.ui/packages/app-shell/src/views/RecordDetailView.tsx:claimCitedSectionOpen(module level, above the component) and thesectionOpenedstate and effect besideholdsRouteRecord.ui/packages/app-shell/src/hooks/useChatConversation.ts:sanitizeChatMessagesForCache.Tests
app-shell/src/console/ai/__tests__/AiChatPage.recordCitationsReload-37487.test.tsx(6): server history and cache fallback each restore the chips the live answer draws (same quotes, same order; nothing fetched); a restored server answer re-caches with its list; CONTROL on both paths: a refused part (an alias key) draws nothing and is not cached.plugin-chatbot/src/__tests__/useObjectChat.recordCitationsReload-37487.test.tsx(3): theinitialMessagesstore rebuild draws the live chips; CONTROL: a refused list draws nothing (the store part is re-parsed, so the rebuild is no way round the contract); the allow-list entry equals the spec part type.app-shell/src/views/RecordDetailView.citedSection-37365.test.tsx(+2, 8 total): after a chip click, a state-droppingreplace(theuseUrlOverlayshape) and a pushed overlay followed by Back do not scroll; a pushed overlay that remounts the page, and Back, marks the section again and does not scroll; CONTROL in both: a new click after them scrolls.afterEachwaits one macrotask aftercleanup()so the page's memory is dropped between cases.recordSectionAnchor.test.tsxunchanged, 18/18.claimCitedSectionOpenalways claims → the remount test fails (1 failed, 7 passed); restored → 8/8.Acceptance notes
recordSectionAnchor.ts'slocateSectionand are not one line each; they stay open and are carried by 37487 跟进:引用定位在同名标题与空段落两个边角的处理 #37562./ai/ask/CONVERSATIONresolves into the dock over the app's home page, so the dock and/aiwere one surface in the browser check.Verification
pnpm run type-checkinui/packages/plugin-chatbotandui/packages/app-shell, exit 0. The local whole-suite run of both packages (vitest run packages/plugin-chatbot/ packages/app-shell/) was stopped after 61 min with one failure, which was my own ablation edit made while it ran; the narrowing is declared, and CI'sTest UI(all shards) is green on e2833f9. Rework head 40bb8ee (changeset, jsdoc only): CI check-runs 46 success, 10 skipped before this body edit; the PR-body guards rerun on the edit.pnpm --dir ui exec vitest run packages/app-shell/src/console/ai/__tests__/AiChatPage.recordCitationsReload-37487.test.tsx packages/plugin-chatbot/src/__tests__/useObjectChat.recordCitationsReload-37487.test.tsx, expected 9 passed.objectstack dev --seed-admin) with theui/console dev server pointed at it, driven by Playwright at 1360x900 and as an iPhone 13. Injected, not produced: no producer emits the part before cloud 10c, so the run serves the conversation-history read (GET /api/v1/ai/conversations/ID) with an answer carrying adata-record-citationspart, and, because this boot has no model, serves a one-agent catalog (GET /api/v1/ai/agents) so the assistant shows. The cited record is a Field Zoo record whosemarkdown,htmlandrichtextbodies each hold a cited heading below several screens of text./apps/com.example.showcase/showcase_field_zoo/record/ID?section=ANCHOR; the cited heading is the one marked and sits just under the sticky record header (top 89 px desktop, 45 px phone):contractor-scope(markdown),html-retention(html),rich-escalation(richtext).?palette=1, replace) and closing it leaves the page there; opening the record form (?form=ID, push) and Back leaves the page there (before the remount fix it scrolled back, which is how the remount was found). A probe onscrollIntoViewrecords no call.objectstack-seat5/ai-36996/shots-37487/in the project files (9 images plus the script).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG
Generated by Claude Code