Description
domain:ui#6 · os-sales · session_01L6bhgUAXJEaRNwDiLuAvEZ
carries item 2 of #32684; #32684 keeps item 1 (the file-type refusal read as a permission error, and the file widget's missing accept hint). Item 3 (the upload-link page) is carried by a separate card.
Filing category: ① product defect (user-visible). reach: as measured on #32684 (console record form, zh-CN, hosted tenant; pnpm dev:stack --with-ui; cloud ff373e02, framework d7c3d44e).
维护者速读
员工录入报销明细时,如果发票号码重复,表单顶部只显示一句英文「A record with this value already exists」,不说是哪个字段。原因在服务端:发票号码的唯一约束按组织划分(unique: 'organization'),数据库里是「组织 + 发票号码」两列的组合索引,服务端遇到组合键时故意不报字段名,所以前端拿不到字段,也就无法显示「发票号码已存在」。
What happens (from #32684 item 2)
A unique index on invoice_no declared unique: 'organization'; a duplicate number answers 409 UNIQUE_VIOLATION with no field, and the form shows the server sentence 「A record with this value already exists」 at the top of the zh-CN form, naming no field. Server log: UNIQUE constraint failed: k7en_claim_line.organization_id, k7en_claim_line.invoice_no.
Where it comes from (read on 6bbdf301, by the domain:ui#6 seat's read-only premise check)
- The sentence is a server string:
packages/types/src/data-error-classification.ts(~:1110 theDuplicateRecordErrorbranch, ~:1749 the raw driver unique-violation branch). Both send409 UNIQUE_VIOLATIONwithfieldonly when ONE column can be determined; theDuplicateRecordErrorbranch also sendsfieldLabeland then says "A record with this ${label} already exists". - A composite key deliberately resolves to no
field:packages/types/src/unique-violation.ts(~:302,:390) and:60-66, "a wrong field name is worse than none").packages/objectql/src/duplicate-record-error.ts( unique: 'organization'builds exactly such a composite (scope column + the field), so the declared single-field uniqueness never reaches the client as a field.- The console already reads a
409 UNIQUE_VIOLATIONthat names itsfield(ui/apps/console/src/components/FormPage.tsx~:2004), so once the server names the field the ui side is small (a localized per-field message).
Expected
When the violated index is a field declared unique: '<scope>' (the scope column(s) plus one field), the refusal names that field (field, fieldLabel), so the form can show 「发票号码已存在」 on the field. A genuinely multi-field user index keeps naming none.
Reader who acts: domain:server (unique-violation classification in packages/types / packages/objectql); a localized ui rendering may follow as a domain:ui card once the field arrives. Triage decides the lane and grade.
Dedupe: repo:objectstack-ai/objectstack is:issue UNIQUE_VIOLATION composite field and unique organization scope field name refusal → 24 and 108 hits; the closest are #24951 (closed: the unique refusal sentence names the object) and #29176 (closed: empty string on an optional unique field). None is about a scope-composite key dropping the field.
Related: #32684.
Generated by Claude Code
Activity
objectstack-fleet commentedon Nov 12, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: first touch (requested by
domain:ui#6) →domain:server· p2 ·pm:queue· 2026-11-12T11:26Z⛔ Not a claim.
domain:server(packages/types/src/data-error-classification.ts, theDuplicateRecordErrorpath that dropsfieldfor a composite key). For an organization-scoped unique index the composite is(organization_id, column), andorganization_idis implied, so the refusal can name the column. Index keys of more than one authored column keep today's answer.userMessage; this card owns naming the field.Generated by Claude Code
objectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J
Claim: PM loop round 1
Session:
session_016WV4cwqTK71kjQzHae8T5JAccount:
os-elon-muskBranch:
claude/issue-32711-unique-org-fielduntil the card thread opens; the card thread's designatedclaude/project-thread-*branch replaces it in a whole re-posted claim before the first pushWorktree:
objectstack-issue-32711Domain:
domain:serverSeat:
domain:server#8File surface:
packages/types/src/data-error-classification.ts(theDuplicateRecordErrorbranch and the raw driver unique-violation branch),packages/types/src/unique-violation.ts,packages/objectql/src/duplicate-record-error.ts, their tests,.changeset/**(stop on breach; explain in the report)Container & model:
S/M,mode:thread,model: opus(TIER_DEFAULT;dispatch-gates.mjs --tier: no path-derived mandate; no published accept set or public type changes),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
packages/types + packages/objectql (objectstack) drop the column for a composite (organization_id, column) key | none | every form saving a duplicate into an organization-scoped unique field (measured on #32684, zh-CN hosted tenant)Thread-read: 6822312691
Premise: holds
Serial constraints cleared:
none: no in-flight claim names packages/types or duplicate-record-error.ts; the localized-text program (#32654 → #32655) owns the userMessage language, not the field nameobjectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4d1cbmZUz6oSJTqaY8e
Claim: PM loop round 1 (whole claim re-posted by the card thread with its designated branch; supersedes 6836634939)
Session:
session_016WV4d1cbmZUz6oSJTqaY8eAccount:
os-elon-muskBranch:
claude/project-thread-16qdjpWorktree:
objectstack-issue-32711Domain:
domain:serverSeat:
domain:server#8File surface:
packages/types/src/data-error-classification.ts(theDuplicateRecordErrorbranch and the raw driver unique-violation branch),packages/types/src/unique-violation.ts,packages/objectql/src/duplicate-record-error.ts, their tests (packages/types/src/unique-violation.test.ts,packages/rest/src/rest-unique-violation-dialects.test.ts— the raw branch's dialect table,packages/objectql/src/engine-duplicate-record-label-sentence.test.ts— the envelope branch's label pin),.changeset/**(stop on breach; explain in the report)Container & model:
S/M,mode:thread,model: opus(TIER_DEFAULT;dispatch-gates.mjs --tier: no path-derived mandate; no published accept set or public type changes),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
packages/types + packages/objectql (objectstack) drop the column for a composite (organization_id, column) key | none | every form saving a duplicate into an organization-scoped unique field (measured on #32684, zh-CN hosted tenant)Thread-read: 6836634939
Premise: holds
Serial constraints cleared:
none: no in-flight claim names packages/types or duplicate-record-error.ts; the localized-text program (#32654 → #32655) owns the userMessage language, not the field nameobjectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4d1cbmZUz6oSJTqaY8e
Claim: PM loop round 1 (whole claim re-posted by the card thread; supersedes 6836791577: the file surface gains one driver-sql test file, approved by the seat)
Session:
session_016WV4d1cbmZUz6oSJTqaY8eAccount:
os-elon-muskBranch:
claude/project-thread-16qdjpWorktree:
objectstack-issue-32711Domain:
domain:serverSeat:
domain:server#8File surface:
packages/types/src/data-error-classification.ts(theDuplicateRecordErrorbranch and the raw driver unique-violation branch),packages/types/src/unique-violation.ts,packages/objectql/src/duplicate-record-error.ts, their tests (packages/types/src/unique-violation.test.ts,packages/rest/src/rest-unique-violation-dialects.test.ts— the raw branch's dialect table,packages/objectql/src/engine-duplicate-record-label-sentence.test.ts— the envelope branch's label pin),packages/drivers/driver-sql/src/sql-driver-autonumber-resync.test.ts(pins and their doc comments only, no driver-sql source: the two pins assert the old composite-key contract this card changes),.changeset/**(stop on breach; explain in the report)Container & model:
S/M,mode:thread,model: opus(TIER_DEFAULT;dispatch-gates.mjs --tier: no path-derived mandate; no published accept set or public type changes),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
packages/types + packages/objectql (objectstack) drop the column for a composite (organization_id, column) key | none | every form saving a duplicate into an organization-scoped unique field (measured on #32684, zh-CN hosted tenant)Thread-read: 6836791577
Premise: holds
Serial constraints cleared:
none: no in-flight claim names packages/types or duplicate-record-error.ts; the localized-text program (#32654 → #32655) owns the userMessage language, not the field nameobjectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4d1cbmZUz6oSJTqaY8e
Claim: PM loop round 1 (whole claim re-posted by the card thread; supersedes 6836963229 per the seat's ruling A: the refusals read a new
uniqueViolationField,uniqueViolationColumnand the autonumber routing stay unchanged, so the driver-sql test file leaves the surface)Session:
session_016WV4d1cbmZUz6oSJTqaY8eAccount:
os-elon-muskBranch:
claude/project-thread-16qdjpWorktree:
objectstack-issue-32711Domain:
domain:serverSeat:
domain:server#8File surface:
packages/types/src/data-error-classification.ts(theDuplicateRecordErrorbranch and the raw driver unique-violation branch),packages/types/src/unique-violation.ts(incl. the new exportuniqueViolationField),packages/objectql/src/duplicate-record-error.ts, their tests (packages/types/src/unique-violation.test.ts,packages/rest/src/rest-unique-violation-dialects.test.ts— the raw branch's dialect table,packages/objectql/src/engine-duplicate-record-label-sentence.test.ts— the envelope branch's label pin),.changeset/**(stop on breach; explain in the report)Container & model:
S/M,mode:thread,model: opus(TIER_DEFAULT;dispatch-gates.mjs --tier: no path-derived mandate; one public export added, declared on the Clause-② line),effort: highClause-②: yes (widening) —
@objectstack/typesnewly exportsuniqueViolationField, and a409 UNIQUE_VIOLATIONfor a duplicate in an organization-scoped unique field now carriesfield(and the engine envelopefieldLabel) where it carried none; nothing existing is removed, retyped or refused, anduniqueViolationColumnanswers exactly as before.Metadata-protocol: none
Responsibility:
packages/types + packages/objectql (objectstack) drop the column for a composite (organization_id, column) key | none | every form saving a duplicate into an organization-scoped unique field (measured on #32684, zh-CN hosted tenant)Thread-read: 6836963229
Premise: holds
Serial constraints cleared:
none: no in-flight claim names packages/types or duplicate-record-error.ts; the localized-text program (#32654 → #32655) owns the userMessage language, not the field nameobjectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4d1cbmZUz6oSJTqaY8e
Claim: PM loop round 1 (whole claim re-posted by the card thread; supersedes 6837574209: the seat approved six consumer test files that pin the old no-field answer through real stacks, and the
unique-scopesource comment this change makes false; ruling A stands: the refusals read a newuniqueViolationField,uniqueViolationColumnand the autonumber routing stay unchanged, driver-sql stays off the surface)Session:
session_016WV4d1cbmZUz6oSJTqaY8eAccount:
os-elon-muskBranch:
claude/project-thread-16qdjpWorktree:
objectstack-issue-32711Domain:
domain:serverSeat:
domain:server#8File surface:
packages/types/src/data-error-classification.ts(theDuplicateRecordErrorbranch and the raw driver unique-violation branch),packages/types/src/unique-violation.ts(incl. the new exportuniqueViolationField),packages/objectql/src/duplicate-record-error.ts, their tests (packages/types/src/unique-violation.test.ts,packages/rest/src/rest-unique-violation-dialects.test.ts— the raw branch's dialect table,packages/objectql/src/engine-duplicate-record-label-sentence.test.ts— the envelope branch's label pin); the consumer pins of the old no-field answer:packages/rest/src/data-package-scoped-refusal-candidates.test.ts,packages/runtime/src/dispatcher-unique-violation-wire-code.test.ts,packages/runtime/src/sandbox-relay-unique-violation-wire-code.test.ts,packages/qa/dogfood/test/field-unique-rest-refusal.dogfood.test.ts,packages/qa/dogfood/test/error-sentences-live.dogfood.test.ts,packages/verify/src/unique-scope.test.ts),packages/verify/src/unique-scope.ts(the attribution comment only),.changeset/**(stop on breach; explain in the report)Container & model:
S/M,mode:thread,model: opus(TIER_DEFAULT;dispatch-gates.mjs --tier: no path-derived mandate; one public export added, declared on the Clause-② line),effort: highClause-②: yes (widening) —
@objectstack/typesnewly exportsuniqueViolationField, and a409 UNIQUE_VIOLATIONfor a duplicate in an organization-scoped unique field now carriesfield(and the engine envelopefieldLabel) where it carried none; nothing existing is removed, retyped or refused, anduniqueViolationColumnanswers exactly as before.Metadata-protocol: none
Responsibility:
packages/types + packages/objectql (objectstack) drop the column for a composite (organization_id, column) key | none | every form saving a duplicate into an organization-scoped unique field (measured on #32684, zh-CN hosted tenant)Thread-read: 6837574209
Premise: holds
Serial constraints cleared:
none: no in-flight claim names packages/types or duplicate-record-error.ts; the localized-text program (#32654 → #32655) owns the userMessage language, not the field nametest: re-pin the consumers that held the old no-field answer for an o…
objectstack-fleet commentedon Nov 12, 2026
domain:server#8 · os-elon-musk · session_016WV4d1cbmZUz6oSJTqaY8e
os-dev-report
{ "issue": 32711, "status": "done", "branch": "claude/project-thread-16qdjp", "pr": "https://github.com/objectstack-ai/objectstack/pull/32935", "session": "session_016WV4d1cbmZUz6oSJTqaY8e", "premise_still_valid": true, "summary": "A duplicate in an organization-scoped unique field (`unique: 'organization'` / `unique: true`, keyed `(organization_id, FIELD)`) now answers 409 UNIQUE_VIOLATION with `field`, and on the engine envelope with `fieldLabel` and the labelled sentence. Per seat ruling A this is a new export `uniqueViolationField` (it sets the implied `organization_id` key part aside), read by both refusal branches; `uniqueViolationColumn` and the autonumber retry routing are unchanged, because a named column there made a co-tenant in the same batch burn a number. A key of more than one authored column, another tenantField, index names and the legacy COALESCE expression still name no field. Six consumer test files that pinned the old no-field answer through real stacks were re-pinned under a seat-approved surface addition; the verify attribution control was reshaped to a two-authored-column index so its no-field + twin-refused path keeps live coverage.", "tests": "types test 894/894; objectql test 12622/12622; driver-sql test 4229 passed (250 files, incl. the 10 autonumber files, untouched); rest test 8146 passed | 332 skipped; consumer sweep 17 packages green (runtime 172, verify 33, dogfood 121, others in the PR body); typecheck green for types, objectql, rest, driver-sql, runtime, verify, dogfood. Ablations, each restored with blob == HEAD and dist clean: A1 uniqueViolationField sets nothing aside -> 13 positive pins red (types 3, rest 2, objectql 8); A2 a multi-column key names its first column -> negatives red (types 5, rest 3, objectql 4, core 2, driver-sql 10); A3 the routing answer sets the organization aside -> the uniqueViolationColumn invariant pin plus 4 driver-sql co-tenant/routing pins red. Excerpts in the PR body.", "gates": "node scripts/pm/dispatch-gates.mjs --ran final.ran at head 04634c890: 71 derived, 71 run, 0 NOT-MEASURED, 0 UNRUN; pnpm lint exit 0. check:test-source-alias was red at 1ad50318c on three edited suites, fixed by module-top imports (no timeout widened); check:dual-build-cjs-loads first exited 3 (unbuilt packages), exit 0 once built. CI check-runs: not yet concluded at report time.", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm", "mcp_calls": "4 — mcp__github__issue_read (read only)", "api_writes": "0 REST proxy writes; relay writes only: claim comments via post-stamped (6836791577, 6836963229, 6837574209, 6838469816), pr_create #32935 via fleet-write", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "class: b · reach: restoring a recycle-bin entry whose organization-scoped unique value another live row now holds answers RESTORE_UNIQUE_VALUE_TAKEN with no field (packages/objectql/src/recycle-bin/restore.ts still asks uniqueViolationColumn) · evidence: PR #32935 Acceptance notes · dedupe words: restore unique field organization", "carrier: PR #32935 · noted, not filed" ] }objectstack-fleet commentedon Nov 13, 2026
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J
Merge-queue kick of PR #32935 (this card's PR) · head
d1fd57141a1be5d37c263be88c73e32f5da327a1· 2026-11-13T01:26Z9fa8b571f9, base93c0c737a3), job Test Core (7/8), step "Run this shard's tests", first error:@objectstack/cli:test: FAIL integration src/commands/migrate/stored-references.integration.test.ts > os migrate stored-references bind > CONTROL: a database of one package has nothing to bind — AssertionError: expected { unparsed: '' } to match object { outcome: 'refused', …(2) }.487ed86a52, whose only parent is this PR's group commit9fa8b571f9), ran the same shard, Test Core (7/8), green on a tree that contains this change. (2) The card thread ran the file locally on this head: 12/12. (3) This diff touches nopackages/clifile and no migrate command; the failure is the bind command printing nothing (16 ms), not a unique-violation answer.@objectstack/objectql); first error a timeout: no (anAssertionErroron a product value). So per the landing rules this PR is not re-queued by the seat; the decision goes to the maintainer.