Skip to content

fix(plugin-sharing): new-queue form asks for the display name first and refuses a bad API name in the caller's language - #39153

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-39039-queue-name-zh
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-39039-queue-name-zh

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

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.

维护者速读

  • 用户能看到什么变化:中文后台在「设置 › 队列」新建队列时,先填「显示名称」,再填改名为「API 名称」的标识;标识填了中文会收到中文提示,不再是英文报错。
  • 为什么做:属于使用体验方向,替在非英文界面下建队列的业务管理员解决看不懂报错、把中文填进机器名的问题。
  • 出错会怎样:受影响的只是建队列表单的字段顺序、字段名和这一条提示文字;哪些名字能被接受完全不变,合并后可以直接撤回。
  • 要你做什么:无。

What changes

  • sys_queue declares label before name, so the create form asks for the display name first; name is 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 released sys_permission_set row object declared the same pair in the same order (display name first, "API Name" second).
  • What moves in the refusal's body (HTTP 400 and VALIDATION_FAILED are unchanged):
    1. A badly shaped string: still 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 "…").
    2. An absent, null or '' name, on insert or on an update that supplies an empty value: before, the hook answered invalid_format with the English sentence. Now the field's required check answers, with fields[name].code: 'required'.
    3. fields[] may now carry more than one entry (for example a missing label beside a bad name); before, the hook threw on name alone.
  • The machine-name rule itself is unchanged (ADR-0142 D1): a lowercase letter, then lowercase letters, digits and underscores. Its shape is now the object's declared queue_name_shape format rule (QUEUE_NAME_PATTERN, the same binding the sys_queue_member.queue guard 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's objects.sys_queue._validations.queue_name_shape.message, exactly as sys_work_calendar's code shape rule does. ADR-0077's routing table puts "reject a save when a condition holds" on a validation rule.
  • queue-hooks.ts steps aside for that shape (and for an absent name, which required refuses) because beforeInsert / beforeUpdate hooks 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.
  • Bundles regenerated with 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 carry sys_queue untranslated today, so they keep source copies, and their provenance hashes record that.
  • Auto-deriving the API name from the display name is NOT in this PR: the generic record create form that POST /api/v1/data/sys_queue comes 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):

  1. packages/plugins/plugin-sharing/src/queue-hooks.ts, the queueRowGuard hunk. Acceptance must not widen, so the string branch now returns where it used to throw.
  2. packages/plugins/plugin-sharing/src/objects/sys-queue.object.ts: the validations entry and the field order.
  3. 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

  • New src/queue-name-shape.test.ts runs on a real engine (ObjectQL + SqlDriver over in-memory SQLite) with the shipped sys_queue, the shipped bundle loaded into the memory i18n service and the real hook. It covers: the reported zh-CN create (refused with VALIDATION_FAILED and an invalid_format entry on name, the Chinese message, nothing written); the same in en; an update to a bad name (refused, stored name stands); acceptance unchanged (a machine name writes, no name is refused required, a declared name is refused invalid_value); and the field order.
  • The engine throws no HTTP status. The door assigns it from 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)
pnpm --filter @objectstack/plugin-sharing test
 Test Files  80 passed (80)
      Tests  1774 passed | 11 skipped (1785)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/plugin-sharing typecheck
check:test-typecheck: OK — @objectstack/plugin-sharing's test layer compiles under tsconfig.test.json
os-verify-lock: VERDICT command-exit 0
Ablation: the hook answering first again turns the pin red

node scripts/ablation-replace.mjs replaced if (!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 to HEAD: blob) and git status is clean.

Acceptance notes

  • Not delivered, and filed as Record create forms neither derive a machine name from the display name nor check its declared format before submit (Setup queues and siblings) #39156: neither deriving the API name from the display name, nor checking the name in the browser before submit. Record create forms do not evaluate declared format rules; the only client-side evaluators are the studio-design and metadata-admin surfaces. The user still finds out on submit, now in their own language. Record create forms neither derive a machine name from the display name nor check its declared format before submit (Setup queues and siblings) #39156 carries both halves.
  • The declared-name collision refusal ("is the name of a queue an installed app declares") and the sys_queue_member.queue guard 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.
  • The sys_queue_detail record page lists details as name, label, description, and sys_queue keeps displayNameField: 'name' and highlightFields: ['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.
  • The Console form was not driven in a browser. The served zh-CN metadata (below) is what the form renders from.

Verification

Live: examples/app-starter, fresh database, dev admin, head 32ae555; the later commit touches only the changeset
POST /api/v1/data/sys_queue  Accept-Language: zh-CN  {"name":"售后工单池","label":"售后工单池"}
400 {"error":"API 名称须以小写字母开头,且只能包含小写字母、数字和下划线,如 after_sales。记录、分配规则、审批和共享规则都通过它引用该队列。","code":"VALIDATION_FAILED","fields":[{"field":"name","code":"invalid_format","message":"API 名称须以…"}],"object":"sys_queue"}

same, Accept-Language: en
400 {"error":"The API name must start with a lowercase letter and use only lowercase letters, digits and underscores, such as after_sales. …","code":"VALIDATION_FAILED","fields":[{"field":"name","code":"invalid_format",…}],"object":"sys_queue"}

POST {"name":"after_sales","label":"售后工单池"}  ->  201

GET /api/v1/meta/object/sys_queue  Accept-Language: zh-CN
fields: organization_id, created_at, created_by, updated_at, updated_by, label (显示名称), name (API 名称), description
Gates: dispatch-gates --commands derived 70; --ran reconciliation
Run reconciliation — 70 derived, 67 run, 3 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 70 derived famil(ies) accounted for — 67 run, 3 NOT-MEASURED (0 DERIVED from a recorded exit 3, 3 claimed).

All 67 that ran exited 0, including pnpm check:i18n (all bundles in sync) and pnpm 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

… 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
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-sharing, touching 9 documentable anchor(s).

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/approvals.mdx (via sys_queue (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/automation/queues-and-assignment-rules.mdx (via sys_queue (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/permissions/sharing-rules.mdx (via sys_queue (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json b706ec6ed2b88b921c919abee9d230fc7a7f58d1 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a4b1aee4b470a03b7231049ba56e211c4b2791ed — the merge of head e4cff5e166e5ec6f7e315a1374f71ad54f36990a into base b706ec6ed2b88b921c919abee9d230fc7a7f58d1, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs b706ec6ed2b88b921c919abee9d230fc7a7f58d1 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

速读 — 新建队列先填显示名称,机器名改叫「API 名称」;机器名格式不对时按调用者语言报错(中文界面中文提示)。席位 ACCEPT,非受管面,席位落地。
要你做什么 — 无。
范围外 — 自动生成 API 名称与提交前校验立后续卡 #39156。
席位意见 — 独立 L1 首轮 REWORK(声明与 changeset 漏写空名称的错误码变化),第二轮只改 changeset 与正文,席位复核通过。

席位核对

ACCEPT · head e4cff5e166e5ec6f7e315a1374f71ad54f36990a · independent L1 (review sub-agent, round 1 REWORK at 32ae5550) + seat delta read of round 2 (changeset only, source byte-identical).

  1. Shape — draft, base main, first line Fixes #39039, the only closing keyword (l1-face.mjs CLEAN, 13 items). Merging delivers the card's failure (a Chinese 名称 refused server-side in English, machine name asked first). The undelivered half of the card's Expected (derive the API name; check before submit) is Record create forms neither derive a machine name from the display name nor check its declared format before submit (Setup queues and siblings) #39156, named in the PR's Acceptance notes; the seat accepts the narrowing.
  2. Premise measured — the L1 compared main and branch: the same regex ^[a-z][a-z0-9_]*$ on insert and on single and bulk update (engine-insert.ts:1458, engine-update.ts:1783, 2297, 2314); nothing newly accepted or refused. The refusal now comes from the declared queue_name_shape format rule (precedent sys-work-calendar.object.ts:171), localized; the dev measured 400 with the zh-CN and en messages live on app-starter.
  3. Gate check-runs — at this head: 41 success, 20 expected skip, 0 failed, 0 pending, mergeable_state clean. The dev's runs: plugin-sharing 1774 passed, 11 skipped; the new queue-name-shape.test.ts (5 tests) runs on a real engine; ablation reported (hook throws again → 3 red).
  4. Accepted deviations — Clause-②: no kept, with the explicit sentence the seat asked for: a blank name now answers fields[name].code: 'required' instead of invalid_format, a bad shape stays invalid_format (reworded, no (got "…")), and fields[] may list more than one field; HTTP 400 and VALIDATION_FAILED unchanged. Changeset states all three. Beyond the claimed surface: the new test file, the edited ownership-queue.test.ts pin and the changeset.
  5. Out of scope — filed Record create forms neither derive a machine name from the display name nor check its declared format before submit (Setup queues and siblings) #39156 (derive; pre-submit format check; names the sys_assignment_rule English guard as the same family). Queue-name collision and sys_queue_member.queue guard English text: dropped — localizing them needs the spec message catalog and no door reading reached them. Detail-page order and displayNameField: 'name': dropped — polish, noted in the PR.
  6. Landing — not governed (check-governed-merges.mjs --pr 39153), 395 lines ≤ 3000, landing-k.mjs OK (K = 0, no new locale pack, no shared book). The seat lands it: ready + auto-merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

Landing · 2026-12-02T15:37Z

Probe Reading
check-governed-merges.mjs --pr 39153 NOT governed · 395 lines ≤ 3000
landing-k.mjs --pr 39153 K = 0 < 15 · OK

Status: ACCEPT 7350595709 at e4cff5e166; ready + auto-merge now. On MERGED the seat closes out #39039 (remove pm:dispatched).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 15:38
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 8d4395b Dec 2, 2026
62 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39039-queue-name-zh branch December 2, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants