Repository navigation
fix(plugin-chatbot): name an over-size attachment and the limit to the user instead of only console.warn - #35272
Conversation
…e user instead of only console.warn Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
…chment notice Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Final head for review · area ux-2 · 2026-11-19T01:38Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 Contract reviewServed-tier: Face: declaration ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-19T01:42Z
State: draft → ready + auto-merge (merge queue). #34463 closes on merge via |
Requested by Bill · project thread
Fixes #34463
Clause-②: yes (widening)
Metadata-protocol: none
The two widenings are additive: the new key
chatbot.composer.fileTooLargein every locale pack@object-ui/i18npublishes through./locales, and the optionalfilesfield on theonErrorargument ofPromptInputProps, exported asAIElementsfrom@object-ui/plugin-chatbot.维护者速读
console.warn,用户看到的是文件「没附上」却不知道原因;一次选了大小混合的文件时,大文件连console.warn都没有。onError的上报时机(混合选择多报一次,多带一个可选的files字段);回滚即还原本 PR。ui/packages/plugin-chatbot/src/elements/prompt-input.tsx(addLocal的超限分支);ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx(handlePromptInputError与ComposerNotice);ui/packages/i18n/src/locales/zh-Hans.ts(新键译文)。pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.sendError.test.tsx,预期 14 个测试全绿,其中 5 个是本卡新增的超限提示用例。What changes
PromptInput, vendored AI Elements):addLocalnow reports EVERY over-size file of a pick throughonError({ code: 'max_file_size', files }). Before, it reported only a pick where every file was over the limit; a mixed pick attached the small files and dropped the large ones with no report at all. The error object gains one optional field,files?: File[](the refused files);codeandmessagekeep their meaning.ChatbotEnhanced): theonErrorhandler that only calledconsole.warnnow turns amax_file_sizerefusal into a notice above the composer, naming every refused file and the limit (10 MBby default, spelled byIntl.NumberFormatin the user's locale). It uses the band the chat already shows for an unsent message:SendErrorNotice's markup is now a sharedComposerNotice, so both read the same. The notice closes with its close button or on the next send; a later refusal replaces it. Other codes still go toconsole.warn(see Acceptance notes).chatbot.composer.fileTooLarge({{limit}},{{files}}) in all eleven locale files underui/packages/i18n/src/locales/, next to the composer's existingchatbot.composer.*keys. The close button reusescommon.close..changeset/34463-composer-oversize-notice.md,patchon@object-ui/plugin-chatbotand@object-ui/i18n.Tests
A new top-level
describeinChatbotEnhanced.sendError.test.tsx, the composer-notice file, so no new harness file:role="alert") names the file and the limit, and the file is not attached;zh, the notice is the zh pack sentence and not the en one (read from the packs, not from literals).Ablation (each leg through scripts/ablation-replace.mjs, restored and verified as blob == HEAD)
if (oversized.length > 0) {becameif (oversized.length > 0 && sized.length === 0) {(the old mixed-pick silence). Result:× a mixed pick attaches the file under the limit and names only the one over it,Tests 1 failed | 4 passed | 9 skipped (14). Restored:blob == HEAD (5d03375a8c39) and git diff HEAD is empty.if (e.code === 'max_file_size' && e.files?.length) {changed so it never matches (the oldconsole.warn-only handler). Result: the over-size, mixed, close and zh cases fail, CONTROL passes,Tests 4 failed | 1 passed | 9 skipped (14). Restored:blob == HEAD (de5e3f172a98).The test imports
../ChatbotEnhancedfrom source, so nodistrebuild was needed for either leg.Package suites and typecheck, at head a4b0e49
pnpm --dir ui exec vitest run packages/plugin-chatbot/ packages/i18n/ --maxWorkers=2exited 0:Test Files 207 passed (207),Tests 3006 passed | 13 skipped (3019). The i18n locale gates (key parity across all locales, glyph and quote rules) are in this run.pnpm --dir ui exec vitest run scripts/ --maxWorkers=2exited 0:Test Files 171 passed | 2 skipped (173).pnpm --filter @object-ui/plugin-chatbot type-checkexited 0, and so didpnpm --filter @object-ui/i18n type-check. Both runtsc -p tsconfig.test.json, which includessrc/**/*.test.tsx.Acceptance notes
acceptandmax_filescodes.accepthas the same shape as the bug this PR fixes: it reports only a pick where every file fails the type check, and drops a failing file from a mixed pick silently. Its fix is in other lines ofaddLocal, so it stays out of this PR. A separate, larger defect sits under it, and the agent's report hands it to the seat as a finding instead of fixing it here:matchesAcceptcompares eachaccepttoken withFile.type, so extension tokens (.pdf,.csv,.xlsx…) never match. A probe render ofChatbotEnhanced(enableFileUpload, defaultacceptedFileTypes) pickedclaims.csv(text/csv), thenr.pdf(application/pdf), thenok.png. The two warnings were["accept","accept"]: the csv and the pdf did not attach, and only the png did.ChatbotEnhancedpasses nomaxFiles, somax_filesnever fires in this composer. Both codes still reach onlyconsole.warnhere; making them visible needs their own wording and thematchesAcceptfix first.PromptInputProvider'sadd()applies neitheracceptnormaxFileSize.ChatbotEnhanceddoes not mount a provider, so nothing reaches this today.dist). The new key appears in all elevendist/locales/*.d.tsof@object-ui/i18n, which the package publishes through its./localesexport: as areadonlyliteral inen,zh-Hansandzh-Hant, and asstringin the others.PromptInputProps['onError']gains the optionalfilesfield. It is exported asAIElementsfrom@object-ui/plugin-chatbot. Both are additive. The seat ruled themClause-②: yes (widening), and the declaration lines above and in the changeset say so.10 * 1024 * 1024), shown with the locale'smegabyteunit label as10 MB. That matches how the composer's default has always been described.Verification
node scripts/pm/dispatch-gates.mjs --commandsnamed 41 commands at heada4b0e496, and all 41 exited 0. Reconciliation:✓ dispatch-gates --ran: 41 derived famil(ies) accounted for — 41 run, 0 NOT-MEASURED (a DERIVED zero — all 41 recorded an exit code and none of them is 3).node scripts/check-nul-bytes.mjsexited 0.Lint UI,Type Check UI,Test UIand the type-check lanes.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ