Repository navigation
spec(data): a shared NULL-distinct unique conformance case-set, scored by the driver census - #29509
objectstack-fleet[bot] wants to merge 5 commits into
Conversation
…d by the driver census UNIQUE_NULL_DISTINCT_CASES in packages/spec/src/data: two rows whose unique key holds a NULL in any key part both land, '' and equal values collide, on a field-level unique and a declared two-column unique index. Its test runs the table against a reference store and proves six wrong readings each fail it. The census registers the column with one tracked DEBT row per driver; no driver package changes. Claude-Session: https://claude.ai/code/session_01ADHkmR216nE71oPFuQMyRt Co-authored-by: Claude <noreply@anthropic.com>
…istinct case-set Claude-Session: https://claude.ai/code/session_01ADHkmR216nE71oPFuQMyRt Co-authored-by: Claude <noreply@anthropic.com>
…main Claude-Session: https://claude.ai/code/session_01ADHkmR216nE71oPFuQMyRt Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check18 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 168 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 376dda72d22d755f4ddbb994c643bac9f4154027 && git checkout 376dda72d22d755f4ddbb994c643bac9f4154027
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c88467d4adc417e668474e1b6198a5a7c503ac3f 0c0e86d0de94111c0c4951867e75a58ea58745fe && git checkout -B drift-repro c88467d4adc417e668474e1b6198a5a7c503ac3f && git merge --no-ff 0c0e86d0de94111c0c4951867e75a58ea58745fe
node scripts/docs-audit/affected-docs.mjs --json c88467d4adc417e668474e1b6198a5a7c503ac3f |
…tinct case-set Claude-Session: https://claude.ai/code/session_01ADHkmR216nE71oPFuQMyRt Co-authored-by: Claude <noreply@anthropic.com>
|
domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS Head-sha: 维护者速读
席位意见:用例集可落地;账本加行等决定。 席位核对 — ACCEPT ·
|
|
domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS Contract-review-claim: session_01ADHkmPi25XXKx92Xmg4viS · head 0c0e86d · 2026-11-02T17:10Z |
|
domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS Contract reviewServed-tier: Inputs: card #29377 (body, triage 6580288651, claim 6580621062, dev report 6583225788, claim amendment 6583274684, Decision-needed 6583288338), PR #29509 body and files, the net diff ① Derived judgmentsAccept-set and public-surface changes the diff makes, each judged:
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-support-ai · session_01WGufzhJG3tKnksHVa1krBz Superseded by #29808: the same commits through |
domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS
Requested by Steve · project thread
Fixes #29377
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
@objectstack/spec/data新增一套共享的一致性用例UNIQUE_NULL_DISTINCT_CASES(10 条):唯一键任一列为空(null或没写)的两条记录都能保存;''和相同的非空值照旧冲突;单列unique与两列联合唯一索引各有覆盖。驱动一致性普查把它登记为新的一列,6 个驱动各记一条 DEBT 待接入。uniqueis built as a sparse index, so two explicitnullvalues collide, unlike the NULL-distinct rule of driver-sql and driver-memory #29278,已由 fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339 修好),期间普查全绿,因为没有任何用例问这个问题。有了这套用例,下一个驱动或回归再把空值合并成同一个键,就会在普查里被记为未覆盖、在驱动接入后直接变红。packages/spec/src/data/unique-null-distinct-conformance.ts(用例与实测出处);scripts/check-driver-conformance.mjs新增的 6 条 DEBT;unique-null-distinct-conformance.test.ts的六种错误读法。node scripts/check-driver-conformance.mjs,预期矩阵多出UNIQUE_NULL_DISTINCT一列、6 格DEBT,结尾OK — 66 covered cell(s), 6 in the DEBT ledger。What changes
New case-set
packages/spec/src/data/unique-null-distinct-conformance.ts, besidevalue-roundtrip-conformance.tsandreadable-ids-conformance.ts, in their shape. Ten cases over two fixture objects:unique_null_single(field-levelunique: 'global'oncode) andunique_null_compound(declared index{ fields: ['region', 'tag'], unique: 'global' }).single_null_nullcode: nulltwicesingle_absent_absentcodeomitted twicesingle_null_absentnull, then omittedsingle_equal_valuesingle_empty_string''twicecompound_one_null(r1, null)twicecompound_leading_null(null, t2)twicecompound_one_absent(r3, omitted)twicecompound_equal(r4, t4)twicecompound_differs_in_one_part(r5, t5a),(r5, t5b)The consumption recipe is in the module docblock: sync both objects,
create()the first row (must be admitted),create()the second and recordrefusedonly whenisUniqueViolationError(@objectstack/types) recognises the error, count the rows labelled with the case, and hand both touniqueNullDistinctDivergence. The count is there because a driver can refuse a write and keep it. Every non-NULL key value belongs to one case, so a suite may run all ten on one synced pair of objects (pinned).Scope spelled
'global'on both surfaces. The scope ofunique(ADR-0120 D1, ADR-0131 D1) is a different axis and stays out of this table;'global'is the one spelling that means the same key on every driver with or without a tenant column. A baretrueon a declared index is refused since protocol 18, and the test parses both fixture objects throughObjectSchema.packages/spec/src/data/index.ts: theexport *line with its comment.Census registration in
scripts/check-driver-conformance.mjs: aCASE_SETSrow (file,marker: 'UNIQUE_NULL_DISTINCT_CASES',what), and oneLEDGERrow per driver (kind: 'DEBT',issue: '#29377'), each with its measured state inwhy. A history note aboveLEDGERrecords why the column opens with six rows (the FILTER_TEXT shape: the contract lands ahead of its suites) and how a row clears (the driver's PR adds the suite and deletes its row; RECONCILED reds a row kept beside a suite). No driver package is touched.Regenerated:
packages/spec/api-surface/data.json,packages/spec/export-origins/data.json(four added names each).Changeset
.changeset/29377-unique-null-distinct-conformance.md:@objectstack/specpatch.New public names
Under
@objectstack/spec(thedataentry), spelled like the sibling case-sets:UNIQUE_NULL_DISTINCT_CASESThe cases constant and the census marker (the census discovers
export const ..._CASES).UNIQUE_NULL_DISTINCT_OBJECTSThe two fixture objects, as
syncSchematakes them (cf.VALUE_ROUNDTRIP_FIELDS,READABLE_IDS_PARENT_OBJECT).UniqueNullDistinctCaseThe row type (cf.
ValueRoundTripCase,ReadableIdsCase).uniqueNullDistinctDivergenceThe shared judge,
(case, second, stored) => string | null(cf.valueRoundTripDivergence). A pure comparison over two observed values, no runtime logic.Why
PR #29339 (#29278) made driver-mongodb admit a second
nullin a unique field. Its old sparse index indexed an explicitnulllike a value. driver-sql and driver-memory already admitted it, and the census stayed green through the whole divergence because no case-set asked the question.value-roundtrip-conformance.tsdescribes the same gap for value storage: no case-set, no evidence.Tests
No existing test was edited. One new file,
packages/spec/src/data/unique-null-distinct-conformance.test.ts(23 tests):''is a value): each case alone, and all ten in order on one store.''treated as NULL (fails exactlysingle_empty_string), a compound keyed on its first column, a constraint never checked, and a refusal that keeps the row (both fail exactly the three refused rows).nullonly on the expected answer and the expected count.ObjectSchema.Acceptance notes
driver-memoryanddriver-sql(better-sqlite3) were run in-process over all ten cases onorigin/main@f95d0dba, judged byuniqueNullDistinctDivergenceandisUniqueViolationError: 10 of 10 agree on each (readings below).driver-mongodbwas not run against a server here: no mongod binary was reachable in this container (fastdl.mongodb.orgis blocked, and fetching the conda-forge build was refused). Its standing readings are PR fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339's real-mongod suite (mongod 8.3.7), which covers six of the ten rows:single_null_null,single_absent_absent,single_equal_value,single_empty_string,compound_one_null,compound_equal. The other four follow from the index shape that suite's server-free half pins (apartialFilterExpressionadmitting only non-NULL types on every key part). Its server-free half ran here:mongodb-unique-null-distinct.test.ts7 passed, 8 skipped (real-mongod, opt-in). The driver's adoption PR is the measurement for those four.nullbyupdate()was measured on driver-mongodb in fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339 only, so it is named as absent in the docblock rather than added without a measurement.syncSchemais a no-op (the remote service owns constraints). Its adoption card decides whether that cell is a suite or an EXEMPT row.⛔ MAINTAINER-ONLY. These six rows are what the card asks for (a case-set landing ahead of its drivers), so the maintainer's review of this PR is that agreement.Verification
Driver measurement, origin/main @ f95d0db (in-process, scratch script outside the tree)
Every first write was admitted on both drivers.
Local runs on head 95584d2 (main merged at 6af3d29)
All on
95584d2d, the final head, aftergit merge origin/main(main had moved both generated files) andcheck:generated --fix; heavy runs underos-verify-lock.sh, each VERDICTcommand-exit 0.turbo run build --filter='./packages/**'pnpm --filter @objectstack/spec testpnpm --filter @objectstack/spec typecheckpnpm --filter @objectstack/spec check:generated--fixrewrote api-surface/data.json and export-origins/data.json)node scripts/check-driver-conformance.mjsOK — 66 covered cell(s), 6 in the DEBT ledger, 0 exemptnode scripts/check-driver-conformance.mjs --self-testdispatch-gates --commands(101 families)--ran: 101 run, 0 NOT-MEASURED, 0 UNRUNcheck-changeset-no-major.mjs --base origin/main --event(this body, on0c0e86d0)Clause-②: yes (widening)·Metadata-protocol: none· level stayspatch(a non-protocol change)driver-mongodbmongodb-unique-null-distinct.test.ts--no-inline-configover the four touched source filesRound 2 (
0c0e86d0) changes only the changeset'sClause-②:line toyes (widening)(four new public exports widen the surface). On that head,check-adr-0087-registration,check-empty-changeset,check-changeset-no-major,check:changeset-gate-self-tests,check-closing-keyword-parityandcheck:doc-authoringeach exit 0. The rest of the set carries over from95584d2d, since no other byte moved.The same set was green on the pre-merge head
7f4de58d(spec test 792 files / 23492 tests, 101/101 gates).No ablation: the diff changes no behaviour a test pinned before. The new test proves the table is not vacuous with six wrong readings instead (see Tests).
Human Minimum
packages/specholds no runtime logic. (Test-support constants and a pure judge, as invalue-roundtrip-conformance.ts.)pnpm lintpasses. (eslint over the four touched source files locally; the repo-wide run is CI's.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code