Skip to content

feat(plugin-chatbot): an ask answer that saved drafts shows a draft review card, from a new spec part data-draft-review - #38102

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/project-thread-qdbmce
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/project-thread-qdbmce

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Requested by Tesla · project thread

Fixes #38048

Clause-②: yes (widening)
Metadata-protocol: added

维护者速读

  • 用户能看到的变化:管理员在问 AI 对话里让 AI 搭建、AI 存下草稿后,回答下面多出一张卡,列出这一轮存的每个草稿、能否发布或有几个问题,并带去 Studio 审阅和发布的链接。
  • 为什么做:属于「问 AI 搭建」专题(cloud 管理员技能),管理员不用再去 Studio 里找刚才存了什么。
  • 出问题会怎样:最坏是卡片不出现,回答照常显示;卡上没有发布或丢弃按钮,不会误改数据,回滚这一个合并即可。
  • 要你做什么:无。

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 = 50 and DraftReviewListSchema with its row, verdict, verdict-refusal and links schemas and types. The five new objects are closed (an unknown key is refused); the findings in refusals / advisories keep the door's own RuntimeAuthoringIssueSchema shape, which drops a key it does not know. Final part shape (cloud#5172 follows it):

{ type: 'data-draft-review', id: 'draft-review', data: {
    drafts: [{                                   // 1..50, save order, one row per draft (unique by package+type+name)
      type, name, package,                       // non-empty strings
      label?,                                    // non-empty string
      verdict: { publishable, refusals: RuntimeAuthoringIssue[], advisories: RuntimeAuthoringIssue[] } | null,
      verdictWithheld?: { code, message, status },
      verdictError?: { code, message, status },
      verdictRead: 'turn-end' | 'save',
      review: { changes, item },                 // Console paths: one leading slash, never two, no backslash/whitespace/control char
    }],
    omitted?: number } }                         // integer >= 1, absent when none

Refinements against the card's sketch, per the seat ruling on the claim: refusals / advisories reuse RuntimeAuthoringIssueSchema (@objectstack/spec/api), the shape the door's list_drafts verdict returns. Also: verdict must be present (null, never left out); verdictWithheld / verdictError carry the door's own { code, message, status }; review is closed at { changes, item }, so the door's note is not forwarded; drafts holds 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 to navigate: one leading /, never //, and no backslash, whitespace or control character anywhere (a browser reads /\host and /<tab>/host as //host; the @objectstack/types builders percent-encode every segment, so their links pass). drafts has one row per draft, unique by package, type and name: a draft saved more than once in the turn is one row, placed at its first save, with the verdict read last; the cap and omitted count drafts, not saves.

Chat (ui/packages/plugin-chatbot).

  • mapMessages.ts: extractDraftReview(parts) reads the last data-draft-review part through DraftReviewListSchema; a refused part is undefined. uiMessageToChatMessage sets draftReview on the message. It is not added to STORED_ANSWER_DATA_PARTS or storedAnswerData (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 to review.item; "checked when saved" when verdictRead is save; per package one "Review and publish" link to review.changes; omitted as "+N more". No button at all (seat ruling Q1 = A).
  • ChatbotEnhanced.tsx draws the card under the answer, after the record citations. New optional props onOpenReviewLink(path) (a plain left click navigates in the app, so the live-only card is still there) and reviewLinkHref(path) (the anchor href, for a new tab). chatMessageAdapter.ts lists draftReview among the runtime-only message keys.
  • index.tsx exports DraftReviewCard, DraftReviewCardProps and extractDraftReview.

Console (ui/packages/app-shell/src/console/ai/ChatPane.tsx). Wires onOpenReviewLink to navigate and reviewLinkHref to documentHref(useHref('/'), path), so the href carries the console's basename.

Strings. chatbot.draftReview.* in the ten hand-written packs, zh-Hant regenerated; problems and more are plural families with every CLDR category each pack's language selects.

Docs. A "Draft review card" section on content/docs/frontend/plugins/plugin-chatbot.mdx and in the package README. Regenerated spec artifacts: api-surface, authorable-surface, declaration-map, export-origins, json-schema manifest, the draft-review reference 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 (extractDraftReview and that nothing stores it).

Tests

Run on head 3a44ab65a unless noted. Since fb2070cda the head changed only the spec module, its test, the generated reference page and the spec changeset; no UI file changed, so the UI readings marked fb2070cda stand.

Readings
  • pnpm --filter @objectstack/spec test → Test Files 910 passed (910), Tests 28811 passed, 1 todo. Includes src/ai/draft-review.test.ts (12 cases: the five new objects closed, verdict null but present, the 50 cap, omitted at least 1; review links refused for https:, //, 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 both item and changes; 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 through uiMessageToChatMessage; plain click goes through onOpenReviewLink with the default prevented, a ctrl-click does not; no button in the card; a refused part (a javascript: review link) renders the answer and no card, the control renders the card; a turn without the part has no draftReview; the part is not a kept data part.
  • DraftReviewCard.i18n-38048.test.tsx (3): en, zh-Hans and ru strings from the shipped packs through I18nProvider, 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).
  • Type checks: 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 eslint on every changed source file → 0 errors.
  • node scripts/check-changeset-no-major.mjs --base origin/main --event <this body> → exit 0; the same run with Metadata-protocol: none → exit 1.

Acceptance notes

  • A stream fixture with the part renders N rows with the right badges and links; a malformed part renders nothing; a turn without the part is unchanged: DraftReviewCard-38048.test.tsx.
  • Accessible names: every link has an aria-label naming the draft or package and Studio; the card is a labelled section.
  • Overflow in the eleven locales: measured in Chromium (Playwright, a temporary uncommitted Vite entry rendering DraftReviewCard through I18nProvider) 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 and omitted: 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.
  • Live only: a reloaded conversation shows no card (pinned: the part is not a kept data part).
  • Nothing in this repository produces the part; the cloud admin skill does (cloud#5172).
  • Surface beyond the claim: chatMessageAdapter.ts (one key in RuntimeOnlyMessageKeys), chat/draftReviewGroups.ts (the grouping helper, kept out of the component file for fast refresh), a second test file DraftReviewCard.i18n-38048.test.tsx (pack strings need their own file, because a mounted I18nProvider installs a module-level i18next global), and the extra prop reviewLinkHref. core.ts is not touched: extractDraftReview lives in mapMessages.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 --commands derives 110 families at 3a44ab65a (the same list as at fb2070cda). All 110 ran on 3a44ab65a after a build of every package under packages/ (turbo run build --filter='./packages/**', 83 tasks successful); 110 exit 0. --ran reconciliation: "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".
  • An earlier sweep on 61fee1dad found two real reds, both fixed before fb2070cda: check:llms-txt (the ai row and the inventory heading now count draft-review.zod.ts) and check:spec-parsed-alias (ADR-0122 …Parsed twins for the verdict, refusal and links types).
  • check-plugin-teardown-shape --self-test needs a pinned commit a shallow clone lacks; fetching that one commit was enough, and it passed.

Generated by Claude Code

@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:ai tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 20 documentable anchor(s). ⚠️ 7 changed file(s) yielded no anchor (packages/spec/api-surface/ai.json, packages/spec/authorable-surface/ai.json, packages/spec/declaration-map/ai.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/frontend/plugins/plugin-chatbot.mdx (via DRAFT_REVIEW_PART_TYPE (symbol, a top-level const object), DraftReviewListParsed (symbol, a top-level type), DraftReviewListSchema (symbol, a top-level const))
  • content/docs/kernel/runtime-services/data-service.mdx (via /api/protocol.zod (route, a path literal on a changed line))
  • content/docs/kernel/services-checklist.mdx (via /api/protocol.zod (route, a path literal on a changed line))
What this run could not see
  • 7 changed file(s) yielded no anchor (packages/spec/api-surface/ai.json, packages/spec/authorable-surface/ai.json, packages/spec/declaration-map/ai.json, …) — pages documenting those are invisible to this run
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e73580db61d84de5f2bcaf306a59e10c4a825066 — the merge of head 3a44ab65ad421afb684e06cf8fc4faf3253e76c8 into base 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 6e06729a9b8b99b5b6c3e3b512e48fefb61938d9 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

Contract review brief — PR #38102 @ fb2070cdafd27c0d61117c5db285e3bdd382b183 (card #38048)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/ai/draft-review.zod.ts packages/spec/src/ai/index.ts — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #38048: its body and EVERY comment (rulings and earlier records included)
· PR #38102: its body, its file list, and the net diff against main at fb2070cdafd27c0d61117c5db285e3bdd382b183
· the check-runs on fb2070cdafd27c0d61117c5db285e3bdd382b183: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/ai/draft-review.zod.ts, packages/spec/src/ai/index.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is SCRATCHPAD/pr-38102/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

…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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: fb2070cdafd27c0d61117c5db285e3bdd382b183
Local-runs: none
Scope: packages/spec/src/ai/draft-review.zod.ts, packages/spec/src/ai/index.ts + ui/packages/plugin-chatbot/src/mapMessages.ts, ui/packages/plugin-chatbot/src/chat/DraftReviewCard.tsx, ui/packages/plugin-chatbot/src/chat/draftReviewGroups.ts, ui/packages/plugin-chatbot/src/chat/types.ts, ui/packages/plugin-chatbot/src/chatMessageAdapter.ts, ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx, ui/packages/plugin-chatbot/src/index.tsx, ui/packages/app-shell/src/console/ai/ChatPane.tsx

This record covers fb2070cda only. The PR head has since moved to 98b52b0a6 (one commit, one line: Metadata-protocol: none to added in .changeset/38048-draft-review-part.md); that head is not covered here.

Remainder, the lane seat's ACCEPT at TIER_DEFAULT: the two test files under plugin-chatbot/src/__tests__, packages/spec/src/ai/draft-review.test.ts, the eleven locale packs, the README and mdx prose, the generated spec artifacts, llms.txt and the changesets' prose.

① Derived judgments

  • Public surface, @objectstack/spec/ai: right. index.ts adds one export *. New names: DRAFT_REVIEW_PART_TYPE, DRAFT_REVIEW_MAX, five schemas (DraftReviewList, DraftReviewItem, DraftReviewVerdict, DraftReviewVerdictRefusal, DraftReviewLinks) and their input and Parsed types. api-surface/ai.json gains 17 rows and json-schema.manifest/ai.json gains 5, which matches. Nothing existing changes.
  • Accept set, part data: right against the card and amendment 7232366780. The card's sketch is { drafts[], omitted? } with rows { type, name, package, label?, verdict | null, verdictWithheld?, verdictError?, verdictRead, review { changes, item } }, at most 50. The schema is that shape. Its five tightenings are the ones the amendment and report 7232350452 state: verdict required (nullable), review closed at two keys, drafts at least 1, omitted an integer of at least 1, both links pattern-checked. The card allows refinement if stated on the card before merge; it is stated.
  • Closure: right for the five new objects, wrong as the changeset words it. All five are strictObject. The rows of refusals and advisories are RuntimeAuthoringIssueSchema, which is a plain z.object (packages/spec/src/api/protocol.zod.ts:1078): an unknown key there is dropped, not refused. See N1.
  • Accept set, review links: wrong. The pattern admits values a browser resolves to another host. See S1.
  • Authorable-surface shard, 19 rows: right as generated. The five closed objects contribute 9 + 2 + 2 + 3 + 3 keys. The ratchet reads this as a metadata-protocol change; see ②.
  • Public surface, @object-ui/plugin-chatbot: right. It exports DraftReviewCard, DraftReviewCardProps and extractDraftReview; ChatbotEnhancedProps gains the optional onOpenReviewLink and reviewLinkHref; ChatbotEnhancedMessage gains the optional draftReview. All are additive and the changeset names each one.
  • Gates at this head: not answered. Check Changeset failed (see ②). Lint & Repo Gates, TypeScript Type Check and Test UI failed only because their lanes were cancelled when the head moved: 28 runs are cancelled, including every Test Core shard, Type Check · workspace, Lint UI, Type Check UI and Build Core. Green at this head: Spec property liveness, Type Check · source gates, Lint · ESLint, Governed Surface Queue Guard, PR-body guards. So the derived gate families have no verdict on fb2070cda.

② Semver level

M1 (must-fix) — the declaration at this head is wrong. .changeset/38048-draft-review-part.md and the PR body both say Metadata-protocol: none, and Check Changeset (run 140833349986) is red on it: packages/spec/authorable-surface/ai.json moved, so the line must be added, narrowed or semantic, with the package at least minor.

  • The right value is Metadata-protocol: added. The rows are new keys only and nothing is removed or re-meant. It is also the precedent: .changeset/37872-ask-question-envelope.md on main (feat(spec): ask-question envelope for the question card, with legacy ask_which reading #37930) is '@objectstack/spec': minor with Metadata-protocol: added for the same kind of change, a new closed stream shape in @objectstack/spec/ai.
  • '@objectstack/spec': minor is right: new exports, nothing narrowed.
  • Clause-②: yes (widening) is right on both changesets.
  • The UI changeset (plugin-chatbot, app-shell, i18n at patch, Metadata-protocol: none) is right. It follows .changeset/37873-question-card.md on main, which ships new plugin-chatbot exports at patch, and it touches no spec shard.
  • Claim comment 7232385588 already amends the claim to added, and 98b52b0a6 changes the changeset line. The PR body still read none when I read it; it must say added as well.

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • Deviation, surface beyond the claim (chatMessageAdapter.ts, draftReviewGroups.ts, a second test file, reviewLinkHref, llms.txt): accepted. Each is in amendment 7232366780, and each is read in ④ or sits in the remainder.
  • Deviation, overflow in the eleven locales not measured in a browser: not answered by this review. It is a card acceptance line and belongs to the lane seat's ACCEPT; nothing in the diff measures it.
  • Deviation, check:dual-build-cjs-loads not measured locally and left to CI: still open at this head, because the CI lane that runs it was cancelled.
  • Deviation, branch name claude/project-thread-qdbmce: matches the claim.
  • SQL push-down: not applicable. The diff has no query, no id materialisation and no join.
  • security_findings: none in the report does not hold; see S1.

④ Design judgment

packages/spec/src/ai/draft-review.zod.ts

S1 (should-fix) — the Console-path pattern does not keep a link on the site. consolePath is /^\/(?!\/)/: it checks the first two characters and nothing after them. Its own comment says it exists so that a link is "never // (which a browser reads as another host)", and the PR body says it refuses protocol-relative values "since the card renders them as anchors". Two values pass it and still resolve to another host under the WHATWG URL rules for http and https:

  • a slash followed by a backslash, as in /\evil.example/x: a backslash is read as a slash, so this is the protocol-relative form;
  • a slash, a tab or newline, then a slash: the parser removes tabs and newlines before it parses, which leaves //evil.example/x.

The card puts the value into the anchor's href as it is (DraftReviewCard.tsx, link). ChatPane builds the href with documentHref(useHref('/'), path), which on a root mount returns the path unchanged, and hands the same string to navigate on a plain click. I did not read what react-router does with it. draft-review.test.ts covers https:, //, javascript:, a relative path and the empty string, and neither of these.

What holds: javascript: and every other scheme are refused, since the value must start with /. A crafted type, name or package cannot produce either bypass through the door's builders: studioChangesReviewLink and studioItemReviewLink (packages/types/src/studio-review-links.ts:22-29) pass each segment through encodeURIComponent, which encodes slash, backslash, ?, # and control characters. A name of .. survives encoding and a browser folds the dot segment, but the result stays on the same origin. So the hole is open only to a producer that does not use the builders, and the grade is should-fix, not must-fix. It is a finding on the contract because the schema is the reader's only guard, the reader is told to add no second parser, and the objects are published closed from day one, so tightening the pattern after release is a narrowing. The fix is in the pattern: refuse a backslash, whitespace and control characters anywhere in the value (or anchor it to the /studio/ prefix both builders emit), and add both values to the refusal test.

S2 (should-fix) — the contract does not say whether a draft saved twice in one turn is one row or two. drafts is described as "The saved drafts, in save order", and the module text says "the drafts one ask turn saved". A build turn commonly saves the same item more than once. The reader assumes one row per draft: DraftReviewCard.tsx keys each row by type:name inside its package group, so two rows for one draft collide on the React key, and both count toward the cap of 50 and toward omitted. cloud#5172 cannot be read from here, so the text is all its author has. State it in the drafts description: one row per draft, unique by package, type and name, placed at its first (or last) save.

Q1, shape against the card and the amendment: holds, apart from S1. The limits are right: 1 to 50 rows, omitted an integer of at least 1, non-empty type, name, package and label, verdictRead a two-value enum.

Q2, reuse of RuntimeAuthoringIssueSchema: sound, and real. refusals and advisories are z.array(RuntimeAuthoringIssueSchema), imported from ../api/protocol.zod; nothing is copied. An ai file importing from api has precedent (dataset-tools.zod.ts:10 on main). It is the shape the door answers: packages/runtime/src/domains/mcp-authoring.ts:1425-1433 returns { publishable: refusals.length === 0, refusals, advisories }. DraftReviewVerdictRefusalSchema does not reuse it and should not: it is the door's error { code, message, status } for a verdict that was not read, which is a different thing from a finding, and the seat's ruling names refusals and advisories only.

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 finish, one part, save order, verdict null with its two reasons, the two builders by name). A producer that follows the report passes the parse. The gaps are S2, N2 and N3.

packages/spec/src/ai/index.ts: holds. One export * and one line in the module list.

ui/packages/plugin-chatbot/src/mapMessages.ts: agrees with the contract. extractDraftReview selects by DRAFT_REVIEW_PART_TYPE and reads part.data through DraftReviewListSchema.safeParse only; there is no second parser and no hand-read field. A refused part returns undefined, uiMessageToChatMessage then omits draftReview, and nothing throws (Q3). It takes the last part of that type, which is right for a stream that replaces a part by id.

Live only (Q5): true in the console, and it is what the card asks (ruling Q2 = A). The part is not in STORED_ANSWER_DATA_PARTS (toolResultParsers.ts:324-333, unchanged). All three rebuild paths go through that allow-list: storedAnswerData in aiChatHydration.ts:173, storedAnswerParts in useChatConversation.ts:396 (the browser cache) and in useObjectChat.ts:794 (the store rebuild). None of them names draftReview. chatMessageAdapter.ts adds it to RuntimeOnlyMessageKeys, which keeps it out of the authored message type. The UI test pins both the allow-list and storedAnswerData.

DraftReviewCard.tsx, draftReviewGroups.ts, ChatbotEnhanced.tsx, types.ts, index.tsx: agree with the card. One row per draft with label or name, type, a verdict badge and a Review link to review.item; one "Review and publish" link per package to review.changes; omitted as "+N more"; no button of any kind. Both files type against the Parsed types from the spec and read no field the schema does not declare. Every link has an aria-label and the section is labelled by its title.

ChatPane.tsx: agrees. A plain left click goes to navigate(path), so the live card survives; a modified or middle click keeps the anchor's href, which carries the router basename. Subject to S1.

Nits, none of which changes the verdict:

  • N1 (nit) — "Every level is closed: an unknown key is refused, never dropped" (changeset, PR body, test header) is not true of the rows inside refusals and advisories, which are a plain z.object and drop unknown keys. The behaviour is the better one, since a new field on the door's finding does not blank the card; the sentence should say the five new objects are closed.
  • N2 (nit) — the descriptions state three invariants the schema does not enforce: publishable is true exactly when refusals is empty; verdictWithheld or verdictError is present only when verdict is null; omitted is present only when 50 rows are listed. The card draws publishable: false with no refusals as "0 problems", and publishable: true with refusals as "Will publish". The door derives publishable itself, so this needs a producer that departs from the door.
  • N3 (nit) — the part id draft-review appears only in the card, the report and the PR body. The reader's own comment depends on it ("With a stable part id the stream keeps one part"). The spec could export it or name it in the module text; the citations part has the same gap.
  • N4 (nit) — "a conversation reloaded from history shows no card" is written in the spec as a property of the part, but it is a property of this console's rebuild paths and of the producer not storing the part. uiMessageToChatMessage draws the card from any message whose parts carry it, and useObjectChat passes initialMessages that already have parts through unchanged.
  • N5 (nit) — DraftReviewVerdictRefusal sits next to verdict.refusals and means something else (the door's error, not a publish refusal). The name is published now and costs a rename later.

Not read: objectstack-ai/cloud#5172 (the producer), and react-router's handling of the S1 values in navigate.

Implemented-by: claude/project-thread-qdbmce
Reviewed-by: session_01L9qibvMMgnKA797JY46H9i

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-28T02:34Z

席位核对 — L1 @ 98b52b0a68ffc2ad2757e7dde78fd1c385207c45

Verdict: REVISE. Three items, all small and all in packages/spec/src/ai/draft-review.zod.ts, its test and the changeset prose. The rest of the PR holds.

Contract review: CONTRACT_REVIEW_TIER (published schema under packages/spec/src/**). Record 7232434714 at fb2070cd is FAIL on M1 with S1 and S2 open. This L1 verdict adopts S1, S2 and N1 as required changes; N2–N5 stay nits.

M1 — closed at this head

98b52b0a6 changes the changeset line to Metadata-protocol: added, and the body now reads Clause-②: yes (widening) / Metadata-protocol: added. The red Check Changeset in this head's check-runs is the synchronize run (02:28:59Z), which read the body before it was edited. The edited run of PR Automation (02:30:57Z) passed. '@objectstack/spec': minor with added follows .changeset/37872-ask-question-envelope.md on main.

Required

  • R1 (S1). Make consolePath refuse a link that leaves the site. /^\/(?!\/)/ checks only the first two characters. /\evil.example/x passes and a browser reads /\ as //. A slash, then a tab or newline, then a slash also passes, and the URL parser strips the tab or newline first. Both go unchanged into the card's anchor href and into navigate(path) in ChatPane.tsx:287. The module comment and the PR body both promise "never //", so the schema is wrong against its own words. The objects ship closed from day one, so tightening this after release would be a narrowing. Fix it now. Refuse a backslash, whitespace and C0 control characters anywhere in the value, or anchor the pattern to the /studio/ prefix that both builders in packages/types/src/studio-review-links.ts emit. Add /\evil.example/x and /\t/evil.example/x (a real tab) to the refusal rows in draft-review.test.ts, and keep a builder-made link in the accept rows.
  • R2 (S2). Say what a draft saved twice is. drafts says "The saved drafts, in save order". A build turn often saves the same item more than once, and the card keys rows by type:name inside a package group, so two rows for one draft collide and both count toward the 50 cap and omitted. cloud#5172 has only this text to go on. Write it into the drafts description, for example: one row per draft, unique by package, type and name, placed at its first save, carrying the latest verdict. Regenerate the reference page and llms.txt if they carry the text.
  • R3 (N1). Fix the false sentence in the changeset. "Every level is closed: an unknown key is refused, never dropped" (.changeset/38048-draft-review-part.md, the PR body and the test header) is false for the rows in verdict.refusals and verdict.advisories. Those are RuntimeAuthoringIssueSchema, a plain z.object that drops unknown keys. Keeping that behaviour is right. Change the sentence to say the five new objects are closed and the findings keep the door's own shape. Per the checklist, a changeset is read sentence by sentence, and a false sentence ships in the release notes.

Holds at this head

  • Relation and shape. Draft on main, Fixes #38048, no other closing keyword. Fixes is right if R1–R3 land, because the card's acceptance is this part, its reader and the card.
  • Scope. The surface beyond the claim is covered by amendment 7232366780.
  • UI changeset. plugin-chatbot, app-shell and i18n at patch, Metadata-protocol: none, as in .changeset/37873-question-card.md.
  • The reader. extractDraftReview reads only through DraftReviewListSchema.safeParse. The part is kept out of STORED_ANSWER_DATA_PARTS and every rebuild path, as ruling Q2 = A asks.

On the next head

- 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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 3a44ab65ad421afb684e06cf8fc4faf3253e76c8
Local-runs: none
Scope: packages/spec/src/ai/draft-review.zod.ts, packages/spec/src/ai/index.ts + ui/packages/plugin-chatbot/src/mapMessages.ts, ui/packages/plugin-chatbot/src/chat/DraftReviewCard.tsx, ui/packages/plugin-chatbot/src/chat/draftReviewGroups.ts, ui/packages/plugin-chatbot/src/chat/types.ts, ui/packages/plugin-chatbot/src/chatMessageAdapter.ts, ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx, ui/packages/plugin-chatbot/src/index.tsx, ui/packages/app-shell/src/console/ai/ChatPane.tsx

Delta record. It follows record 7232434714 (FAIL at fb2070cda) and reads the two commits since: 98b52b0a6 and 3a44ab65a. Together they change four files: packages/spec/src/ai/draft-review.zod.ts, its test, the generated content/docs/references/ai/draft-review.mdx and .changeset/38048-draft-review-part.md. index.ts and every implementing file in Scope are byte-identical to fb2070cda, so the earlier record's judgment of them stands and is not repeated.

Remainder, the lane seat's ACCEPT at TIER_DEFAULT: as in the earlier record.

① Derived judgments

  • Accept set, review links: right now. The pattern is /^\/(?!\/)[^\\\s\u0000-\u001F\u007F]*$/. It is anchored at both ends, so the whole value is checked: one leading slash, not two, and no backslash, whitespace, C0 control character or DEL anywhere. This is a narrowing against fb2070cda, made before anything is released, so it costs no consumer. Every link the two builders in packages/types/src/studio-review-links.ts can produce still passes, because encodeURIComponent emits none of the refused characters.
  • Accept set, everything else: unchanged. No key, type, limit or export moved. The drafts and omitted descriptions changed; their validators did not.
  • Public surface: unchanged from fb2070cda, in both @objectstack/spec/ai and @object-ui/plugin-chatbot. No generated shard moved in the delta; only the reference page text did, and it matches the source.
  • Gates at this head: answered. 62 check-runs are success, among them Check Changeset, Lint & Repo Gates, TypeScript Type Check, all ten Test Core shards, all sixteen Test UI shards, Build Core, Spec property liveness and Governed Surface Queue Guard. 11 are skipped (opt-in or matrix placeholders). None failed. One second run of Check Changeset, started 03:25Z after the PR body was edited, was still in progress when I read it; the first run on this head is green.

② Semver level

M1: closed. The spec changeset reads Clause-②: yes (widening) and Metadata-protocol: added with '@objectstack/spec': minor, the PR body carries the same two lines, and Check Changeset is green on this head. This is the #37930 precedent (.changeset/37872-ask-question-envelope.md on main). The UI changeset is unchanged and right at patch with Metadata-protocol: none.

③ Boundary flags

  • open_questions: none in delta report 7233053257.
  • check:dual-build-cjs-loads, open at the earlier head: answered. Lint & Repo Gates is green here, and the report gives a local exit 0.
  • Overflow in the eleven locales: the report now states a Chromium measurement at 320 px and 280 px with a red control. I did not read the screenshots; it stays the lane seat's acceptance line.
  • "Not changed: N2 to N5" in the report: accepted, see ④.
  • SQL push-down: not applicable. The delta has no query.

④ Design judgment

No must-fix, no should-fix.

S1: closed. I tried the pattern against the two values from the earlier record and against others:

  • slash then backslash: refused, the class excludes a backslash anywhere;
  • slash, tab or newline or carriage return, slash: refused, \s and the C0 range cover all three characters the URL parser strips;
  • a leading space or control character before the slash: refused, the value must start with the slash;
  • /.//evil.example and /%2F/evil.example: admitted, and correctly so. A browser keeps both as a path on the same origin; dot segments and percent-encoded slashes never become an authority.

The pattern has no m flag, so $ is the end of the value. The test refuses each bad value on both item and changes, and admits a link spelled as the builders spell it, with a space, a backslash, a tab and a slash in the segments. javascript: and other schemes stay refused. The comment above the pattern now says what the pattern does.

S2: closed. The drafts description and the module text now say: one row per draft, unique by package, type and name; a draft saved more than once is one row, at its first save, with the verdict read last; the cap and omitted count drafts, not saves. That agrees with the reader, which keys a row by type:name inside its package group in DraftReviewCard.tsx, and it is enough for cloud#5172 to build to. The schema states the uniqueness and does not enforce it; that joins N2.

N1: closed. The changeset, the PR body and the test header now say the five new objects are closed and that a finding keeps RuntimeAuthoringIssueSchema's shape. A new test pins that an unknown key on a finding is dropped.

Nits left as accepted deviations, none of which affects the verdict:

  • N2 (nit) — stated but unenforced invariants: publishable against empty refusals, verdictWithheld and verdictError only beside a null verdict, omitted only at 50 rows, and now row uniqueness.
  • N3 (nit) — the part id draft-review is not named in the spec.
  • N4 (nit) — "reloaded from history shows no card" describes this console and this producer, not the part.
  • N5 (nit) — the name DraftReviewVerdictRefusal beside verdict.refusals.

Not read: objectstack-ai/cloud#5172, and react-router's navigate (no longer needed for S1, since the refused values do not reach it).

Implemented-by: claude/project-thread-qdbmce
Reviewed-by: session_01L9qibvMMgnKA797JY46H9i

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-28T03:28Z

席位核对 — L1 delta @ 3a44ab65ad421afb684e06cf8fc4faf3253e76c8

Verdict: ACCEPT. R1–R3 from my REVISE (7232462684) are closed. The L2 delta record 7233098661 is PASS at this head, its tier is verified, and it leaves no open must-fix or should-fix.

Read against my REVISE

  • R1 (S1). Closed. CONSOLE_PATH is /^\/(?!\/)[^\\\s\u0000-\u001F\u007F]*$/, anchored at both ends.

    • It refuses a backslash, any \s character (Unicode whitespace included), C0 controls and DEL anywhere in the value. The comment above it says why.
    • Every builder-made link still passes, because the builders percent-encode each segment.
    • draft-review.test.ts refuses the backslash form and the tab form on both item and changes.
  • R2 (S2). Closed. The module text and the drafts description say:

    • one row per draft, unique by package, type and name;
    • a draft saved more than once is placed at its first save, with the verdict read last;
    • the cap and omitted count drafts, not saves.

    That is the key the card already uses. The schema does not enforce uniqueness, and the L2 adds it to N2 as a nit. It is accepted.

  • R3 (N1). Closed. The changeset, the PR body and the test header now say that the five new objects are closed and that the findings keep RuntimeAuthoringIssueSchema's shape, which drops an unknown key. A test pins the drop.

  • M1. Closed at 98b52b0a. Clause-②: yes (widening) / Metadata-protocol: added with spec minor hold in the body and the changeset.

Checklist at this head

  • Scope. The delta is 4 files: the schema, its test, the regenerated reference page and the spec changeset. The other files are byte-identical to the reviewed head.
  • Changeset. I read the new sentences one by one, and each is true of the code at this head.
  • Gates.
    • Check-runs: 63 success, 11 skipped, none failed or pending.
    • The seat's delta report (7233053257) is pinned to this head: dispatch-gates 110 run, 0 NOT-MEASURED, all exit 0; check:dual-build-cjs-loads exit 0; spec 28811 and i18n/chatbot 2615 tests passed.
  • Card acceptance, overflow. Measured in Chromium at 320 and 280 px across the eleven locales, 22 renders with no spill, against a red 90 px control. The readings are in card-38048/overflow/measure.json.
  • Dogfood. Not owed, since this is a widening with no ! and no narrowing.

Accepted deviations

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-28T03:29Z · zone o3-askai (seat card thread)
Head-sha: 3a44ab65ad421afb684e06cf8fc4faf3253e76c8

  • L1 delta ACCEPT 7233108121 at this head (L1-c). Contract review delta PASS 7233098661. M1, S1, S2 and N1 are closed; N2–N5 are accepted nits.
  • Claim 7231261848 (amendments 7232366780, 7232385588: Metadata-protocol: added). Report delta 7233053257.
  • check-governed-merges.mjs --pr 38102: NOT governed, +1527 / −10.
  • landing-k.mjs --pr 38102: K = 14 < 15, no new locale pack, no shared book moved.
  • Checks at this head: 63 success, 11 skipped, 0 failed. mergeable_state clean. Widening, so no dogfood battery is owed.
  • Action: ready for review and auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 03:30
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 03f39cc Nov 28, 2026
75 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-qdbmce branch November 28, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:ai size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants