Repository navigation
feat(chatbot): draw verified record citations as chips that open the cited section - #37485
Conversation
…e record at the cited section Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 6098102 · 2026-11-26T08:33Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: PR #37485 (card #37365, epic #36996 row 10b). Declaration face: the paths decide no face, the changeset's ① Derived judgmentsVerdict in one line: no must-fix. Four should-fix, five nits. The security questions come out clean; the "never a wrong heading" claim does not hold as written (S1). 1. Security and leaks: clean.
2. 3. Point (a), the heading locator. S1 (should-fix) —
S2 (should-fix) — a second citation of the same record leaves the first mark on. Accepted as disclosed: the body is the first long-text field in field order whose outline issues the anchor, not the pack's 4. Point (b), surface beyond the claim: acceptable. The report lists the extra files under 5. Points (c) and (d).
S4 (should-fix) — the browser reading is NOT MEASURED and has no carrier. The substitute (the real 6. Point (e): #37487 is the right carrier. Open, S3 (should-fix) — the docs and the changeset claim more than the head delivers. Both say an answer "now draws" its citations and that "the list is drawn as it was persisted". On this head no producer emits 7. Locales: clean. Nits.
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha: Security came out clean:
S1–S3 close in this PR before ACCEPT. S4 needs a named carrier.
|
…s, and move the mark The record page's section locator now carries the outline's count of same-titled headings and opens the field, not a heading, when the drawn face draws a different number of them (a setext, quoted or listed duplicate, or an outline heading the face does not draw), and when the heading has no letter or digit. The focus cleanup takes the mark off, so a second citation leaves only its own section marked; each chip click carries a fresh history-state value, so the same chip opens its section again. The changeset and the two doc pages now say the console draws a verified citations part when an answer carries one, not yet after a reload. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta round on PR #37485 (card #37365, epic #36996 row 10b), declaration face. It follows record 7186860933 on ① Derived judgmentsVerdict in one line: no must-fix. S1, S2 and S3 are closed, S4 is carried on #37487, N2 and N3 are closed. The S2 fix opens one new should-fix (S5): the focus now re-runs when a navigation drops the history state. Earlier findings. S1 (should-fix) — CLOSED. S2 (should-fix) — CLOSED, with S5 as its consequence. S3 (should-fix) — CLOSED. The changeset title and body, S4 (should-fix) — CARRIED on #37487. Seat comment 7186889924 on that card adds the booted-console check to its acceptance: chips drawn, a chip click opening N1 (nit) — OPEN, accepted by the seat as a deviation. Dot segments in New this round. S5 (should-fix) — a navigation that drops the history state re-opens the cited section. N6 (nit) — the count check narrows S1's fault, it does not exclude it. A body with one same-titled heading the outline does not list AND one listed heading the face does not draw has equal counts and can still resolve to the other heading; so can a face that drew its headings one at a time. The markdown face draws in one commit, and the real-view pin holds. The PR body is worded correctly; the two test titles that say "never that heading" claim slightly more than the rule gives. N7 (nit) — a heading with an empty reading opens the field only after the 4 s settle: Unchanged from the first round, re-read on this head. Security is clean: Check-runs on the head: 66 completed, 54 success, 12 skipped, 0 failed, as the area reports. ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc Landing: ACCEPT 7190174620 (delta contract record 7190126794, PASS) at head
Status: ready + auto-merge (merge queue). On MERGED, #37365 closes by |
Fixes #37365
Clause-②: yes (a new reserved URL parameter
section)Metadata-protocol: none
维护者速读
What changes
Governing text: ADR-0160 D9 as amended by #37363; ruling 7177410380 on #37144 (Q1 A: draw the persisted, already-verified list, never re-verify; Q3 A: a related-row quote opens the root record).
plugin-chatbot/src/mapMessages.ts):extractRecordCitations(parts)reads the lastdata-record-citationspart (RECORD_CITATIONS_PART_TYPE) through the spec'sRecordCitationsSchema. A part the schema refuses, or an empty list, is no list (thedetectAnswerSourceprecedent).uiMessageToChatMessagecarries it asrecordCitations;chatMessageAdapter.tsnames the new render-only key.plugin-chatbot/src/RecordCitations.tsx, new; drawn inChatbotEnhanced.tsxbesideAnswerSourceBlock): one chip per citation showing the quote. A click callsonOpenRecord({ objectName: object, recordId: id, anchor });onOpenRecord's argument gains an optionalanchor. Nothing is fetched or verified on display.app-shell/src/console/ai/AiChatPage.tsx):openRecordtakes the optionalanchorand navigates torecordOpenTarget(app, …)=/apps/APP/OBJ/record/ID?section=ANCHOR. The dock and the/aipage both draw thisChatPane.app-shell/src/urlParams.ts):RECORD_SECTION_PARAM = 'section', inRESERVED_URL_PARAMSand the param table.RECORD_SECTION_OPENED_STATEis a history-state key, not a URL parameter (theRECORD_COMMENTS_PUSHED_STATEprecedent).app-shell/src/views/recordSectionAnchor.ts, new; wired inRecordDetailView.tsx): once the record is held, the spec'sheadingsOfruns on each long-text field (markdown,html/richtext,textarea) in field order; the first whose outline issues the anchor is the body. The heading element is found in that field's drawn face and scrolled to and marked (the linked-comment marking). The match is trusted only when the face draws exactly as many headings of that title as the outline lists. Atextareabody, a heading that is not drawn within 4 s, a count that differs, or a heading with no letter or digit scrolls to the field. A stale anchor opens the top. The cleanup takes the mark off, so opening another section moves the mark. Each chip click carries a fresh history-state value (RECORD_SECTION_OPENED_STATE), so the same chip clicked again opens its section again; a navigation that keeps the state, such as a tab switch, does not.plugin-detail/src/DetailSection.tsx): each detail row carriesdata-detail-field={field.name}, which is how the page finds a field. One attribute, no behaviour change.chatbot.recordCitations.titlein all 11ui/packages/i18nlocales.content/docs/frontend/plugins/plugin-chatbot.mdx,ui/packages/plugin-chatbot/README.md; changeset.changeset/37365-record-citation-chips.md(patch, four@object-ui/*packages).Read first, by risk:
ui/packages/app-shell/src/views/recordSectionAnchor.ts:locateSection(how a drawn heading is matched) andfocusRecordSection(observer and settle timer).ui/packages/plugin-chatbot/src/mapMessages.ts:extractRecordCitations(the parse gate).ui/packages/app-shell/src/views/RecordDetailView.tsx: the effect besideholdsRouteRecord.Tests
Head
c1b30e6a0b. Every run went throughscripts/pm/os-verify-lock.shon a shared box.plugin-chatbot/src/__tests__/ChatbotEnhanced.recordCitations-37365.test.tsx(lift through the spec schema; chips; a refused part draws nothing with a CONTROL leg; no fetch on display; related-row quote opens the root record; record-link grammar still refuses a fragment, with a CONTROL);app-shell/src/views/recordSectionAnchor.test.tsx(anchor derived as the server derives it; matching by reading with repeats; a same-titled heading the outline does not list, a listed heading the face does not draw, and a heading with no letter or digit each open the field, each with a CONTROL; textarea opens at the field; a heading never drawn settles on the field; stale anchor moves nothing, with a CONTROL; the cleanup unmarks, keeping a class the heading already had; the same section opened again scrolls and marks again);app-shell/src/views/RecordDetailView.citedSection-37365.test.tsx(the REALRecordDetailViewand the real markdown face:?section=scopemarks and scrolls the first Scope,scope-2the second, a textarea body scrolls to the field, a stale anchor opens the top with a CONTROL, a setextScopeabove the cited# Scopeopens the field with a CONTROL, a second chip moves the mark and the same chip again scrolls again, CONTROL a state-keeping replace does not); a new describe inAiChatPage.recordLink-13037.test.tsx(the realChatPane: the chip opens/apps/APP/OBJ/record/ID?section=scopeunder a/_consoleand a root mount; each click carries a fresh opened-state value; a related-row quote opens the root record with no section).Whole suites of the four touched packages, at c1b30e6
@object-ui/plugin-chatbot:Test Files 104 passed (104) · Tests 1089 passed (1089)@object-ui/i18n:Test Files 111 passed (111) · Tests 2028 passed | 13 skipped (2041)@object-ui/plugin-detail:Test Files 419 passed | 1 skipped (420) · Tests 3968 passed | 18 skipped (3986)@object-ui/app-shell:Test Files 2437 passed | 1 skipped (2438) · Tests 23428 passed | 9 skipped (23437)VERDICT command-exit 0, each package exit 0.type-check: app-shell exit 0 atc1b30e6a0b. plugin-chatbot, plugin-detail and i18n exit 0 at60981028c; this round changes no source of theirs.exit 0(dispatch-gates --ran: "a DERIVED zero"),check:type-check-debtincluded.Ablation of the parse gate (round 1, at 6098102)
node scripts/ablation-replace.mjsreplaced theRecordCitationsSchema.safeParselines inextractRecordCitationswith a bareArray.isArraypass-through (anchor x1 to x0, blob0354c5b73c28to400078723215). The chip test then went red:Tests 5 failed | 9 passed (14); the failing tests were the four refused-part cases and "a part that fails the parse draws nothing". Restored: blob equals HEAD (0354c5b73c28) andgit diff HEADis empty. plugin-chatbot resolves tosrcthrough the vitest alias, so nodistrebuild was involved. This round does not touch that file.Mutation of the count check (round 2, at c1b30e6)
node scripts/ablation-replace.mjsreplaceddrawn.length === candidate.count ? drawn[candidate.ordinal] : undefinedinlocateSectionwithdrawn[candidate.ordinal](anchor x1 to x0, blob20eec4db25edtof4f48f4f6379). The two section test files then went red:Tests 3 failed | 21 passed (24). The failures were the same-titled unlisted heading and the listed-not-drawn heading pins inrecordSectionAnchor.test.tsx, and the setext pin inRecordDetailView.citedSection-37365.test.tsx. Restored withgit checkout HEAD --: blob equals HEAD (20eec4db25ed) andgit diff HEADis empty. app-shell tests import their ownsrc, so nodistwas involved.Acceptance notes
section, so the page cannot read the citation'scontextpack. It runsheadingsOfon every long-text field the record holds (markdown,html,richtext,textarea), in field order, and the first whose outline issues the anchor is the body. When the pack's body field holds the anchor, the result is the same. Another long-text field earlier in the field order that has a heading with the same anchor would be opened instead. The alternative, reading the pack'sbody.field, would needcontexton the URL as well; it was not taken.headingsOfdoes not list: setext headings, an empty#, headings inside a quote or a list, an indented ATX heading, and emptyh1-h6in html. The outline also lists headings the face does not draw, such as a#line inside a raw HTML block or a four-backtick fence. With a bare Nth-element rule, each of these shifts every later heading. The rule taken (locateSection) has two parts. First, among the field's drawn heading elements, it picks those whose letters and digits read the same as the outline's heading and indexes them by the outline's repeat count. Second, it trusts that index only when the face draws exactly as many headings of that reading as the outline lists. Otherwise it opens the field, and it also opens the field for a heading with no letter or digit. So a differing heading of another title shifts nothing. A same-titled one, or a listed one the face does not draw, opens the field rather than a heading that may be another. A heading whose raw text carries letters the face does not draw (a link's URL) reads differently and opens at the field too. Two headings that normalise alike (CandC++) are told apart by order, which both sides share.RECORD_SECTION_OPENED_STATEvalue on each chip click, and the record page keys the focus on record, anchor and that value. So the same chip clicked again (same URL) scrolls and marks again. The tab and comment writers replace the URL keepinglocation.state, so they do not re-scroll.ui/packages/plugin-detail/src/DetailSection.tsxgets onedata-detail-fieldattribute on each detail row. Without it the page has no way to find a field, so the textarea and not-drawn cases could not open at the field. (2)ui/packages/plugin-chatbot/src/chatMessageAdapter.tsgets one key onRuntimeOnlyMessageKeys, the declared place for a new render-only message key. (3) The new helperui/packages/app-shell/src/views/recordSectionAnchor.ts. (4) The chatbot docs page and README. overlap-check is clean againstorigin/mainand against feat(spec,ui): a field can be read-only by hand at the console while writes keep it (uiReadonly / uiReadonlyWhen) #37436, which sharesDetailSection.tsxand the 11 locale files (disjoint hunks), and feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422, which shares the 11 locale files./aipage rebuilds history, it drops anydata-*part other than charts:hydratedMessagesToChatMessages, thenuseObjectChat'sinitialMessagesrebuild, then the browser display cache (sanitizeChatMessagesForCache). So a persisted citation list does not come back after a reload yet; 37365 跟进:刷新或重开对话后,AI 回答下方的引用消失 #37487 carries it. Nothing onmainemits the part before cloud 10c. The changeset and both doc pages say so: the console draws a verified citations part when a live answer carries one.onOpenRecord's argument gains an optional member (widening). No spec file changed.Verification
html/richtextbodies. In its place,RecordDetailView.citedSection-37365.test.tsxrenders the real record page with the real markdown face.data-record-citationspart covers (cloud 10c). Click a chip. Expected: the address is/apps/APP/OBJ/record/ID?section=ANCHOR, the cited heading is scrolled into view with the accent ring, and an edited-away heading opens the record at its top.Generated by Claude Code