Repository navigation
fix(objectql): the duplicate refusal reads in the writer's locale and names a declared composite unique index's fields - #33348
Conversation
…nd name a declared composite unique index's fields Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM Co-authored-by: Claude <noreply@anthropic.com>
…on a real driver; changeset Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 2 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 — 176 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 f44d55ea5b382c9f88086eafbee18ca5f506745a && git checkout f44d55ea5b382c9f88086eafbee18ca5f506745a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6538ba48fc4590402cd6280cf83a8902f6de83d3 0b701b1551e4761e3e0c2a097f819c6f5e3014c1 && git checkout -B drift-repro 6538ba48fc4590402cd6280cf83a8902f6de83d3 && git merge --no-ff 0b701b1551e4761e3e0c2a097f819c6f5e3014c1
node scripts/docs-audit/affected-docs.mjs --json 6538ba48fc4590402cd6280cf83a8902f6de83d3
|
|
Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head af12b05 · 2026-11-14T17:16:40Z review#3. |
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment#33213 asks that a duplicate refusal read in the writer's language and say which combination collided. Composing at the producer (the engine, which holds the schema and the locale), and relaying in the classification (which holds neither), is the same split ruling C on #32440 set for refusal sentences. Matching driver columns against a declared index before naming anything turns driver text into a verdict only when the schema confirms it. Three keys chosen by how much can be named honestly is the smallest catalog that covers the cases. The design holds. Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM ACCEPT · area A2 · Fixes #33213 · head 0b701b1 · 2026-11-14T18:21Z
|
…eep readings (objectstack-ai#33990) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9LUUQvBoFyjm7sUdButadF7)_ Fixes objectstack-ai#33963 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:只改 `records-forms.json` 一个清单文件,把 v18.5.0 测试轮记下的 26 行文字问题落到 21 个条目上,每个条目 revision +1 并加一行 history。 - 为什么改:测试员按旧文字操作会走错入口、用错数据或误判结果(比如以为某缺陷还没修、以为某条只能挂起),下一轮测试会重复踩坑。 - 风险与回滚:只是测试清单文字,不动产品代码,不改任何验收判据的结论;回滚就是撤掉这一个提交。 - 先看:`records-forms.json` 里 `gantt-interactions`(只改前两步的操作说明,依赖一半按裁决保持 blocked)、`record-discussion-mentions`(changes_only 一项的原因改写)、`field-unique-enforcement`(复合唯一索引的提示语)。 - 两分钟验证:`pnpm check:platform-checklist`,应看到 `check-platform-checklist: OK — 16 areas, 429 items`。 - 需要你做的:无,席位落地。 ## What changes Batch A of the v18.5.0 sweep close-out (anchor objectstack-ai#33761, ledger comment 6896511848): every item-text re-point row that lands in `docs/qa/platform-checklist/areas/records-forms.json`. Each row was re-read at `origin/main` `895783a1` and the edit starts from the residue measured there, not from the parked text. 26 rows, 21 items; rows 143 and 224 are one edit, as are 141/219/220 (one item, three clauses) and 148/149, 221/222. Every edited item: `revision` +1 and one `history` row (ref `#PENDING-33963`, swapped for this PR's number in the second commit). The file is not canonical `JSON.stringify` output, so it was edited as text spans by a script that asserts each old span occurs once inside its item, then proves the parsed document equals the old one except in the declared fields of the 21 items (other items and the area-level fixtures value-equal). `coverage.json` was not regenerated: `check:platform-checklist` wrote nothing. | Ledger row | Item | Clause | What changed (or why not) | |:--|:--|:--|:--| | 9 | crud-roundtrip | steps[5] | The 1440 px tab row draws a panel tab only for a related panel with records; empty ones wait in the `+N` dropdown, so a fresh account reads `Overview / Activity N` (RecordPageColumns.tsx `partitionRecordTabsByRecords`; QA run objectstack-ai#33784). | | 13 | object-hook-lifecycle | automated.ref | Names `packages/verify/src/harness.hook-refusal-door.test.ts` (exists at the base) as evidence of its own layer. The locale-coverage half is new coverage, left to a checklist-author card. | | 14 | field-unique-enforcement | acceptance[0] | A declared composite unique index whose fields all carry labels is now named by those labels (objectstack-ai#33348, `duplicate_record_fields`); the generic sentence is left for what matches no such index. No step drives a composite, so no verdict moves. | | 126 | action-preflight-panel | steps[0] | The probe action may sit under the record header's overflow menu once three actions are inline (QA run objectstack-ai#33861). | | 128 | bulk-select-all-matching | knownGaps[1] | "expected FAIL until objectstack-ai#28552" retired: the defect closed in d5da45b (objectstack-ai#28606), and the three `*Capped` strings name the 5000 cap. acceptance[5] never said FAIL; unchanged. | | 131 | cascading-options | steps[0] | The New form is `.../showcase_cascade/new`; the bare object URL lands on the list. | | 133 | conditional-rules-header | steps[1], steps[7] | Date input is typed text in the locale format; the invoice form saves through `POST /api/v1/batch` (MasterDetailForm). steps[7] reads paid_on's absence on INV-1004 because steps[1]-[2] leave INV-1002 sent (the same parked note). | | 135 | encrypted-field-behavior | steps[1] | The field-zoo POST body carries the required `f_master_detail`; said for every POST of the item, so steps[4]'s fail-closed probe reads the crypto refusal, not a validation one. | | 137 | field-history-tracking | knownGaps[1] | The flag half is driven on a scratch object of the named shape (QA run objectstack-ai#33861 did); the code read is the fallback. | | 140 | form-view-gallery | steps[6] | The record page's Edit opens a `?form=ID` modal, so page routes are reached by URL; a deep-linked page form no longer leaves the document on save (`goBack` replaces to the record or list). | | 141, 219, 220 | gantt-interactions | steps[0], steps[1] | Switch to Month first (opens at Day on today); grab a bar near its top edge, off the progress handle. Row 219 left as it stands: under the objectstack-ai#33351 ruling the dependency half is blocked(fixture) by design, and a runtime overlay onto the notes textarea does not measure a real dependency field. | | 142 | grid-personalization | steps[1], steps[3] | Density is one cycling button; a runtime group-by lives in the URL (`uf__group`), not in the user's list preference, so a bare-URL reload drops it by design. | | 143, 224 | home-amount-preview-states | steps[2], fixtures.provisioning.why | The member's recipe invoice needs a line (admin POST) and a currency (member PATCH to USD) before the preview mounts. | | 144 | kanban-drag-persistence | steps[3] | The client lane gate stops an illegal drop before any request; reaching the server 400 needs a stale board. Both legs recorded. | | 146 | master-detail-atomic-save | steps[1] | Driver note: fill the trailing blank row; `Add line` beside it submits an all-null line that the batch refuses. | | 148, 149 | record-discussion-mentions | fixtures.requires[1], steps[0], steps[5], steps[13], knownGaps[3] | Off showcase_task (no discussion surface, no stream on its authored page) onto showcase_project's panel or showcase_account's stream; the interleave is read on the panel or on showcase_field_zoo's stream; the private note is created with its required `title`; changes_only is offered only on a synthesized page, which an authored panel never sits on (RecordDetailView `historyPage`). | | 150 | related-list-server-pagination | steps[1] | At 1440 px the top-level tab row draws over the columns; a role=tab strip there is expected. | | 151 | saved-view-management | steps[3] | Unsetting a packaged prior default goes through ensure-customization, then PUT `?package=com.example.showcase.custom`. | | 153 | setup-recycle-bin-page | steps[0] | Nav label is `Recycle Bin` (setup-nav.contributions.ts); the page title stays `Recycle bin`. | | 200 | named-import-mapping | acceptance[1] | States the precondition: idempotent with the request's `writeMode` unset; an explicit `writeMode` overrides the mapping's upsert by design (import-prepare.ts). | | 221, 222 | delete-toast-undo-restore | steps[0], negative[1] | Delete is under the header's More actions menu; the absence of Undo is observable as the `showcase_ops` member that `qa-fixture.mjs contributor-member --position showcase_ops` mints. | No row was already right at the base and no row moved to another carrier. ## Tests Docs-only ledger change; no test files touched, none forced. Gates on the final head are listed under Verification. ## Acceptance notes - **gantt-interactions, row 219:** answered without an edit; the seat read the objectstack-ai#33351 ruling as keeping the dependency half blocked(fixture), so QA run objectstack-ai#33914's overlay route is not written into the item. - **record-discussion-mentions, row 149.** At the base the panel offers `changes_only` only from `RecordFieldHistoryContext`, which RecordDetailView fills only for a synthesized page, and a `record:discussion` panel always sits on an authored page, so no fixture can open that leg. acceptance[7].verify still says the leg needs such a panel on a field-history object; it was left as is (it reads blocked(fixture) either way). Whether an unreachable FeedFilterMode value is a product gap is for the seat. - **conditional-rules-header steps[7]** was not a ledger row of its own; it is the same parked note as row 133 (INV-1002 is sent by then), so it rides the same edit. - Out of the ledger rows, not edited: related-list-server-pagination steps[1]'s last sentence ("only below 760 px is the page tabbed ... `?tab=related`") was not re-measured by any run; RecordPageColumns' `stack` tier docblock says no tabs. Noted for the next sweep. ## Verification Final-head gate run, every family `dispatch-gates --commands` derived, each with its exit captured before any pipe; `--ran` reconciliation: 16 derived, 16 run, 0 NOT-MEASURED, 0 UNRUN. `check:doc-formula-expressions` ran after building `@objectstack/formula` and `@objectstack/lint` under the verify lock (VERDICT command-exit 0). <details><summary>gates (patch-round head `e13f5b0c`; `a9ca4037` merges origin/main, file unchanged)</summary> ```text node scripts/check-adr-links.mjs :: exit 0 node scripts/check-adr-links.mjs --self-test :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:platform-checklist :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` `check:platform-checklist`: OK — 16 areas, 429 items (421 active, 3 planned); symbol anchors 1675/1685 resolved, 10 on the named residual. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSznyicZWEGxRp5gh5)_ <!-- signed: domain:devx#2 · os-steve · session_01ADHkmQTVjryTSkqydKVS6z --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Fixes #33213
Clause-②: yes (widening)
Metadata-protocol: none
Maintainer quick read
UNIQUE_VIOLATIONsentence is now composed by the engine in the writer's language from the platform operation-message catalog, and a composite unique index names its fields by label when that can be established.Accept-Language: zh-CNgot the English "A record with this value already exists" and could not tell which fields collided.code, 409 and the meaning offieldstay), only theerrortext moves; the English single-field and no-field sentences are byte-identical. Rollback is a revert of this PR.packages/objectql/src/duplicate-record-error.ts(declaredCompositeIndexandbuildEndUserMessage),packages/types/src/unique-violation.ts(newuniqueViolationColumns; the two existing functions answer as before),packages/spec/src/system/operation-message.ts(three new catalog keys).pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-duplicate-record-label-sentence.test.ts; expect all green, including the zh-CN composite case asserting已存在「工厂」、「牌号」、「成本周次」均相同的记录.What changes
DuplicateRecordError(@objectstack/objectql) now renders its end-user sentence from the platform operation-message catalog (renderOperationMessage, the catalogDELETE_RESTRICTEDalready renders from) in the write's message context, so a deployment'serrors.duplicate_record*translation overrides it. It is carried in-process asendUserMessage, and theDUPLICATE_RECORDarm ofclassifyDataError(@objectstack/types) ships it as the 409 body'serror. That arm holds neither a locale nor a schema, which is why it composed fixed English before.en,zh-CN,ja-JP,es-ES):duplicate_record(names nothing),duplicate_record_field({{field}}, one label),duplicate_record_fields({{fields}}, a list spelled by the locale's existingfield_label_quoted/field_label_list_separatorrules). The Englishduplicate_recordandduplicate_record_fieldare byte-identical to the fixed text the HTTP doors answered, so an English deployment reads no change for one field or none.uniqueViolationColumns(error)(new,@objectstack/types) reads the composite key's columns from the SQLite and Postgres texts the existing readers already parse, organization part set aside asuniqueViolationFieldsets it aside. The engine names them only when that set equals thefieldsof a unique index ('global'or'organization') the object declares, and the user's sentence names them only when every one has a label (translation, else declaredlabel). Anything short of that names nothing: driver text alone cannot tell atenancy.tenantFieldcolumn from an authored one, and a wrong field name is worse than none.uniqueViolationColumn/uniqueViolationFieldanswer exactly as before (the shared reader was generalised over a reduction, not changed).codestaysUNIQUE_VIOLATION, the status 409,fieldkeeps its single-column contract (absent for a composite), and no key is added. The composite's labels also enter the engine'smessage(relayed asdeveloperMessage) and its API names enter the in-processdeveloperMessage.userMessage: that name on a thrown error is the ApiError contract's producer-marked channel, whichwithDeclaredUserMessagepromotes to its own wire key. Whether this refusal joins that channel is a contract decision this fix does not make, so the property isendUserMessageand the wire is unchanged (pinned:not.toHaveProperty('userMessage')).Tests
Pins added (zh-CN and en, single-field and multi-field, plus the fallbacks):
packages/objectql/src/engine-duplicate-record-label-sentence.test.ts— new top-leveldescribein the existing harness, through the real write doors (insert,updateby id) and the realmapDataError: a declaredunique: 'organization'index overplant + carbon_grade + cost_weeknamed in en (A record with the same “Plant”, “Carbon Grade”, “Cost Week” already exists) and zh-CN (已存在「工厂」、「牌号」、「成本周次」均相同的记录), the Postgres DETAIL shape, an uncatalogued locale (de-DE) falling back to the en sentence, a deploymenterrors.duplicate_record_fieldsoverride; five controls that must name nothing (no matching declared index, a non-unique match, no indexes, one unlabelled field, a MySQL index-only refusal), each asserting the unnamed sentence in zh-CN and en; a single unlabelled field in zh-CN. The two existing zh-CN single-field pins now expect已存在相同客户名称的记录(they pinned the English sentence around a Chinese label — the reported defect).packages/rest/src/rest-duplicate-record-arm.test.ts— a realObjectQLon real better-sqlite3 with a declared'global'composite index: the exact 409 body in en and zh-CN, nofield, no value.packages/spec/src/system/operation-message.test.ts— the three keys in every locale with exactly their own placeholder, en byte-identity with the previous wire text, zh-CN / base-language / unknown-locale rendering, theerrors.override.packages/types/src/unique-violation.test.ts—uniqueViolationColumnson SQLite and Postgres composites, no overlap withuniqueViolationField, andundefinedfor index names, expression parts and a NOT NULL refusal.Runs (heads 330e619 and af12b05)
pnpm --filter @objectstack/types test— Test Files 39 passed (39), Tests 907 passed (907).pnpm --filter @objectstack/spec test— Test Files 839 passed, 1 skipped (840); Tests 26834 passed, 1 skipped, 1 todo.pnpm --filter @objectstack/objectql test— 594 passed, 1 failed:federated-injected-column-readers.test.tsflagged anorganization_idliteral the first cut used in the matcher. Fixed in af12b05 by comparing the declared index as written (no literal); re-run at af12b05: that file plus the three duplicate-record files, Test Files 4 passed (4), Tests 119 passed (119). The full objectql suite was not re-run at af12b05 (lock contention); CI runs it.pnpm --filter @objectstack/rest exec vitest runonrest-duplicate-record-arm,import-runner-unique-violation-row,import-row-report-field-20701,error-response-structured-arm-door-parity,error-response-generic-passthrough-object-parityat af12b05 — Test Files 5 passed (5), Tests 135 passed (135).pnpm --filter @objectstack/types typecheck,@objectstack/objectql typecheck,@objectstack/spec typecheck— exit 0 at 330e619 (the af12b05 objectql source change passed its tsup DTS build in the rest closure build).Ablation (one-shot, not kept)
node scripts/ablation-replace.mjs --file packages/objectql/src/duplicate-record-error.ts --anchor "this.endUserMessage = buildEndUserMessage(...);" --replacement "this.endUserMessage = '';"under the verify lock, runningengine-duplicate-record-label-sentence.test.ts(the subject resolves fromsrc, so no rebuild leg): mutation landed (anchor 1 -> 0, blob 55cc4074 -> be7c0e75), Tests 24 failed / 37 passed (61) — red, the expected direction; restored (blob == HEAD 55cc4074,git diff HEADempty).Acceptance notes
for key 'idx_…'), never columns; mapping a physical index name to a declared index is the wider schema-lookup contractuniqueViolationColumn's doc already defers. The sentence is still in the writer's locale there.organization_iditself (fields: ['organization_id', 'a', 'b']) matches nothing and gets the unnamed (localized) sentence: the declared side is compared as written. The spec already steers new code tounique: 'organization', which matches.unique: trueindex (refused at parse since protocol 18, converted on stored rows) is not treated as unique by the matcher. The existing real-driver pin inrest-duplicate-record-arm.test.ts§2 registers such an object straight into the registry and keeps its unnamed sentence for that reason; the new real-driver pin declares'global'.classifyDataError(a unique error that did not pass through the engine envelope) keeps its fixed English sentence: that module holds no locale. Every engine write door wraps first, so the reported path is the envelope.envelope without endUserMessagefallback in the arm keeps the previous sentence for an envelope built by an older engine; every envelope this engine builds carries the sentence.renderOperationMessagerefusal, this takes the oneExecutionContext.localevalue, so a request locale the catalog lacks readsen, not the workspace default (the limitationApiErrorSchema.userMessage"Language" already records for the operation refusals).Verification
node scripts/pm/dispatch-gates.mjs --commandsderived 87 families for this diff at af12b05; all 87 run, 80 exit 0. Seven exited 3 = PREREQUISITE NOT MET, read as NOT MEASURED (they read built output that predates the source or needs a deeper clone):check-plugin-teardown-shape --self-test(shallow clone), speccheck:api-surface,check:dual-source-exports,check:entry-nameability,check:exported-any(specdistpredates a test-file edit),check:dual-build-cjs-loads,check:type-check-debt(closure not built). CI runs all of them on a clean build.--ranreconciliation: 87 derived, 87 run, 0 unrun.grep -naPover the diff: no match).origin/mainhas since moved 21 commits, none touching a file of this diff (git merge-treeclean).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM