Repository navigation
fix(plugin-chatbot): explain the plan card's suggested-field mark with a legend line - #33538
Conversation
…h a legend line A field the user's words did not name is drawn as a dashed chip ending in the suggested mark, and nothing on the card said what the mark means. When any field on the card is suggested, one legend line under the field rows now says the AI added it and the user did not ask for it, through a new i18n key in all eleven shipped locales. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nPjRkNSgKVPP1Y6tw
…g census Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nPjRkNSgKVPP1Y6tw
…raw tool output Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nPjRkNSgKVPP1Y6tw
|
domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8 Contract reviewServed-tier: Inputs: card #33419 (body, the ① Derived judgments
② Semver level
③ Boundary flags
Findings:
Implemented-by: VERDICT: PASS |
|
domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8 席位核对Verdict: ACCEPT · head
|
Requested by Leehom · project thread
Fixes #33419
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
category),用户看不出这是 AI 自己加的字段。ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx的PlanCardObjectRows(anySuggested与新加的proposed-plan-suggested-legend那段);ui/packages/i18n/src/locales/zh-Hans.ts的suggestedFieldLegend;新测试ChatbotEnhanced.planCardSuggestedLegend-33419.test.tsx。pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.planCardSuggestedLegend-33419.test.tsx,预期 1 个文件 4 个用例全绿,其中中文用例读到「标「补充」的字段是 AI 自行补充的,你没有要求。」恰好一行。What changes
PlanCardObjectRows(ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx,@object-ui/plugin-chatbot). When at least one field ofplanCard.objects[].fields[]carriessuggested: true, the objects block draws one legend line after its last object row (data-testid="proposed-plan-suggested-legend"), from the new keychatbot.plan.suggestedFieldLegendwith the existing mark (chatbot.plan.suggestedField) interpolated asmark, so the legend always quotes the same word the chip shows. One line per card, however many fields or objects are suggested. With no suggested field nothing is drawn. The chip itself is unchanged: dashed, ending in 「· 补充」,titlestill the field's machine name. The ruling allowed the same sentence on the chip tooltip too; it was not added, since the legend is the owed face and the machine name stays the tooltip.@object-ui/i18n:chatbot.plan.suggestedFieldLegendin all eleven shipped locales, each written in the pack's own register (zh-Hans/zh-Hant use 你 as the rest ofchatbot.plandoes; es uses usted, de Sie, fr vous, as those packs do):Fields marked “{{mark}}” were added by the AI; you didn’t ask for them.标「{{mark}}」的字段是 AI 自行补充的,你没有要求。· zh-Hant標「{{mark}}」的欄位是 AI 自行補充的,你沒有要求。de-quote-pairing-3876.test.ts(@object-ui/i18n): the de value quotes the mark as„{{mark}}“, one more matched pair, so the census's two literal counts move 118 → 119 with a dated line, as every earlier added pair did.title={f.name}site (ChatbotEnhanced.tsx~L4363) is a different chip: the phase-1 fallback drawn fromblueprint.objects[].fieldswhen there is noplanCard, which never carriessuggested. Not touched..changeset/33419-plan-card-suggested-legend.md:@object-ui/plugin-chatbotand@object-ui/i18npatch (both shipdist), with both declaration lines.Tests
ChatbotEnhanced.planCardSuggestedLegend-33419.test.tsx. Each message goes through the real mapper (uiMessageToChatMessage) from a rawpropose_blueprinttool part and rendersChatbotEnhancedinsideI18nProvider:title) and one suggested (category): exactly one legend, text标「补充」的字段是 AI 自行补充的,你没有要求。, the last child of the objects block; the chips'titles are['title', 'category'], onlycategoryisdata-suggestedand ends· 补充.Fields marked “suggested” were added by the AI; you didn’t ask for them.data-suggestedchips, still one legend.suggestedtaken off every field: nodata-suggested, no legend, and the objects block holds no 「补充」.ChatbotEnhanced.tsxand the eleven locale files checked out atf068cde8(the new test kept): Test Files 1 failed, Tests 3 failed | 1 passed. The three legend cases red withexpected [] to have a length of 1 but got +0: nothing on the card explains the mark. The CONTROL passed.scripts/ablation-replace.mjsonChatbotEnhanced.tsx: the legend condition{anySuggested ? (made always true ({(anySuggested || String("ABL33419").length > 0) ? (), blob60bc95c2→8b8a204f: Tests 1 failed | 3 passed, the red isCONTROL: no suggested field on the card draws no legend. Restored: blob == HEAD,git diff HEADempty. ui vitest imports the component from source, so no build sits between mutation and run.Acceptance notes
ChatbotEnhanced.tsx, its tests, the locale packs and the changeset.ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.tswas also edited: it is the i18n package's census of de quote pairs, and an added„…“pair moves its two literal counts.@object-ui/i18npacks, nothing removed or narrowed, no published export changed:Clause-②: yes (widening),Metadata-protocol: none, as the claim opened.Verification
Run on head
004a1dec(baseorigin/mainf068cde8;origin/mainhas moved 4 commits since, none touchingui/packages/plugin-chatbotorui/packages/i18n, and the merge is clean).Build, tests, type-check and lint
pnpm --workspace-concurrency=2 --filter '@objectstack/spec...' --filter '@objectstack/formula...' --filter '@objectstack/client...' --filter '@objectstack/lint...' --filter '@objectstack/sdui-parser...' build, thenpnpm --workspace-concurrency=2 --filter '@object-ui/plugin-chatbot^...' build: both VERDICT command-exit 0.004a1dec: Test Files 1 passed (1), Tests 4 passed (4).pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-chatbot/ packages/i18n/onb8efe96b: Test Files 201 passed (201), Tests 2850 passed, 13 skipped (2863). (Onea89a727, before the census bump: 1 file failed, the twode-quote-pairing-3876counts reading 119 against 118.)004a1decchanges only the new test file's types.pnpm --filter @object-ui/i18n run type-check: exit 0.pnpm --filter @object-ui/plugin-chatbot run type-check(tsc --noEmit && tsc -p tsconfig.test.json): exit 2 onb8efe96b(TS2322 in the new test's replaced-objects helper), exit 0 on004a1dec.ChatbotEnhanced.tsx, the new test and the de census test: exit 0, 0 errors (12 warnings, all on pre-existing lines outsidePlanCardObjectRows).pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.Derived gates (38)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 38 families, the same 38 onb8efe96band004a1dec. All 38 exited 0 onb8efe96b; the first 15 (those that ran before the test-typing edit) were run again on004a1decand exited 0, among thempnpm --dir ui exec vitest run scripts/; the other 23, among thempnpm check:type-check-debt,pnpm check:test-source-alias,pnpm check:published-filesandpnpm check:type-check-coverage, ran with the edited test file already on disk.--ranreconciliation on004a1dec: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN. Changed lines: under the 3,000 threshold.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5nPjRkNSgKVPP1Y6tw