Skip to content

chat: draft review card for the ask admin skill — spec part data-draft-review and a plugin-chatbot DraftReviewCard (links to Studio review; no publish in chat) #38048

Done

Description

@objectstack-fleet

epic:#5027#1 · hotlong · session_01Q4EjjMUfmNYTem26rXLFUf

Filing gate: ④ topic child (cross-repo half of a cloud card). Source: epic objectstack-ai/cloud#5027 M2 row 3 = cloud#5085 (plan v2 approved by the maintainer 2026-11-27 01:02Z 「同意,开工」): "a build turn that saved N drafts ends with a card listing N rows; publish from the card goes through the existing human publish path". cloud#5085's premise check (2026-11-27 20:54Z) found the chat renders no drafts; cloud's half is PR cloud#5172 (sends the data part). Business reason: an admin who builds in chat sees what was saved and where to review it, instead of hunting in Studio.
Owner: repo:objectstack#3 (maintainer 2026-11-27 07:51Z: non-cloud tasks go to the objectstack seat). Filed by seat epic:#5027#1, which keeps cloud#5085 and the pin round.
Grading: area:ai · Task · p1 · size M · reach: admins with the cloud admin skill switched on (default off) · evidence: read (objectstack origin/main 8d34c44; cloud PR #5172).
Dedupe: searched data-draft-review, DraftReviewCard, pending drafts chat; no open card. Precedent: the question card (objectstack#37872 spec envelope, #37874 QuestionCard).

维护者速读

  • 是什么:管理员在 ask 对话里搭建时,回合结束后在回答下面出一张卡,列出这一轮存的草稿和每个的判定(能发布 / 有几个问题),每行和每个包都带去工作室审阅的链接。
  • 卡片上不发布、不丢弃,都去工作室现有的人工流程(席位裁定 Q1=A)。第一版只在实时对话里显示,刷新后不重建(Q2=A,之后另开 cloud 卡把部件存进消息)。
  • 要你做什么:无。

Where it renders (objectstack origin/main 8d34c44)

  • The ask chat is ui/packages/app-shell/src/console/ai/ChatPane.tsx over ui/packages/plugin-chatbot (ChatbotEnhanced, mapMessages.ts, toolResultParsers.ts).
  • Only data-chart and data-record-citations are read today (STORED_ANSWER_DATA_PARTS, toolResultParsers.ts:325). Nothing renders a save_metadata_draft / list_drafts result.

What cloud sends (PR cloud#5172)

At the end of a streamed ask turn whose admin skill saved drafts, before finish, one UI-message-stream part:

{ type: 'data-draft-review', id: 'draft-review', data: {
    drafts: [{ type, name, package, label?, verdict: { publishable, refusals, advisories } | null,
               verdictWithheld?, verdictError?, verdictRead: 'turn-end' | 'save',
               review: { changes, item } }],   // save order, at most 50
    omitted?: number } }

verdict is the light door's own list_drafts verdict read at the turn's end as the person; review is the door's own review routes (studioChangesReviewLink, studioItemReviewLink).

What to do

  1. Spec: packages/spec/src/ai/draft-review.zod.ts with DRAFT_REVIEW_PART_TYPE = 'data-draft-review' and DraftReviewListSchema (closed objects, as above; field names may be refined, say so on this card before merge so cloud follows). Follow the spec change rules (changeset, generated baselines, api-surface, docs).
  2. plugin-chatbot: a DraftReviewCard under the assistant message that carries the part. One row per draft: label or name, type, a verdict badge (will publish / N problems / verdict withheld), a "Review" link to review.item; per package a "Review and publish" link to review.changes; omitted shown as "+N more". No publish and no discard button (seat ruling Q1 = A). Strings in every ui locale pack.
  3. Live only in v1 (seat ruling Q2 = A): do not rebuild the card from stored save_metadata_draft results (save-time verdicts can be wrong). Do not add the part to STORED_ANSWER_DATA_PARTS until a cloud card stores it on the assistant message.

Acceptance

Clause-②: yes
Suggested-grade: p1

Activity

  1. added
    enhancement
    priority:p1
    pm:epic
    area:ai
    on Nov 27, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim: PM loop round 1
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibw1AHBDKuYXJdbT1PN
    Account: os-tesla
    Branch: claude/project-thread-qdbmce
    Worktree: objectstack-issue-38048
    Domain: ai
    Area: o3-askai (问AI zone, a seat card thread; maintainer accepted the card 2026-11-28 00:46Z)
    Seat: repo:objectstack#3
    File surface:

    • Spec: new packages/spec/src/ai/draft-review.zod.ts + draft-review.test.ts; packages/spec/src/ai/index.ts; the generated set the ask-question part (feat(spec): ask-question envelope for the question card, with legacy ask_which reading #37930) touched: api-surface/ai.json, authorable-surface/ai.json, declaration-map/ai.json, export-origins/ai.json, json-schema.manifest/ai.json, llms.txt, content/docs/references/ai/{draft-review.mdx,index.mdx,meta.json}, content/docs/references/index.mdx, docs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.md; .changeset/38048-draft-review-part.md (minor @objectstack/spec).
    • UI: new ui/packages/plugin-chatbot/src/chat/DraftReviewCard.tsx; mapMessages.ts (extractDraftReview, safeParse through the spec schema, malformed → undefined); chat/types.ts; ChatbotEnhanced.tsx (beside RecordCitations); index.tsx / core.ts exports; ui/packages/app-shell/src/console/ai/ChatPane.tsx (wires an optional onOpenReviewLink to in-app navigate so a live-only card survives the click; href fallback when unwired); the eleven ui/packages/i18n/src/locales/* packs (chatbot.draftReview.*); ui/packages/plugin-chatbot/src/__tests__/DraftReviewCard-38048.test.tsx; content/docs/frontend/plugins/plugin-chatbot.mdx, ui/packages/plugin-chatbot/README.md; .changeset/38048-draft-review-card.md.
      NOT STORED_ANSWER_DATA_PARTS, history hydration or any stored-part path (seat ruling Q2 = A, live only), and nothing under skills/**, docs/adr/** or .claude/**. Stop on breach and explain in the report.
      Container & model: M, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high
      Clause-②: yes (widening)
      Metadata-protocol: none
      Responsibility: an ask turn that carries one data-draft-review part renders one card under that assistant message, with one row per draft (label or name, type, a verdict badge: will publish / N problems / verdict withheld) and a Review link to review.item, one "Review and publish" link per package to review.changes, and "+N more" for omitted. The card has no publish and no discard control. A malformed part renders nothing and does not crash; a turn without the part renders exactly as today. Strings are in every locale pack, links carry accessible names, and no locale overflows. Seat ruling on the shape: verdict.refusals / advisories reuse RuntimeAuthoringIssueSchema arrays from @objectstack/spec/api, since that is what the door's list_drafts verdict returns (runtime mcp-authoring.ts:405-414). The thread posts the final part shape on this card before merge, so cloud#5172 follows it, as the card asks.
      Thread-read: none
      Premise: holds, measured on origin/main 0e90d2f. The chat reads only data-chart (toolResultParsers.ts:172, allow-list :324-332) and data-record-citations (mapMessages.ts:267). Nothing under ui/ renders a save_metadata_draft / list_drafts result outside tests. The build chat front end retired by feat(chatbot): retire the build chat frontend #37720 (with its DraftReview type) is not revived or reused. Full report: /mnt/project-files/card-38048/pre-claim-report-0e90d2f9.md.
      Serial constraints cleared: none — no open PR touches ChatbotEnhanced, toolResultParsers or mapMessages; C5 #37861 (branch qgv6xl, no PR yet) shares ChatPane.tsx and the locale packs with different keys and props, so whichever lands later merges main
  3. added
    pm:dispatched
    on Nov 28, 2026
  4. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibw1AHBDKuYXJdbT1PN
    os-dev-report

    {
      "issue": 38048,
      "status": "done",
      "branch": "claude/project-thread-qdbmce",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38102",
      "session": "session_01L9qibw1AHBDKuYXJdbT1PN",
      "premise_still_valid": true,
      "summary": "New spec part in @objectstack/spec/ai: DRAFT_REVIEW_PART_TYPE 'data-draft-review', DRAFT_REVIEW_MAX 50, DraftReviewListSchema and its row / verdict / verdict-refusal / links schemas, all closed; verdict.refusals and advisories reuse RuntimeAuthoringIssueSchema per the seat ruling; review links must be Console paths. plugin-chatbot reads the part through the schema (extractDraftReview, live only, not in STORED_ANSWER_DATA_PARTS) and ChatbotEnhanced draws DraftReviewCard under the answer: rows grouped by package, verdict badge, Review link per draft, Review and publish link per package, +N more, no button. ChatPane opens the links in-app (onOpenReviewLink -> navigate) and gives them a basename href (reviewLinkHref -> documentHref(useHref('/'))). Strings chatbot.draftReview.* in all eleven packs (zh-Hant generated), problems and more as plural families.",
      "tests": "At fb2070cda: pnpm --filter @objectstack/spec test -> Test Files 910 passed (910), Tests 28809 passed | 1 todo; spec typecheck exit 0. At e1c09b0a7: pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-chatbot/ -> Test Files 187 passed (187), Tests 2615 passed | 13 skipped; the two new card files re-run after the grouping move: 2 files, 13 tests passed. app-shell console/ai + useChatConversation + product-neutral ratchet + clickable census: Test Files 39 passed (39), Tests 330 passed. type-check exit 0 for @object-ui/plugin-chatbot, @object-ui/i18n, @object-ui/app-shell. eslint on changed files: 0 errors. No ablation: new behaviour only, the refusal and control legs are in the same files.",
      "gates": "dispatch-gates --ran: 110 derived, 109 run exit 0, 1 NOT MEASURED (check:dual-build-cjs-loads exit 3, needs a full repository build; CI Lint & Repo Gates runs it), 0 unrun. First sweep on 61fee1dad found check:llms-txt exit 1 (ai count) and check:spec-parsed-alias exit 1 (three missing Parsed twins); both fixed, then the 42 spec/declaration/entry/docs families re-ran on fb2070cda: 42/42 exit 0. check:generated: all 14 artifacts up to date. PR CI: in_progress at report time.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "5 — GitHub MCP reads only: issue_read x4 (#38048, its comments twice, #37682), list_pull_requests x1",
      "api_writes": "2 — fleet-write relay pr_create (POST pulls + assignees leg; read-back 9278 bytes identical); this os-dev-report comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [],
      "deviations": [
        "Surface beyond the claim, all small: ui/packages/plugin-chatbot/src/chatMessageAdapter.ts (draftReview in RuntimeOnlyMessageKeys, so the seam types carry it), chat/draftReviewGroups.ts (grouping helper kept out of the component file for react-refresh), a second test file DraftReviewCard.i18n-38048.test.tsx (an I18nProvider mount sets a module-level global, so pack strings need their own file), the extra optional prop reviewLinkHref, and packages/spec/llms.txt (its hand-kept count, red without it). core.ts not touched: mapMessages is not in the light core entry.",
        "Overflow in the eleven locales is not measured in a browser (jsdom has no layout); rows wrap by construction.",
        "Branch name is the thread's assigned claude/project-thread-qdbmce, as the claim records, not claude/issue-38048-*.",
        "Merged origin/main once before the sweep (4 unrelated commits, no conflict)."
      ]
    }

    Final part shape, for cloud#5172 to follow (also in the PR body):

    { type: 'data-draft-review', id: 'draft-review', data: {
        drafts: [{ type, name, package, label?,
                   verdict: { publishable, refusals: RuntimeAuthoringIssue[], advisories: RuntimeAuthoringIssue[] } | null,
                   verdictWithheld?: { code, message, status }, verdictError?: { code, message, status },
                   verdictRead: 'turn-end' | 'save',
                   review: { changes, item } }],   // 1..50 rows; links are Console paths; every object closed
        omitted?: number } }                         // integer >= 1, absent when none
    

    Changes from the card's sketch: verdict must be present (null, not left out); review is closed at changes and item (do not forward the door's note); drafts holds at least one row; omitted is never 0.

  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim amendment (file surface), for PR #38102 at fb2070c:

    • Added: ui/packages/plugin-chatbot/src/**/chatMessageAdapter.ts (one runtime-only key); chat/draftReviewGroups.ts (the grouping split out of the card); a second test file, DraftReviewCard.i18n-38048.test.tsx; an optional reviewLinkHref prop (new tab, with basename); and the ai count in packages/spec/llms.txt.
    • core.ts is not touched.
    • Shape, tighter than the card's sketch:
      • verdict must be present (it may be null);
      • review takes only changes and item;
      • drafts holds at least 1 row;
      • omitted is never 0;
      • both links must be Console paths.
    • The final shape is posted in os-dev-report 7232350452 for cloud#5172 to follow.
      Clause-② yes (widening), Metadata-protocol none.
  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim amendment: Metadata-protocol: added (was none). The new schemas add rows to packages/spec/authorable-surface/ai.json, which the ratchet counts as a metadata-protocol change, as with #37930. @objectstack/spec is minor. Clause-② stays yes (widening).

  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    os-dev-report delta — 3a44ab65ad421afb684e06cf8fc4faf3253e76c8

    Answers L1 REVISE 7232462684 (R1–R3) and contract review 7232434714 (S1, S2, N1). Commits since fb2070cda: 98b52b0a6 (M1, Metadata-protocol: added) and 3a44ab65a (below).

    • R1 / S1. consolePath is /^\/(?!\/)[^\\\s\u0000-\u001F\u007F]*$/: one leading /, never //, and no backslash, whitespace or C0/DEL control character anywhere. Refusal rows in draft-review.test.ts (both item and changes): /\evil.example/x, /<TAB>/evil.example/x (a real tab), /<LF>/evil.example/x, a space, a NUL, plus the earlier https:, //, javascript:, relative and empty. Accept row: a link spelled as studioItemReviewLink / studioChangesReviewLink build it, segments through encodeURIComponent (a package with a space, a name with a backslash, a tab and a slash).
    • R2 / S2. drafts description and the module text: 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, carrying the verdict read last; omitted counts drafts, not saves. Reference page regenerated; llms.txt carries no description text.
    • R3 / N1. The changeset, the PR body and the test header now say the five new objects are closed and the findings keep RuntimeAuthoringIssueSchema's shape (an unknown key there is dropped). A new test pins the drop.
    • Overflow, eleven locales. Measured in Chromium at 320 px and 280 px, 22 renders: nothing spills past the card, nothing scrolls, every verdict badge is one line. Control at 90 px: red (21 spilling elements). Readings and screenshots: /mnt/project-files/card-38048/overflow/.

    Readings at 3a44ab65a:

    • pnpm --filter @objectstack/spec test → 910 files, 28811 passed, 1 todo (draft-review.test.ts 12).
    • pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-chatbot/ → 187 files, 2615 passed, 13 skipped.
    • pnpm --filter @objectstack/spec typecheck → exit 0; eslint on the two changed spec files → 0.
    • dispatch-gates --commands 110 families, all run after a packages/** build: 110 exit 0; --ran → "110 run, 0 NOT-MEASURED". check:dual-build-cjs-loads → exit 0 (126 require entries across 74 packages load).
    • check-changeset-no-major --event <replacement body> → exit 0.

    Not changed: N2–N5 (nits), the optional ChatbotEnhanced.tsx wording (depends on #38106 landing first). No UI file changed since fb2070cda.

  8. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Closed-card tidy · 2026-11-28T04:54Z: the card closed when its PR merged; pm:dispatched comes off.

  9. removed
    pm:dispatched
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aienhancementpm:epicpriority:p1size/m

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions