Repository navigation
fix(plugin-sharing): new-queue form asks for the display name first and refuses a bad API name in the caller's language - #39153
Conversation
… a bad API name in the caller's locale Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaQsbKBMQtm6Tpsamd
…pin it on a real engine Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaQsbKBMQtm6Tpsamd
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a4b1aee4b470a03b7231049ba56e211c4b2791ed && git checkout a4b1aee4b470a03b7231049ba56e211c4b2791ed
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b706ec6ed2b88b921c919abee9d230fc7a7f58d1 e4cff5e166e5ec6f7e315a1374f71ad54f36990a && git checkout -B drift-repro b706ec6ed2b88b921c919abee9d230fc7a7f58d1 && git merge --no-ff e4cff5e166e5ec6f7e315a1374f71ad54f36990a
node scripts/docs-audit/affected-docs.mjs --json b706ec6ed2b88b921c919abee9d230fc7a7f58d1
|
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CaQsbKBMQtm6Tpsamd
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd 速读 — 新建队列先填显示名称,机器名改叫「API 名称」;机器名格式不对时按调用者语言报错(中文界面中文提示)。席位 ACCEPT,非受管面,席位落地。 席位核对ACCEPT · head
|
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd Landing · 2026-12-02T15:37Z
Status: ACCEPT 7350595709 at |
Fixes #39039
Clause-②: no
Metadata-protocol: none
Clause-② no: the accept set is unchanged; only the answer's field code for a blank name moves from invalid_format to required, and fields[] may list more than one field.
维护者速读
What changes
sys_queuedeclareslabelbeforename, so the create form asks for the display name first;nameis labelled API Name (zh-CN 「API 名称」, zh-Hant 「API 名稱」, and the term each translated locale's Console already uses for an object's API name). Precedent: the Console's object and field designers label a machine name "API Name"; the last releasedsys_permission_setrow object declared the same pair in the same order (display name first, "API Name" second).VALIDATION_FAILEDare unchanged):fields[name].code: 'invalid_format', now worded in the caller's locale by the declared rule. The English text is reworded and no longer ends with(got "…").nullor''name, on insert or on an update that supplies an empty value: before, the hook answeredinvalid_formatwith the English sentence. Now the field'srequiredcheck answers, withfields[name].code: 'required'.fields[]may now carry more than one entry (for example a missinglabelbeside a badname); before, the hook threw onnamealone.queue_name_shapeformat rule (QUEUE_NAME_PATTERN, the same binding thesys_queue_member.queueguard uses), the platform's existing path for a localized field refusal: the engine renders the rule's message in the caller's locale from the bundle'sobjects.sys_queue._validations.queue_name_shape.message, exactly assys_work_calendar'scodeshape rule does. ADR-0077's routing table puts "reject a save when a condition holds" on a validation rule.queue-hooks.tssteps aside for that shape (and for an absent name, whichrequiredrefuses) becausebeforeInsert/beforeUpdatehooks run before validation rules: a hook refusal there would keep answering first, in English. The hook keeps what only the runtime can judge: a name an installed app declares (one namespace, ADR-0142 D1) and a value that is not text at all.node scripts/check-i18n-bundles.mjs --write --filter=sharing; the new message and label are hand-translated in zh-CN, zh-Hant, ko, fr, de, pt-BR, ru and ar. ja-JP and es-ES carrysys_queueuntranslated today, so they keep source copies, and their provenance hashes record that.POST /api/v1/data/sys_queuecomes from has no derive mechanism. The only auto-slug precedent (createDerive) belongs to the metadata-admin create form, a different form path. The clearer label, the order and the localized refusal are the delivery.Read first (by risk):
packages/plugins/plugin-sharing/src/queue-hooks.ts, thequeueRowGuardhunk. Acceptance must not widen, so the string branch now returns where it used to throw.packages/plugins/plugin-sharing/src/objects/sys-queue.object.ts: thevalidationsentry and the field order.packages/plugins/plugin-sharing/src/queue-name-shape.test.ts: real-engine pins.Two-minute verification:
pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/queue-name-shape.test.ts. Expect 5 passed, including the zh-CN refusal starting 「API 名称须以小写字母开头」.Tests
src/queue-name-shape.test.tsruns on a real engine (ObjectQL + SqlDriver over in-memory SQLite) with the shippedsys_queue, the shipped bundle loaded into the memory i18n service and the real hook. It covers: the reported zh-CN create (refused withVALIDATION_FAILEDand aninvalid_formatentry onname, the Chinese message, nothing written); the same inen; an update to a bad name (refused, stored name stands); acceptance unchanged (a machine name writes, no name is refusedrequired, a declared name is refusedinvalid_value); and the field order.code, so the 400 is measured live below.ownership-queue.test.ts: the hook-only double now pins that the hook leaves a bad string to the declared rule and still refuses a non-text value and a declared name.Test and typecheck runs (head 32ae555; the later commit touches only the changeset)
Ablation: the hook answering first again turns the pin red
node scripts/ablation-replace.mjsreplacedif (!QUEUE_NAME_RE.test(name)) return;with a hook throw (anchor x1 -> x0, blob 2d484bb2 -> db4af49d). Result: 3 failed | 2 passed: the zh-CN, en and update pins went red, and the acceptance and order pins stayed green. After the restore, the blob is again 2d484bb27f64 (equal toHEAD:blob) andgit statusis clean.Acceptance notes
sys_queue_member.queueguard still answer in English from the hook. Neither can be a declared rule, because they need the runtime registry. Localizing them would need the spec's message catalog, which is outside this card's surface. You reach them only when you reuse an app-declared queue name or type a member's queue by hand.sys_assignment_rule's name guard (assignment-rule-hooks.ts) builds the same English machine-name sentence in a beforeInsert hook. It probably has the same symptom, but this PR has not measured it at a public door.sys_queue_detailrecord page lists details asname, label, description, andsys_queuekeepsdisplayNameField: 'name'andhighlightFields: ['name', 'label'], so record titles still lead with the API name. This PR touches neither: the page's file is outside the claimed surface, and the title fields are left as the seat ruled.Verification
Live: examples/app-starter, fresh database, dev admin, head 32ae555; the later commit touches only the changeset
Gates: dispatch-gates --commands derived 70; --ran reconciliation
All 67 that ran exited 0, including
pnpm check:i18n(all bundles in sync) andpnpm check:i18n-stale-fill(no new stale fills).NOT MEASURED:
check-plugin-teardown-shape --self-test: shallow clone, the pinned control commit is unreachable.check:dual-build-cjs-loads: packages outside this diff have no dist.check:query-options-erasure: the repo-wide eslint scan timed out on the shared box after its self-test passed.CI runs all three.
Generated by Claude Code