Repository navigation
fix(plugin-chatbot): composer accept list reads the HTML accept grammar; a refused type is named to the user - #35330
Merged
objectstack-fleet[bot] merged 2 commits intoNov 19, 2026
Conversation
…ar; a refused type is named to the user
Fixes the extension tokens (.pdf, .csv, .xlsx...) of the default accept
list never matching, and reports every type-refused file through
onError({ code: 'accept', files }) in the composer notice band.
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
Contributor
Author
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Final head for review · area ux-2 · 2026-11-19T05:28Z |
Contributor
Author
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
Contributor
Author
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-19T05:31Z
State: draft → ready + auto-merge (merge queue). #35276 closes on merge via |
objectstack-fleet
Bot
deleted the
claude/issue-35276-composer-accept-tokens
branch
November 19, 2026 05:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Bill · project thread
Fixes #35276
Clause-②: no
Metadata-protocol: none
维护者速读
accept语法(.ext按文件名后缀、type/*按 MIME 前缀、其余按 MIME 精确匹配,均不区分大小写);被拒的文件在输入框上方的提示条里点名并列出允许的类型。.pdf,.csv,.xlsx…这类后缀,旧逻辑拿它和 MIME 类型逐字比较,永远不相等——用户选了 CSV / PDF 却静默附不上,只有控制台有一条 warn。@object-ui/plugin-chatbot一个包、纯前端;回滚即 revert 本 PR。onError对“部分被拒”的选择多回调一次(同code: 'accept',带files),不读files的宿主行为不变。ui/packages/plugin-chatbot/src/elements/prompt-input.tsx(fileMatchesAccept与addLocal的拒收上报)、ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx(handlePromptInputError的 accept 分支与同一次选择的提示合并)、测试文件ChatbotEnhanced.sendError.test.tsx新增的 describe。pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.sendError.test.tsx,预期 22 passed(含新增 8 条 objectstack#35276 用例)。What changes
PromptInput(vendored AI Elements,elements/prompt-input.tsx): the accept check moves into one module-level helper,fileMatchesAccept, that reads the HTMLacceptgrammar: a.exttoken matches the end of the file NAME, atype/*token matches the MIME prefix, any other token matches the MIME type exactly, all case-insensitive; an empty list admits everything. The helper is not exported (no new public symbol).addLocalnow reports EVERY type-refused file throughonError({ code: 'accept', files }), in the all-refused case and in a mixed pick, mirroring themax_file_sizeshape the previous composer-notice change added. Before, a mixed pick dropped the type-failing files with no report, and the all-refused report carried nofiles.ChatbotEnhanced:handlePromptInputErrorshows anacceptrefusal in the existingComposerNoticeband (chat-attachment-refused), naming the refused files and the accepted list. The sentence reuses the existing pack keyfields.file.typeNotAccepted(present in every built-in locale pack), so no locale file changes and no new key. Refusals reported by one pick (wrong type and over size) are joined into one notice instead of the second replacing the first..changeset/35276-composer-accept-tokens.md,patchon@object-ui/plugin-chatbot.Tests
New top-level
describein the existing composer-notice harnessChatbotEnhanced.sendError.test.tsx(8 cases):.exttoken matches the name case-insensitively whatever type the browser reported (EXPORT.CSVwith an empty type,Book.XLSXasapplication/octet-stream);image/*,.CSV,application/pdf) each admit their own files and nothing else (video/mp4andapplication/x-pdfrefused);role="alert") naming the file and the accepted list, and is not attached;.pngwith the default list attaches with no notice;Package run and type-check (head f14d489)
Ablations (each mutation proven on disk by scripts/ablation-replace.mjs, restored to the HEAD blob)
The test resolves
../ChatbotEnhancedfrom source, so no rebuild is involved.fileMatchesAccept(if (token.startsWith(".")) {toif (false && token.startsWith(".")) {): 4 failed / 18 passed, the CSV-and-PDF, case-insensitive-extension, grammar and mixed-pick cases red.handlePromptInputError(thee.code === 'accept'arm tofalse): 5 failed / 17 passed, the grammar, refused-type, mixed-pick, type-and-size and zh cases red.addLocal(if (refused.length > 0) {toif (refused.length > 0 && accepted.length === 0) {): 3 failed / 19 passed, the grammar, mixed-pick and type-and-size cases red.Every restore: blob equals HEAD and
git diff HEADis empty.Acceptance notes
"NAME" is not an accepted file type (LIST)); a pick refusing several files lists their names inside it. A plural-aware sentence would need a new key in every published locale pack (a widening), which the dispatch asked to avoid when an existing sentence fits.ui/: this one and the privatematchesAcceptEntry/acceptErrorin@object-ui/fieldsFileField.tsx. They differ deliberately in one point: the field widget admits a pick no entry can be weighed against (mirroring the server's save-time check), while the composer has no server check behind it and refuses. Noted, not filed (no defect).PromptInputProvider'sattachments.add(provider mode) applies no accept, size or count check at all;ChatbotEnhanceddoes not use provider mode, so nothing reaches it today. Noted, not filed.Verification
Derived gate families (node scripts/pm/dispatch-gates.mjs --commands, tree f14d489)
All 39 derived families exit 0 locally; reconciliation:
Also run:
pnpm check:new-line-citations(ui):VERDICT new-cross-file-line-citations: 0 new citation(s). Every family CI runs is read from this PR's check-runs, not re-run here.node scripts/pm/overlap-check.mjs:VERDICT clean exit 0(against origin/main, 0 PR heads sharing a file).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ