Repository navigation
fix(chatbot): redraw record-citation chips after a reload; keep the cited-section scroll to new clicks - #37539
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 |
…nner its height back (objectstack-ai#37588) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_ Fixes objectstack-ai#37528 ## What changes - `ChromeBannerSlot` (`app-shell/src/layout/chromeBannerHost.tsx`): when the console's standing banners (impersonation, read rate, storage) are drawn **in place** above the routes, a `display: contents` wrapper measures them (`ResizeObserver` on each child, `MutationObserver` for banners that come and go) and publishes the summed height as `--os-chrome-banners` on the document root; cleared on unmount and while nothing is drawn. Drawn into an app layout's host (desktop, inside an app, objectstack#36112) nothing is published, as that host sits inside the content area. - The console's full-height shells take the viewport less that property, through `CONSOLE_FULL_HEIGHT` (module-local constants, literal Tailwind classes): `AppShell` in `@object-ui/layout` (height, and a `min-h-` that tailwind-merge puts in place of the sidebar wrapper's own `min-h-svh`), `StudioDesignSurface`, `HomeLayout`, `AiChatPage`, the two organization layouts, the app-unavailable / no-app screens in `AppContent`, and `StudioRoute`'s access-required screen. The property is unset outside the console and on an ordinary session, so every class there computes to the plain viewport height. - The banner keeps its place in flow (objectui#4467) and its `sticky`; nothing about where it is drawn changes. ## Why While an administrator impersonates a user, the banner sat in flow above a shell that still took `100svh` / `100vh`, so the document was taller than the window by the banner's height: list footers and bulk action bars fell below the fold and the page grew a second scrollbar. Measured on `main` (4116465) in a local console against `examples/app-crm` (`--fresh`), impersonating a seeded user, `document.documentElement.scrollHeight` against `innerHeight`: | page | 1280×768 before | 1280×768 after | 390×844 before | 390×844 after | |---|---|---|---|---| | `/home` | 768 / 768 (redirects into the app) | 768 / 768 | 921 / 844 | 844 / 844 | | an app list (`crm_lead`) | 768 / 768 (objectstack-ai#36112 host) | 768 / 768 | 921 / 844 | 844 / 844 | | `/studio` | 821 / 768 | 768 / 768 | 921 / 844 | 844 / 844 | The first push fixed `/home` only: the sidebar wrapper's own `min-h-svh` and Studio's access-required screen still overflowed, which the second commit covers. ## Verification - New `layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx` (5 cases: in place publishes the summed height and clears on unmount; no banner publishes nothing; a resize and a banner going away republish; drawn into the host publishes nothing; every full-height class reads the property with a `0px` fallback). With `chromeBannerHost.tsx` restored from `main`, 3 of the 5 go red (the two "nothing published" cases are controls). - `pnpm --dir ui exec vitest run` over `packages/layout/`, `packages/app-shell/src/layout/`, `src/console/__tests__/`, `src/console/home`, `src/console/ai`, `src/console/organizations`, `src/views/studio-design`, the print stylesheet pin, `apps/console/src/components` and the boot-redirect pins: all green (3,325 + 3,862 tests). `ai-surface-unavailable` in `ConsoleShell` is deliberately left on `h-screen`: `bootRedirectCoverage.test.tsx` reads that class as the full-viewport cover. - `type-check` for `@object-ui/app-shell` and `@object-ui/layout`: clean. `eslint` on the changed files: 0 errors. - The full UI suite runs in this PR's CI. - `overlap-check`: exit 0 (shares `StudioDesignSurface.tsx` with objectstack-ai#37546 and `AiChatPage.tsx` with objectstack-ai#37539, both merge cleanly). Clause-②: no Metadata-protocol: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `eslint` on the changed files passes (the full `pnpm lint` runs in CI). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [ ] The *Before Submitting* list in CONTRIBUTING.md is done. (full local suite not run; CI carries it) --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri --------- Co-authored-by: Claude <noreply@anthropic.com>
…objectstack-ai#37571) <!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg8JRuu4biowMGgDVcNVcsSp)_ Fixes objectstack-ai#37556 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在手机上用应用内 AI,点回答下方的引用后,AI 对话面板自动收起,直接看到被标出的那一段;再打开 AI 面板,还是原来的对话。电脑上面板照旧留在页面旁边。 - 为什么做:记录 AI 问询专题里引用条的跟进,原先手机上点引用像没反应,要手动关面板才看得到。 - 出错会怎样:手机上点 AI 里的链接后面板该收不收或不该收时收起;对话和数据不受影响,撤回本次合并即可恢复原样。 - 要你做什么:无。 ## What changes - `ui/packages/app-shell/src/layout/useConsoleChatDock.tsx`: on a phone (the drawer is a bottom sheet over the page), the host closes the sheet when the location moves by a PUSH or POP away from the history entry (`location.key`) the sheet was shown open on. A PUSH onto the same URL counts (a second click on the same citation chip carries fresh section state to the same URL). A REPLACE never closes it: a page rewriting its own query, the host's handoff hand-over, and an old `/ai…` link landing with the drawer armed open all stay as they were. - The entry the sheet was shown on is kept per tab in sessionStorage (`ai-chat-dock-sheet-shown-at`, cleared whenever the sheet is closed), not in the hook: a chip in a sheet opened over Home lands on an app's record through another layout, which mounts a new dock host that never saw the navigation (found by the first booted check). Where sessionStorage throws, a module copy stands in, so the rule still works for the life of the page. - Review rework (contract review 7195408408, seat REWORK 7195422188): - S1: the move away is noted on the navigation itself, before the phone check. `useIsMobile` answers `false` on a host's first render; an app named by its alias lands through `AppContent`, which REPLACEs the address on mount, so a rule judged only once the flag settled saw that REPLACE and kept the sheet open. - N1: at a desktop width (read off the window, since `useIsMobile`'s first-render `false` cannot tell) the entry is dropped, so turning a tablet portrait, landscape, portrait does not close the drawer on the turn. - S2: a POP case is pinned. N3: the storage-failure jsdoc is corrected and the in-memory fallback added. N2 and N4 accepted as they are. - The rule lives in the host, not at the chip: every navigation the chat makes on a phone (citation chip, `open_record`, list link, open-form) now reveals the page; the chip's click path is not touched. - The conversation is kept: closing only collapses the sheet; the dock target is untouched, so reopening shows the same thread. Desktop rail and the full-window rule are unchanged. - Changeset `.changeset/37556-phone-dock-closes-on-citation.md` (patch, `@object-ui/app-shell`). Read first: `useConsoleChatDock.tsx`, the effect under the full-window one and the storage helpers above `hasHandoff`. ## Tests - `ui/packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx` (9): the real host, `useChatDockState` and router; `useIsMobile` is a stand-in with the real hook's timing (`false` on the first render, measured in its mount effect, again on resize); stand-in sheet/rail. Cases: a phone chip click (PUSH) closes the sheet and reopening with no target shows the same conversation; a same-URL re-click closes it; Back (POP) closes it; a chip from Home into an app (two layouts, two hosts) closes it and reopening shows the same thread; the alias landing (a parent `AppContent`-shaped redirect REPLACEs on mount while the new host's flag is held back one task) closes it; with `window.sessionStorage` throwing, a chip click closes it; a same-page REPLACE leaves it open; a tablet turn to landscape, a chip click there, and a turn back leaves the drawer open; CONTROL: at desktop width the rail stays open after a chip click. - The new tests against the previous head's hook (b220ce8): 3 failed (alias landing, storage throwing, tablet turn), 6 passed. - Ablation (the `collapse()` call replaced by a no-op): 6 failed, 3 passed (every closing case red; the REPLACE case, the tablet turn and the desktop control green); restored 9/9. ## Acceptance notes - Acceptance 1 (test): above. - Acceptance 2 (booted-console phone check): see Verification. ## Verification - Local on e4692c3: the new test 9/9; `@object-ui/app-shell` `type-check` exit 0; derived gate families: see the report. The package's whole suite is left to CI's `Test UI` (test-run scope, not a Clause-② narrowing). - Two-minute check: `pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx`, expected 9 passed. - Booted-console phone check (iPhone 13 profile). Showcase app (`objectstack dev --seed-admin`) with the `ui/` console dev server pointed at it, on `main` (which now carries PR objectstack-ai#37539, so history draws chips) merged with this branch. **Injected, not produced**: no producer emits the citations part before cloud 10c, so the run serves the conversation-history read with an answer carrying a `data-record-citations` part, and a one-agent catalog because the boot has no model. - Package address: the old `/ai/ask/CONVERSATION` link lands on Home with the sheet open and 3 chips. Chip click: `/apps/com.example.showcase/showcase_field_zoo/record/ID?section=contractor-scope`, sheet gone (0 in the DOM), the marked heading `Contractor scope` at top 45 px, in view. Reopening: the same 3 chips. The same chip again: sheet gone, heading in view. - Alias path (S1): the object read is served with the app's NAME (`showcase_app`) as its package, so the chip lands on `/apps/showcase_app/…` and the app shell REPLACEs it with `/apps/com.example.showcase/…`. Sheet gone, heading at top 45 px, in view; reopening shows the same chips; the same chip again closes it again. - Screenshots: `objectstack-seat5/ai-36996/shots-37556/` in the project files (`phone-dock-*.png` and `phone-alias-dock-*.png`, four each, plus the script). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CXDoFxnz75MqdAxLSW)_ <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CXDoFxnz75MqdAxLSW --> --------- Co-authored-by: Claude <noreply@anthropic.com>
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