Skip to content

spec(data): a shared NULL-distinct unique conformance case-set, scored by the driver census - #29509

Closed
objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/project-thread-ndw3ol
Closed

objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/project-thread-ndw3ol

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

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 待接入。
  • 为什么改:MongoDB 驱动曾把第二条空值记录拒掉(driver-mongodb: field unique is built as a sparse index, so two explicit null values 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 修好),期间普查全绿,因为没有任何用例问这个问题。有了这套用例,下一个驱动或回归再把空值合并成同一个键,就会在普查里被记为未覆盖、在驱动接入后直接变红。
  • 风险与回滚:只新增测试支撑导出,不改任何驱动、schema 或运行时行为。回滚 = revert 本 PR。新增 4 个公开名(见下文 New public names);普查账本多出 6 条 DEBT,脚本把扩账本标为维护者专属。
  • 先看: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, beside value-roundtrip-conformance.ts and readable-ids-conformance.ts, in their shape. Ten cases over two fixture objects: unique_null_single (field-level unique: 'global' on code) and unique_null_compound (declared index { fields: ['region', 'tag'], unique: 'global' }).

    case rows second write
    single_null_null code: null twice admitted
    single_absent_absent code omitted twice admitted
    single_null_absent null, then omitted admitted
    single_equal_value the same string twice refused
    single_empty_string '' twice refused
    compound_one_null (r1, null) twice admitted
    compound_leading_null (null, t2) twice admitted
    compound_one_absent (r3, omitted) twice admitted
    compound_equal (r4, t4) twice refused
    compound_differs_in_one_part (r5, t5a), (r5, t5b) admitted

    The consumption recipe is in the module docblock: sync both objects, create() the first row (must be admitted), create() the second and record refused only when isUniqueViolationError (@objectstack/types) recognises the error, count the rows labelled with the case, and hand both to uniqueNullDistinctDivergence. 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 of unique (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 bare true on a declared index is refused since protocol 18, and the test parses both fixture objects through ObjectSchema.

  • packages/spec/src/data/index.ts: the export * line with its comment.

  • Census registration in scripts/check-driver-conformance.mjs: a CASE_SETS row (file, marker: 'UNIQUE_NULL_DISTINCT_CASES', what), and one LEDGER row per driver (kind: 'DEBT', issue: '#29377'), each with its measured state in why. A history note above LEDGER records 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/spec patch.

New public names

Under @objectstack/spec (the data entry), spelled like the sibling case-sets:

UNIQUE_NULL_DISTINCT_CASES

The cases constant and the census marker (the census discovers export const ..._CASES).

UNIQUE_NULL_DISTINCT_OBJECTS

The two fixture objects, as syncSchema takes them (cf. VALUE_ROUNDTRIP_FIELDS, READABLE_IDS_PARENT_OBJECT).

UniqueNullDistinctCase

The row type (cf. ValueRoundTripCase, ReadableIdsCase).

uniqueNullDistinctDivergence

The 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 null in a unique field. Its old sparse index indexed an explicit null like 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.ts describes 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):

  • The table, executed against a reference store written from the declared rule (a NULL in any key part exempts the row; '' is a value): each case alone, and all ten in order on one store.
  • Not vacuous: six wrong readings each fail the table. They are a sparse index (null indexed), null and absent folded onto one value, '' treated as NULL (fails exactly single_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).
  • The judge: null only on the expected answer and the expected count.
  • Well-formed: unique names, rows labelled, non-NULL key values owned by one case, both answers on both objects, both objects accepted by ObjectSchema.

Acceptance notes

  • The compound row was measured before it was written. The three drivers agree. driver-memory and driver-sql (better-sqlite3) were run in-process over all ten cases on origin/main @ f95d0dba, judged by uniqueNullDistinctDivergence and isUniqueViolationError: 10 of 10 agree on each (readings below). driver-mongodb was not run against a server here: no mongod binary was reachable in this container (fastdl.mongodb.org is 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 (a partialFilterExpression admitting only non-NULL types on every key part). Its server-free half ran here: mongodb-unique-null-distinct.test.ts 7 passed, 8 skipped (real-mongod, opt-in). The driver's adoption PR is the measurement for those four.
  • The update door is out of the table. Clearing a unique field to null by update() 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.
  • driver-odata gets a DEBT row like the others, but its syncSchema is a no-op (the remote service owns constraints). Its adoption card decides whether that cell is a suite or an EXEMPT row.
  • The census's own CONSUMED message marks a ledger entry ⛔ 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)
memory   single_null_null               second=admitted stored=2 agrees
memory   single_absent_absent           second=admitted stored=2 agrees
memory   single_null_absent             second=admitted stored=2 agrees
memory   single_equal_value             second=refused  stored=1 agrees  UNIQUE_VIOLATION
memory   single_empty_string            second=refused  stored=1 agrees  UNIQUE_VIOLATION
memory   compound_one_null              second=admitted stored=2 agrees
memory   compound_leading_null          second=admitted stored=2 agrees
memory   compound_one_absent            second=admitted stored=2 agrees
memory   compound_equal                 second=refused  stored=1 agrees  UNIQUE_VIOLATION
memory   compound_differs_in_one_part   second=admitted stored=2 agrees
memory divergent cases: 0
sql      (same ten rows, same answers; each refusal SQLITE_CONSTRAINT_UNIQUE)
sql divergent cases: 0

Every first write was admitted on both drivers.

Local runs on head 95584d2 (main merged at 6af3d29)

All on 95584d2d, the final head, after git merge origin/main (main had moved both generated files) and check:generated --fix; heavy runs under os-verify-lock.sh, each VERDICT command-exit 0.

run reading
turbo run build --filter='./packages/**' exit 0
pnpm --filter @objectstack/spec test Test Files 793 passed (793) · Tests 23542 passed, 1 todo
pnpm --filter @objectstack/spec typecheck exit 0
pnpm --filter @objectstack/spec check:generated 14 of 14 current (after --fix rewrote api-surface/data.json and export-origins/data.json)
node scripts/check-driver-conformance.mjs OK — 66 covered cell(s), 6 in the DEBT ledger, 0 exempt
node scripts/check-driver-conformance.mjs --self-test OK
dispatch-gates --commands (101 families) 101 exit 0; --ran: 101 run, 0 NOT-MEASURED, 0 UNRUN
check-changeset-no-major.mjs --base origin/main --event (this body, on 0c0e86d0) exit 0 · Clause-②: yes (widening) · Metadata-protocol: none · level stays patch (a non-protocol change)
driver-mongodb mongodb-unique-null-distinct.test.ts 7 passed, 8 skipped (real-mongod, opt-in)
eslint --no-inline-config over the four touched source files exit 0

Round 2 (0c0e86d0) changes only the changeset's Clause-②: line to yes (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-parity and check:doc-authoring each exit 0. The rest of the set carries over from 95584d2d, 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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Test-support constants and a pure judge, as in value-roundtrip-conformance.ts.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint over the four touched source files locally; the repo-wide run is CI's.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…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>
@github-actions github-actions Bot added the size/l label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

18 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/src/data/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/src/data/index.ts) — pages documenting those are invisible to this run
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 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 — 168 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 c88467d4adc417e668474e1b6198a5a7c503ac3f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 376dda72d22d755f4ddbb994c643bac9f4154027 — the merge of head 0c0e86d0de94111c0c4951867e75a58ea58745fe into base c88467d4adc417e668474e1b6198a5a7c503ac3f, 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 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

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

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS

Head-sha: 0c0e86d0 · read 2026-11-02T17:09Z

维护者速读

席位意见:用例集可落地;账本加行等决定。

席位核对 — ACCEPT · domain:spec#1 · head 0c0e86d0

  1. Shape: draft, base main (main 6af3d295 merged in), Fixes #29377, Clause-②: yes (widening) / Metadata-protocol: none in the changeset (round 2). The body is patched to match. Spec patch; the offline level gate reads a non-protocol change at patch. 7 files, +594/-6. Not governed.

  2. Surface: inside the claim as amended. It covers:

    No driver package is touched.

  3. Measurement: the compound row was measured before it was written. memory and sql agree 10/10 on main. mongodb agrees on the six rows PR fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339 ran on a real mongod; this container refuses the mongod download, so those readings are cited, not re-run. No disagreement, so no ruling is needed on rows.

  4. Open questions, the seat's answers:

  5. Readings (dev):

    • On 95584d2d: 101/101 derived gates, DERIVED zero; spec 793 files / 23542 tests; typecheck; check:generated 14/14; census OK (66 covered, 6 DEBT).
    • On 0c0e86d0, which changes only the changeset's Clause-② line: the changeset, ADR-0087, closing-keyword and doc-authoring gates.
  6. Landing: a new export under packages/spec/src, so one CONTRACT_REVIEW_TIER review by the seat (claim line follows). The seat lands after a PASS and the ledger ruling.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS

Contract-review-claim: session_01ADHkmPi25XXKx92Xmg4viS · head 0c0e86d · 2026-11-02T17:10Z

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#1 · os-steve · session_01ADHkmPi25XXKx92Xmg4viS

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0c0e86d0de94111c0c4951867e75a58ea58745fe
Local-runs: none
Scope: packages/spec/src/data/index.ts, packages/spec/src/data/unique-null-distinct-conformance.ts + packages/spec/src/data/unique-null-distinct-conformance.test.ts, scripts/check-driver-conformance.mjs, .changeset/29377-unique-null-distinct-conformance.md, packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/src/data/value-roundtrip-conformance.ts, packages/spec/src/data/readable-ids-conformance.ts, packages/spec/src/data/field.zod.ts, packages/spec/src/data/object.zod.ts, packages/types/src/unique-violation.ts, packages/drivers/driver-memory/src/memory-unique-constraint.ts, packages/drivers/driver-memory/src/memory-driver.ts, packages/drivers/driver-sql/src/schema-drift.ts, packages/drivers/driver-sql/src/sql-driver-schema-sync.ts, packages/drivers/driver-sql/src/sql-driver.ts, packages/drivers/driver-mongodb/src/mongodb-schema.ts, packages/drivers/driver-mongodb/src/mongodb-driver.ts, packages/drivers/driver-mongodb/src/mongodb-unique-null-distinct.test.ts, packages/drivers/driver-odata/src/odata-driver.ts

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 origin/main...0c0e86d0 (7 files, +594/−6, merge-base 6af3d295), the head's check-runs, and the cited code on origin/main @ c88467d4. Read-only: no worktree, build, test or gate was run; the seat's conclusions were not an input to any judgment below.

① Derived judgments

Accept-set and public-surface changes the diff makes, each judged:

  1. Four new exports under @objectstack/spec (data entry): UNIQUE_NULL_DISTINCT_CASES, UNIQUE_NULL_DISTINCT_OBJECTS, UniqueNullDistinctCase, uniqueNullDistinctDivergence — correct. export * added to data/index.ts between value-roundtrip-conformance and date-macros.zod, with a comment in the siblings' shape; api-surface/data.json and export-origins/data.json each gain exactly those four names and nothing else. No collision: git grep on origin/main for the four names and for unique-null-distinct finds only the driver-mongodb test file's path. UniqueScope/UniqueScopeSchema are different names. Spelling mirrors VALUE_ROUNDTRIP_CASES / VALUE_ROUNDTRIP_FIELDS / ValueRoundTripCase / valueRoundTripDivergence role for role.
  2. Every case row is a measured value or a control — holds against the drivers' code as it reads on main.
    • driver-memory: uniqueKeyOf returns null (exempt) when any non-null-safe key part is null OR undefined; a declared index with unique: 'global' becomes columns verbatim with nullSafeColumns: []; a field-level unique: 'global' becomes scopeField: null, whose constant platform part folds but the field part exempts. toStoredRecord strips undefined own keys and fills no defaults, so an absent code/tag stays absent. All ten rows follow: single_* admitted/refused as tabled, compound_one_null, compound_leading_null, compound_one_absent admitted, compound_equal refused, compound_differs_in_one_part admitted. The refusal carries code: 'UNIQUE_VIOLATION', which isUniqueViolationError reads on the codes channel.
    • driver-sql: uniqueIndexesFromFields keeps unique: 'global' single-column; normalizeDeclaredIndex keeps unique: 'global' listed verbatim with no nullSafeColumns, and syncDeclaredIndexes then emits table.unique(columns) — a plain SQL UNIQUE, NULL-distinct on SQLite, Postgres (default NULLS DISTINCT) and MySQL. An omitted column inserts NULL. indexedKeyColumns includes both the field-level and the declared-index columns, so the three text columns are sized by keyableTextLength (VARCHAR) and are keyable on MySQL — the fixture will not trip explainUnkeyableTextColumn when the suite runs the dialect matrix. Refusals: SQLITE_CONSTRAINT_UNIQUE / 23505 / ER_DUP_ENTRY are all in the predicate.
    • driver-mongodb: since fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339 both if (field.unique) and Boolean(idx.unique) route through nullDistinctUniqueOps, a partialFilterExpression of $type: NON_NULL_BSON_TYPES on EVERY key part; create() strips undefined own keys, so an absent part is a missing field and an explicit null is BSON null — both outside the index. So compound_one_null, compound_leading_null, compound_one_absent are admitted by the index shape, not by luck. The E11000 refusal is recognised by isUniqueViolationError on the message channel (duplicate key), not by code 11000 — the docblock's "the one place that recognises all of them" holds, by that channel.
    • "Absent behaves as null" is right on all three (memory undefined, SQL NULL, Mongo missing field) and '' is a value on all three (memory JSON-encodes "", SQL compares it, Mongo indexes a string).
    • The compound row is true for memory, sql and mongodb as the code reads today. Note (not a defect): 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 declared its index as bare unique: true and its field as unique: true; the case-set spells 'global'. mongodb-schema.ts materialises both spellings identically, so the six cited readings transfer; the docblock could say so in one clause. Second wording nit: the docblock says the composite "UNIQUE (region, tag) was measured on SQLite in driver-memory enforces field-level unique but not object-level declared indexes[] — a composite unique is a real constraint on driver-sql and nothing at all in memory #13239" — the driver-memory enforces field-level unique but not object-level declared indexes[] — a composite unique is a real constraint on driver-sql and nothing at all in memory #13239 measurement quoted in memory-unique-constraint.ts is UNIQUE (account_id, code), the same shape under other column names.
  3. The cases are expressible by a driver suite without guessing. Object shapes are complete syncSchema inputs; ObjectSchema.safeParse accepts both (the test pins it; label is auto-generated by the schema). The unique declaration is stated on both surfaces, both 'global', so the bare-true inversion between field and declared index (ADR-0120 D1, memory-unique-constraint.ts) cannot bite, and 'global' needs no tenant column on any driver. The refusal shape is delegated to isUniqueViolationError from @objectstack/types, the predicate every driver's refusal already satisfies; the recipe says a non-recognised error is a failure of the case, not a refusal. Every non-NULL key value is unique to one case (und-* prefixes; pinned by the test), so one synced pair of objects serves all ten.
  4. uniqueNullDistinctDivergence judges correctly, and a wrong driver cannot pass it. It requires BOTH the second write's answer AND the stored count (2 for admitted, 1 for refused). The judge does not take the first write's outcome, but a refused first write leaves the count at 0 or 1 against the expectation in every row, so it cannot pass silently; the recipe also states step 1 must be admitted. The six wrong readings in the test each fail at least one row (sparse index → the three two-nulls rows; null/absent fold → the three absent rows; '' as NULL → exactly single_empty_string; first-column compound → compound_differs_in_one_part; not enforced and refuse-and-keep → exactly the three refused rows). Coverage gap, not a must-fix: there is no compound_empty_string row, so a driver that folds '' onto NULL only on multi-column keys is not caught; the card does not ask for it and no driver was measured to do it — a follow-up row for an adoption card.
  5. Census registration is right. discoverCaseSets matches ^export const ([A-Z0-9_]*_CASES)\b in *-conformance.ts: it finds UNIQUE_NULL_DISTINCT_CASES and only that (_OBJECTS does not match), and the new CASE_SETS row names it, so CLASSIFIED holds in both directions. coveringFiles scores a cell covered when a file under the driver's src/ imports that marker from @objectstack/spec/data in one statement and references it outside the import (comments masked) — a suite that imports the marker will be seen. The six LEDGER rows carry driver, marker, kind: 'DEBT', why, issue, the fields audit() and the summary printer read; every driver is a real packages/drivers/driver-* package (memory, mongodb, odata, sql, sqlite-wasm, turso — the whole discovered axis), so RECONCILED holds. No self-test pins LEDGER.length; the diff does not touch the self-test.
  6. The six DEBT rows are measured and honest. memory and sql rows cite 10/10 in-process on f95d0dba; mongodb cites the six real-mongod rows of fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339 and names the server-free half its suite still owes (driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517); odata, sqlite-wasm and turso say "Not measured" and say why. Each row says the SUITE is what is missing, which is what CONSUMED measures. The ledger history note is the FILTER_TEXT shape and says so.
  7. odata DEBT rather than EXEMPT is right for this PR. ODataDriver.syncSchema is a no-op, and the existing odata conformance suite runs the case-sets over an in-process fake service (READABLE_IDS as a loud refusal, VALUE_ROUNDTRIP via create/find). Nothing about this driver's handling of a NULL unique key has been measured, and the census header says EXEMPT is a measured claim, not a default. The card's "then the rest" puts odata adoption in the drivers' lane, where the suite or an EXEMPT row is decided on a measurement.
  8. Docblock honesty. It states which rows were run on which driver, which four mongodb rows are derived from the index shape and not run, that the update door and the scope axis are deliberately absent, and that the drivers' suites are the measurement for the rest. It does not advertise adoption that has not happened; the test file's header says the table executes against a reference store because no driver runs it yet.
  9. Test. Vitest-only imports, relative ./object.zod and ./unique-null-distinct-conformance (no cross-package reads, nothing for check:cross-package-test-inputs). Types: UNIQUE_NULL_DISTINCT_OBJECTS.unique_null_compound.indexes[0].fields is readonly ['region','tag'] under as const, assignable to readonly string[]. Nit: KEY_PARTS.unique_null_single is hand-written ['code'] while the compound half is derived from the fixture.
  10. No runtime logic enters packages/spec. Constants, an interface, a pure comparison of (case, second, stored) answering a string or null — the valueRoundTripDivergence shape.

② Semver level

@objectstack/spec: patch. Changeset .changeset/29377-unique-null-distinct-conformance.md and the PR body (round 2) both declare Clause-②: yes (widening) and Metadata-protocol: none, and the two agree with the card's claim amendment 6583274684. Four new exports under a published exports entry widen the public surface, so yes (widening) is the right value (the card's original Clause-②: no was the seat's own claim line, corrected before review); no authorable key, value or type changes, so none is right; AGENTS.md Post-Task Checklist step 3 grades a non-protocol widening patch, and check-changeset-no-major pins yes (widening) beside none as patch. No ADR-0087 disposition is owed (nothing retired, nothing narrowed). Level, declarations and body are consistent.

③ Boundary flags

  • Dev open question 1 (four public names): answered — accept as spelled. No collision on main; each name mirrors a sibling's role; the census only discovers *_CASES, so the marker name is forced.
  • Dev open question 2 / seat's "Decision needed" (six DEBT rows, options A/B/C): the maintainer's call. Landability per option, judged on the tree:
    • A — accept the six rows: landable on this head as reviewed; this record is the Clause-② PASS. Each adoption PR deletes its row with its suite (RECONCILED reds a row kept beside a suite).
    • B — enrol sql, memory and mongodb in this PR: not landable on this head; it is a new head with driver-package files outside the claim's file surface, and this record would not cover it. Two mechanical consequences the option carries: the mongodb suite needs a server-free half (its real-mongod suites are opt-in since driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517, so an opt-in-only suite is honest about less than its green says), and the driver-sql suite must be routed through DIALECT_CELLS or the census reds MATRIXED on that cell.
    • C — land the case-set without registering it: not landable as phrased. CLASSIFIED's reverse direction reds any *-conformance.ts under spec/src/data that exports a *_CASES const not named in CASE_SETS, so deleting the CASE_SETS row and the six LEDGER rows turns check:driver-conformance red on this file. C requires renaming the file off the -conformance.ts suffix (leaving the house pattern and the card's "Done when" rows 1 and 2) or changing the census; neither is in the card.
  • Dev open question 3 (odata DEBT vs EXEMPT): answered — DEBT, see ① item 7.
  • Dev deviation — driver-mongodb not measured live: disclosed in the docblock, the ledger row and the PR body; four rows are derived from the pinned index shape and declared derived. Honest, not a must-fix.
  • Ledger growth is marked ⛔ MAINTAINER-ONLY by the census itself: this PR's rows are what the card asks for, and the Decision-needed comment puts the question to the maintainer; this record does not stand in for that agreement.
  • Check-runs on this head, read 2026-11-02T17:17Z: completed and green — Governed Surface Queue Guard, Spec property liveness, PR-body guards, Check PR Size, Auto Label, Flag docs affected, Dogfood Regression Gate, Plan Test Core shards, Lint · ESLint, Lint · scoped · query-options erasure, Type Check · source gates, Check Changeset (one attempt cancelled by a re-run, the re-run green); none red; still in_progress — the other Lint lanes, Type Check · workspace / consumer gates / debt ledger, Build Core, Test Core 1–8 of 8, Build UI Deps, Live E2E UI. The verdict below is on the tree; landing still waits for the required ten contexts to conclude success (an in_progress is not a pass).
  • Author: objectstack-fleet[bot] via the relay; no off-relay login to name.

④ Design judgment

  • packages/spec/src/data/unique-null-distinct-conformance.ts against the card's "Done when" and the drivers it cites: the four required rows are present (two nulls both insert; absent behaves as null; equal non-null values collide with the driver's own refusal; compound key with one NULL member does not collide), the compound row was measured on two drivers and read off the third's pinned index shape before being written, and the controls ('', equal compound, differs-in-one-part) are what make a non-enforcing or first-column-keyed driver fail. One axis (which NULLs a unique key admits), as every sibling table keeps one axis; the scope axis and the update door are named out with reasons. The judge is shared for the reason valueRoundTripDivergence is. Holds.
  • packages/spec/src/data/index.ts against the barrel's convention: one export * with a provenance comment, placed with the other conformance tables. Holds.
  • scripts/check-driver-conformance.mjs (read as the gate that enforces the rule the case-set states): the row and the six entries are the FILTER_TEXT shape, each entry measured or marked unmeasured, with the clearing rule written where the next author reads it. Holds.
  • Non-blocking follow-ups for the adoption cards, not this PR: a compound_empty_string row once a driver is measured for it; the update door once memory and sql are measured; one clause noting that fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory #29339's readings were taken under bare true, which mongodb materialises as 'global'.

Implemented-by: claude/project-thread-ndw3ol
Reviewed-by: session_01ADHkmPi25XXKx92Xmg4viS

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-support-ai · session_01WGufzhJG3tKnksHVa1krBz

Superseded by #29808: the same commits through 0c0e86d0, resumed on the card thread branch claude/project-thread-polo9l (claim 6595859623 on #29377, ruling A 6595804527) and merged with origin/main. Closing this draft so #29377 has one open closing PR (PR-body guards). Contract review 6583589505 stays here as the history of head 0c0e86d0.

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 protocol:data size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant