Repository navigation
feat(plugin-chatbot): an ask answer that saved drafts shows a draft review card, from a new spec part data-draft-review - #38102
Conversation
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
…nks types Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e73580db61d84de5f2bcaf306a59e10c4a825066 && git checkout e73580db61d84de5f2bcaf306a59e10c4a825066
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9 3a44ab65ad421afb684e06cf8fc4faf3253e76c8 && git checkout -B drift-repro 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9 && git merge --no-ff 3a44ab65ad421afb684e06cf8fc4faf3253e76c8
node scripts/docs-audit/affected-docs.mjs --json 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9
|
|
repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i Contract review brief — PR #38102 @
|
…dded The new schemas move packages/spec/authorable-surface/ai.json, so the part is a metadata-protocol addition graded minor, as for #37930. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN
|
repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i Contract reviewServed-tier: This record covers Remainder, the lane seat's ACCEPT at TIER_DEFAULT: the two test files under ① Derived judgments
② Semver levelM1 (must-fix) — the declaration at this head is wrong.
③ Boundary flags
④ Design judgment
S1 (should-fix) — the Console-path pattern does not keep a link on the site.
The card puts the value into the anchor's What holds: S2 (should-fix) — the contract does not say whether a draft saved twice in one turn is one row or two. Q1, shape against the card and the amendment: holds, apart from S1. The limits are right: 1 to 50 rows, Q2, reuse of Q6, as a contract for cloud#5172: the shape in report 7232350452 agrees with the schema key for key, and the generated reference page carries the module text (producer, timing before
Live only (Q5): true in the console, and it is what the card asks (ruling Q2 = A). The part is not in
Nits, none of which changes the verdict:
Not read: objectstack-ai/cloud#5172 (the producer), and Implemented-by: VERDICT: FAIL |
|
repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i L1-c, the seat's L1 thread · 2026-11-28T02:34Z 席位核对 — L1 @
|
- consolePath now refuses a backslash, whitespace or a control character anywhere in the value: a browser reads `/\host` and `/<tab>/host` as `//host`. The builders percent-encode every segment, so their links pass. - `drafts` states one row per draft, unique by package, type and name, at its first save with the verdict read last; `omitted` counts drafts. - The changeset no longer says every level is closed: the findings keep RuntimeAuthoringIssueSchema's own shape, which drops unknown keys. A test pins that. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibw1AHBDKuYXJdbT1PN
|
repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i Contract reviewServed-tier: Delta record. It follows record 7232434714 (FAIL at Remainder, the lane seat's ACCEPT at TIER_DEFAULT: as in the earlier record. ① Derived judgments
② Semver levelM1: closed. The spec changeset reads ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. S1: closed. I tried the pattern against the two values from the earlier record and against others:
The pattern has no S2: closed. The N1: closed. The changeset, the PR body and the test header now say the five new objects are closed and that a finding keeps Nits left as accepted deviations, none of which affects the verdict:
Not read: objectstack-ai/cloud#5172, and Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i L1-c, the seat's L1 thread · 2026-11-28T03:28Z 席位核对 — L1 delta @
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T03:29Z · zone
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Requested by Tesla · project thread
Fixes #38048
Clause-②: yes (widening)
Metadata-protocol: added
维护者速读
What changes
Spec (
packages/spec/src/ai/draft-review.zod.ts). New in@objectstack/spec/ai:DRAFT_REVIEW_PART_TYPE = 'data-draft-review',DRAFT_REVIEW_MAX = 50andDraftReviewListSchemawith its row, verdict, verdict-refusal and links schemas and types. The five new objects are closed (an unknown key is refused); the findings inrefusals/advisorieskeep the door's ownRuntimeAuthoringIssueSchemashape, which drops a key it does not know. Final part shape (cloud#5172 follows it):Refinements against the card's sketch, per the seat ruling on the claim:
refusals/advisoriesreuseRuntimeAuthoringIssueSchema(@objectstack/spec/api), the shape the door'slist_draftsverdict returns. Also:verdictmust be present (null, never left out);verdictWithheld/verdictErrorcarry the door's own{ code, message, status };reviewis closed at{ changes, item }, so the door'snoteis not forwarded;draftsholds at least one row; both review links must be Console paths that stay on the site, since the card renders them as anchors and hands them tonavigate: one leading/, never//, and no backslash, whitespace or control character anywhere (a browser reads/\hostand/<tab>/hostas//host; the@objectstack/typesbuilders percent-encode every segment, so their links pass).draftshas one row per draft, unique bypackage,typeandname: a draft saved more than once in the turn is one row, placed at its first save, with the verdict read last; the cap andomittedcount drafts, not saves.Chat (
ui/packages/plugin-chatbot).mapMessages.ts:extractDraftReview(parts)reads the lastdata-draft-reviewpart throughDraftReviewListSchema; a refused part isundefined.uiMessageToChatMessagesetsdraftReviewon the message. It is not added toSTORED_ANSWER_DATA_PARTSorstoredAnswerData(seat ruling Q2 = A, live only).chat/DraftReviewCard.tsx(+chat/draftReviewGroups.ts): rows grouped by package in save order; per row the label or name, the type, a verdict badge (will publish / N problems / verdict withheld, with the door's message as its title) and a Review link toreview.item; "checked when saved" whenverdictReadissave; per package one "Review and publish" link toreview.changes;omittedas "+N more". No button at all (seat ruling Q1 = A).ChatbotEnhanced.tsxdraws the card under the answer, after the record citations. New optional propsonOpenReviewLink(path)(a plain left click navigates in the app, so the live-only card is still there) andreviewLinkHref(path)(the anchor href, for a new tab).chatMessageAdapter.tslistsdraftReviewamong the runtime-only message keys.index.tsxexportsDraftReviewCard,DraftReviewCardPropsandextractDraftReview.Console (
ui/packages/app-shell/src/console/ai/ChatPane.tsx). WiresonOpenReviewLinktonavigateandreviewLinkHreftodocumentHref(useHref('/'), path), so the href carries the console's basename.Strings.
chatbot.draftReview.*in the ten hand-written packs,zh-Hantregenerated;problemsandmoreare plural families with every CLDR category each pack's language selects.Docs. A "Draft review card" section on
content/docs/frontend/plugins/plugin-chatbot.mdxand in the package README. Regenerated spec artifacts: api-surface, authorable-surface, declaration-map, export-origins, json-schema manifest, thedraft-reviewreference page and its index entries, and the strictness-ledger AI counts.Files to read first, by risk:
packages/spec/src/ai/draft-review.zod.ts(the contract cloud builds to),ui/packages/plugin-chatbot/src/chat/DraftReviewCard.tsx(link click handling),ui/packages/plugin-chatbot/src/mapMessages.ts(extractDraftReviewand that nothing stores it).Tests
Run on head
3a44ab65aunless noted. Sincefb2070cdathe head changed only the spec module, its test, the generated reference page and the spec changeset; no UI file changed, so the UI readings markedfb2070cdastand.Readings
pnpm --filter @objectstack/spec test→ Test Files 910 passed (910), Tests 28811 passed, 1 todo. Includessrc/ai/draft-review.test.ts(12 cases: the five new objects closed,verdictnull but present, the 50 cap,omittedat least 1; review links refused forhttps:,//,javascript:, a relative path, the empty string,/\evil.example/x, a slash-tab-slash and a slash-newline-slash value, a space and a NUL, in bothitemandchanges; a builder-shaped link with percent-encoded segments admitted; an unknown key on a finding dropped, keeping the door's shape).pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-chatbot/→ Test Files 187 passed (187), Tests 2615 passed, 13 skipped.DraftReviewCard-38048.test.tsx(10): rows, badges, hrefs and accessible names from a stream fixture built throughuiMessageToChatMessage; plain click goes throughonOpenReviewLinkwith the default prevented, a ctrl-click does not; no button in the card; a refused part (ajavascript:review link) renders the answer and no card, the control renders the card; a turn without the part has nodraftReview; the part is not a kept data part.DraftReviewCard.i18n-38048.test.tsx(3): en, zh-Hans and ru strings from the shipped packs throughI18nProvider, with the ru few and many forms of the problem count.pnpm --dir ui exec vitest run packages/app-shell/src/console/ai/ packages/app-shell/src/hooks/__tests__/useChatConversation.test.tsx packages/app-shell/src/__tests__/product-neutral-renderer.ratchet.test.ts packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts→ Test Files 39 passed (39), Tests 330 passed (fb2070cda).pnpm --filter @objectstack/spec typecheck→ exit 0;pnpm --filter @object-ui/plugin-chatbot type-check,pnpm --filter @object-ui/i18n type-check,pnpm --filter @object-ui/app-shell type-check→ all exit 0 (fb2070cda).npx eslinton every changed source file → 0 errors.node scripts/check-changeset-no-major.mjs --base origin/main --event <this body>→ exit 0; the same run withMetadata-protocol: none→ exit 1.Acceptance notes
DraftReviewCard-38048.test.tsx.aria-labelnaming the draft or package and Studio; the card is a labelledsection.DraftReviewCardthroughI18nProvider) at card widths 320 px and 280 px, for en, zh-Hans, zh-Hant, ja, ko, de, fr, es, pt-BR, ru and ar (RTL), with a long label, a long name, a long package name, 12 refusals andomitted: 23. In all 22 renders no element extends past the card, nothing scrolls sideways, and each of the three verdict badges is one line. Control: the same probe at 90 px reports the card scrolling and 21 spilling elements, so the probe can fail.chatMessageAdapter.ts(one key inRuntimeOnlyMessageKeys),chat/draftReviewGroups.ts(the grouping helper, kept out of the component file for fast refresh), a second test fileDraftReviewCard.i18n-38048.test.tsx(pack strings need their own file, because a mountedI18nProviderinstalls a module-level i18next global), and the extra propreviewLinkHref.core.tsis not touched:extractDraftReviewlives inmapMessages.ts, which the light core entry does not import.Verification
Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/DraftReviewCard-38048.test.tsx→ 10 passed.Derived gates
node scripts/pm/dispatch-gates.mjs --commandsderives 110 families at3a44ab65a(the same list as atfb2070cda). All 110 ran on3a44ab65aafter a build of every package underpackages/(turbo run build --filter='./packages/**', 83 tasks successful); 110 exit 0.--ranreconciliation: "110 derived famil(ies) accounted for — 110 run, 0 NOT-MEASURED".pnpm check:dual-build-cjs-loads→ exit 0: "126 published require entry point(s) across 74 package(s) load; 2593 emitted CommonJS file(s) parse".61fee1dadfound two real reds, both fixed beforefb2070cda:check:llms-txt(theairow and the inventory heading now countdraft-review.zod.ts) andcheck:spec-parsed-alias(ADR-0122…Parsedtwins for the verdict, refusal and links types).check-plugin-teardown-shape --self-testneeds a pinned commit a shallow clone lacks; fetching that one commit was enough, and it passed.Generated by Claude Code