Skip to content

fix(driver-mongodb): two records with a null unique field are both admitted, as on driver-sql and driver-memory - #29339

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-rmcblv
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-rmcblv

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #29278

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:MongoDB 驱动的唯一索引不再把 null 当成一个值:两条唯一字段为空(null 或缺失)的记录都能保存,和 SQL、内存驱动一致;真正的重复值(含 '')照旧报 E11000。
  • 为什么改:旧索引是 sparse,只跳过“没有这个字段”的文档,显式 null 仍进索引,所以第二条清空唯一字段的记录被拒。已用真实 mongod 8.3.7 在主干上复现。
  • 风险与回滚:已部署的集合在下次 schema 同步时会把旧的 sparse 唯一索引删掉并按新形态重建(新索引约束更少,必然建成功);中间有毫秒级无唯一约束窗口,若期间写入重复值则同步失败并报错,不会静默。每个唯一索引多一个普通读索引,写入成本略增。回滚 = revert 本 PR(按源码推断、未实测:旧代码遇到同名的新形索引会在同步时报 86,需先手工删掉该索引)。
  • 先看:packages/drivers/driver-mongodb/src/mongodb-schema.ts 的 nullDistinctUniqueOps 与 rebuildLegacySparseUnique;src/mongodb-unique-null-distinct.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/driver-mongodb exec vitest run src/mongodb-unique-null-distinct.test.ts,默认 7 个 DDL 测试绿、8 个真实 mongod 测试跳过;加 OS_TEST_MONGODB_MEMORY_SERVER_ENABLED=1 且能拿到 mongod 时 15 个全绿(主干上 8 红)。
  • 需要你做的:无,席位落地。

What changes

  • The unique index is NULL-distinct. syncCollectionSchema built a field-level unique and a declared indexes[] entry carrying unique as { unique: true, sparse: true }. Both are now { unique: true, partialFilterExpression: { FIELD: { $type: [every non-null BSON type] } } }, one entry per key part, with no sparse (MongoDB refuses sparse beside a partial filter). A document with a null or missing value in any key part is not constrained; every other value is constrained exactly as before.
    • Why a type list: MongoDB refuses $ne / $not inside a partial filter ({ $exists: true, $ne: null } → CannotCreateIndex, code 67, measured).
    • Why the full list and not the field's declared type: a stored value of an unexpected type stays constrained, as under the sparse index.
  • A plain read index beside each unique index. The planner cannot use a partial index for an equality lookup (measured: find({ code: 'X' }) → COLLSCAN on the partial index, EXPRESS_IXSCAN on the old sparse one; a single $type: 'string' filter is not used either). So each unique index also gets idx_FIELDS, a plain index over the same keys (the name a declared plain index over those columns already gets, so they converge). A plain index already present under another name (a lookup's idx_FIELD_lookup) answers IndexOptionsConflict (85), which the loop already skips. An author-named unique index that already takes the idx_FIELDS name gets no read index.
  • Declared indexes[] unique entries are in this fix, not left on the old shape. A single-column declaration and a field-level unique converge on one index name (idx_FIELD_unique, pinned in mongodb-schema-declared-indexes.test.ts); leaving the declared route sparse would ask for one name with two option sets. Multi-column: a null in ANY key part exempts the row, the rule memory-unique-constraint.ts states for driver-sql and driver-memory.
  • Existing sparse indexes on deployed collections are rebuilt at the next schema sync (measured). Asking for the new options under the old name is answered IndexKeySpecsConflict (86) on 8.3.7, and collMod cannot change sparse / partialFilterExpression. On that conflict the loop reads the collection's indexes; when the same-name index is exactly the legacy shape this driver built (unique: true, sparse: true, same keys in the same order, no partial filter) it is dropped and created again under its own name. Measured on a real server: a collection seeded with the legacy index, a null row and an 'X' row refuses a second null (E11000) before the sync; after syncSchema the index carries the partial filter and no sparse, a second null is admitted, a second 'X' is still refused, and a second sync is a no-op.
    • The rebuild always succeeds on existing data: the new index constrains a subset of what the old one did.
    • Between the drop and the create there is a moment with no unique index; a non-null duplicate written in that moment makes the create fail E11000, which is thrown (the sync fails loudly, the field is not left unconstrained). The read index is created first, so lookups stay indexed. A concurrent sync's drop of an already-dropped index (IndexNotFound, 27) is ignored.
    • Any other same-name index (an option this driver never wrote, or other keys) is left alone and answers as before: 85 skipped, 86 thrown.
  • What the driver writes is unchanged. Not changed: driver-sql, driver-memory, packages/spec, any error code. A non-null duplicate is refused with the server's own E11000 duplicate key error (code 11000), as before.

Tests

No existing test was edited. One new file, packages/drivers/driver-mongodb/src/mongodb-unique-null-distinct.test.ts, two suites:

  • Recording fake Db (7 tests, runs on every lane): the field-level index options (partial filter, no sparse); the read index created before the unique one; the declared two-column filter over both parts; the author-named collision; the legacy rebuild sequence createIndex → dropIndex → createIndex; and two controls where a same-name index the driver did not build (extra collation; other keys) is not dropped and the 86 still throws.
  • Real mongod (8 tests, opt-in OS_TEST_MONGODB_MEMORY_SERVER_ENABLED=1, driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517): two null creates admitted; two updates clearing to null admitted; two missing admitted; a non-null duplicate refused 11000 with message starting E11000 duplicate key error; two '' refused; declared (region, tag): (eu, null) twice admitted, (eu, t) twice refused; a lookup by the unique field is not a COLLSCAN; the legacy-index migration.
Red on main, green on head (real mongod 8.3.7)

mongodb-schema.ts restored to 276ca307 in the tree only, the new file run, then restored to HEAD (git diff HEAD empty, status clean). The suites import src/ directly (no dist/ in the path).

Reading Result
Base 276ca307 Tests 8 failed, 7 passed (15). admits two records whose unique field is null: expected 11000 to be 'ok'; the migration test: expected true to be undefined (sparse still set). The 7 that pass on base are the ones that must: missing ×2 admitted, non-null and '' duplicates refused, the lookup index, the author-named case, the two leave-alone controls.
Head 84fb196d Tests 15 passed (15), no suite skipped

Premise probe on base, raw client against the same server ({ f: 1 } index): sparse unique: two null → second E11000; two missing → both ok; two '', two 'x', 1 and 1.0, two equal dates, two true → second E11000. The partial index answers the same row for every case except two null (both ok).

Ablations of the negative pins

Each mutation was made with scripts/ablation-replace.mjs (anchor 1 → 0, blob changed, then restored with blob equal to HEAD and git diff HEAD empty). No build leg: the suite reads src/.

Ablation Red
A1: the unique index built unique: false 6 failed / 15, incl. still refuses a non-null duplicate: expected undefined to be 11000, '' refused, (eu, t) refused, the migration's 'X' refusal
A2: any same-name index read as the legacy shape 2 failed / 15: both leave-alone controls
A3: no read index 3 failed / 15, incl. serves a lookup … not a collection scan: expected '{"isCached":false,"stage":"COLLSCAN",…' not to contain 'COLLSCAN'

Acceptance notes

  • The same case on all three drivers, measured (head 84fb196d, built dist, each driver's own syncSchema + create, field code unique: 'global', declared (region, tag) unique):

    case memory sql (SQLite) mongo
    code null ×2 ok, ok ok, ok ok, ok
    code missing ×2 ok, ok ok, ok ok, ok
    code '' ×2 ok, refused ok, refused ok, refused
    code 'X' ×2 ok, refused ok, refused ok, refused
    (eu, null) ×2 ok, ok ok, ok ok, ok
    (eu, t) ×2 ok, refused ok, refused ok, refused

    On base, mongo answered ok, refused for both null rows.

  • No shared conformance case-set was added. The case-sets live in packages/spec/src/data/*-conformance.ts, which this lane does not edit. The table above is the cross-driver reading; a shared unique case-set is an open question for the spec seat. check:driver-conformance: 66 covered, 0 DEBT, 0 exempt, on base and head (unchanged, as expected with no new case-set).

  • The real-server suite runs on no CI lane (opt-in since driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517). The 7 DDL tests are the ones CI runs. This PR's real-server readings were taken with a MongoDB 8.3.7 mongod from conda-forge (mongodb-8.3.7-hc064ac0_0.conda, sha256 matching conda-forge's index) supplied to mongodb-memory-server through MONGOMS_SYSTEM_BINARY, because fastdl.mongodb.org is refused in the card container.

  • Write cost. Each unique index now has a plain read index beside it, so a write to a unique field updates two indexes instead of one.

  • '' still collides, as on driver-sql and driver-memory: '' is a value. PR fix(objectql): a cleared optional unique text field stores null, so the second record cleared is no longer refused 409 UNIQUE_VIOLATION (#29176) #29271 (open) makes the engine store a cleared optional unique text field as null; with this PR, Mongo admits those too.

Verification

Suites, typecheck, lint, gates
Run Head Result
pnpm --filter @objectstack/driver-mongodb test with the real mongod 84fb196d Test Files 38 passed (38) · Tests 911 passed (911), no skip
the same, default lane (no opt-in) 84fb196d Test Files 33 passed, 5 skipped (38) · Tests 721 passed, 190 skipped (911)
pnpm --filter @objectstack/driver-mongodb typecheck e38ab227 exit 0; check:test-typecheck 0 debt
pnpm exec eslint --no-inline-config packages/drivers/driver-mongodb e38ab227 exit 0
turbo run build --filter='./packages/**' (gate prerequisite) e38ab227 VERDICT command-exit 0
dispatch-gates.mjs --commands (60 families), each run e38ab227 60 × exit 0; --ran: 60 derived, 60 run, 0 NOT-MEASURED, 0 UNRUN

One family first exited 3 (prerequisite, nothing measured): check-plugin-teardown-shape --self-test needed its pinned fixture commit fetched; after git fetch --depth=1 origin 621a4876… it exited 0. origin/main moved 27 commits past the base 276ca307 while this ran; none touch packages/drivers or packages/spec/src/data, so the branch was not merged.

Not run locally: the full dogfood battery (no ! in the title, no (narrowing) arm).


Generated by Claude Code

…er-sql and driver-memory

The field-level and declared unique indexes were built
{ unique: true, sparse: true }; a sparse index still indexes an explicit
null, so two records with a cleared unique field collided. They are now
partial over every non-null BSON type, with a plain read index over the
same keys, and a legacy sparse unique index is rebuilt at schema sync.

Claude-Session: https://claude.ai/code/session_01ADHkmRc2jLWPKqPfVHStXw
Co-authored-by: Claude <noreply@anthropic.com>
@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 Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

11 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 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 — 7 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 2f7977cd2f25d878f31942dae6e229af9ff316d3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 4016a895adfcbd052f2866c70eeb470cd744403d — the merge of head e38ab2275eac32187c122276ad6652f69840a199 into base 2f7977cd2f25d878f31942dae6e229af9ff316d3, 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 4016a895adfcbd052f2866c70eeb470cd744403d && git checkout 4016a895adfcbd052f2866c70eeb470cd744403d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2f7977cd2f25d878f31942dae6e229af9ff316d3 e38ab2275eac32187c122276ad6652f69840a199 && git checkout -B drift-repro 2f7977cd2f25d878f31942dae6e229af9ff316d3 && git merge --no-ff e38ab2275eac32187c122276ad6652f69840a199

node scripts/docs-audit/affected-docs.mjs --json 2f7977cd2f25d878f31942dae6e229af9ff316d3

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmQjPiXgNoSaEpqeGvY

Contract-review-claim: session_01ADHkmQjPiXgNoSaEpqeGvY · head e38ab22 · 2026-11-02T12:24Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmQjPiXgNoSaEpqeGvY

Contract review

Served-tier: TIER_DEFAULT
Head-sha: e38ab2275eac32187c122276ad6652f69840a199
Local-runs: none

Inputs: card #29278 body and all six comments (triage 6575398009, claims 6575831164 / 6575878708, hold 6576235761 and its correction 6576319221, os-dev-report 6577003677); PR #29339 body, file list (3 files: .changeset/29278-mongodb-unique-null-distinct.md, packages/drivers/driver-mongodb/src/mongodb-schema.ts, packages/drivers/driver-mongodb/src/mongodb-unique-null-distinct.test.ts), net diff against main (merge-base 276ca307); check-runs on the head, read at 2026-11-02T12:41Z.

① Derived judgments

Gates (check-runs on the head): 48 check-runs, all completed: 35 success, 13 skipped (UI lanes, Build Docs, Temporal Conformance, the opt-in tarball and 18.x harnesses, Dogfood Verify CLI, the Dogfood sharded matrix, the push-run schedule gate), 0 failure, 0 in progress. Test Core 1-8/8, Build Core, Type Check (workspace, consumer gates, source gates, debt ledger), every Lint leg, Check Changeset, PR-body guards, Governed Surface Queue Guard and Dogfood Regression Gate are all success.

  1. Accept-set widening (right). Field-level unique and declared indexes[] unique entries are now { unique: true, partialFilterExpression: { FIELD: { $type: [16 non-null BSON types] } } } with no sparse. A second record whose unique field is null is now admitted on create and update; in a multi-column key, a null in any part exempts the row. That is the NULL-distinct rule driver-sql and driver-memory already keep (memory-unique-constraint.ts), which is what the card asked for. The 7 recording-Db DDL tests pin it on every CI lane (Test Core green). The 8 real-mongod tests are opt-in (driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517) and run on no CI lane, so the server-side behaviour is the dev's measurement (mongod 8.3.7: base 8 red, head 15/15; cross-driver table in the PR body), not a CI reading. Named as such, and accepted.
  2. Unchanged refusals (right). Every non-null duplicate, '' included, is still refused with the server's own E11000 (code 11000). Missing ×2 was already admitted and still is. No error code and no driver-sql, driver-memory or packages/spec change, which matches the claim's ⛔ list.
  3. Declared indexes[] unique moved in the same diff (right). A single-column declaration and a field-level unique both resolve to idx_FIELD_unique (pinned in mongodb-schema-declared-indexes.test.ts). Leaving one route sparse would request one name with two option sets. The deviation is accepted.
  4. New physical index idx_FIELDS beside each unique index (right, with a note). Without it, an equality lookup on a partial index is a COLLSCAN (measured; ablation A3 3 red). The name converges with a declared plain index over the same columns, and an existing same-key index under another name answers 85, which is skipped. The write cost is disclosed. Note (non-blocking): the idx_ + joined-fields naming can now collide where it did not before. A field literally named a_b with unique, plus a declared plain index over [a, b], both ask for idx_a_b over different keys. That answers 86 on a non-partial op, which is thrown, so the sync fails. This is contrived, and the scheme already collided for two unique routes (idx_a_b_unique). Follow-up material, not a must-fix.
  5. Legacy migration (right, one unpinned claim). rebuildLegacySparseUnique drops and recreates only an index that exactly matches what the driver wrote: unique, sparse, same keys in the same order, no partial filter. It runs only on 85/86 for an op that carries a partial filter. Both leave-alone controls (an extra collation; other keys) are pinned (ablation A2 2 red). IndexNotFound (27) on a concurrent drop is ignored. A duplicate written during the drop/create window fails the sync loudly. Unpinned: the PR says "the read index is created first, so lookups stay indexed" on the migration path. The real-server migration test asserts the rebuilt unique index's shape and its admits/refusals, but not that idx_code exists after that first sync. If the server treats a plain {code: 1} beside the legacy sparse unique {code: 1} as the same index signature, it answers 85 and the read index is skipped. The read index then only lands at the next sync, which works because by then the unique index is partial and has a different signature. Correctness is unaffected and the gap closes at the next sync. A one-line assertion would settle it. Should-pin follow-up, non-blocking.
  6. Type list (right, minor note). It omits the deprecated BSON types undefined, symbol, dbPointer and javascriptWithScope. A value of one of those types is no longer constrained, where sparse constrained it. The driver cannot write those types from its JSON surface, so the effect is negligible.
  7. Public TS surface (unchanged, right). The new helpers are module-private. The import change is type-only (Collection, Document). No export was added, removed or changed. Server coverage: measured on 8.3.7 only (the $type-array partial filter and two indexes on the same keys that differ only by partial filter). The diff declares no server floor. Noted, not blocking.

② Semver level

The changeset .changeset/29278-mongodb-unique-null-distinct.md bumps '@objectstack/driver-mongodb': patch and names no other package. The diff publishes only driver-mongodb src plus a test file. Its body and the PR body both carry the line-initial Clause-②: yes (widening) and Metadata-protocol: none. Matches. Metadata-protocol: none is right: nothing a metadata author can write is added, narrowed or re-meant, because unique keeps its documented meaning and the driver now honours it. Under AGENTS.md, none takes patch, and a non-protocol widening ships patch. Clause-② yes (widening) is right too. The accept-set grows (a null duplicate is admitted), and no record that was admitted before is now refused, because the new index constrains a subset of what the sparse one did. The a_b naming edge in ①.4 is a sync-time collision, not a narrowing of what records are admitted, and does not change the arm. Check Changeset is success. No skip-changeset, correctly.

③ Boundary flags

Dev deviations (os-dev-report 6577003677):

  • No shared conformance case-set. The card's "Wanted" asked for one. The case-sets live in packages/spec/src/data/*-conformance.ts (verified at head), and the seat's claim ⛔-excludes packages/spec/**, so the dev stayed inside the claim. Accepted. The ask is escalated to the seat as OQ1 below.
  • Declared indexes[] changed too. Accepted (①.3).
  • Plain read index added. Accepted (①.4, OQ2).
  • main moved 27 commits; the branch was not merged. The full check-run set on this head is green and none of those commits touch the three paths. Accepted. The merge queue re-tests on the merged tree.
  • Assignee and review request skipped. This is the seat's housekeeping and does not affect the diff. Accepted. The seat assigns.
  • Real-mongod suite runs on no CI lane. This is the standing driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517 state, and the DDL pins are the CI copy. Accepted, named in ①.1.

open_questions:

  • OQ1 (shared NULL-distinct unique case-set): A, escalated. The seat files a spec-seat card for a unique conformance case-set in packages/spec/src/data and has drivers enrol in a follow-up. This review makes no such write. It does not block, because the claim excluded spec and the cross-driver table is measured.
  • OQ2 (keep the read index): A. Keep it. B would turn every lookup by a unique field into a collection scan, a worse regression than the p3 defect.
  • OQ3 (drop-then-create rebuild): A. Keep it as shipped. The window is milliseconds, a duplicate written in it fails the sync loudly instead of leaving the field unconstrained, and the match is exact, so nothing the driver did not build is touched. B would leave every deployed collection on the defect. The unpinned read-index claim in ①.5 is a follow-up pin, not a reason to choose B.

Card history: hold 6576235761 was withdrawn by 6576319221 (the #5499 freeze was lifted for driver-mongodb), and claim 6575878708 stands. Nothing blocks. security_findings: none, out_of_scope_findings: [].

Follow-ups for the seat, all non-blocking: OQ1's spec card; one assertion that idx_code exists after the first migrating sync (①.5); the idx_ naming-collision edge (①.4).

Implemented-by: claude/project-thread-rmcblv
Reviewed-by: session_01ADHkmQjPiXgNoSaEpqeGvY

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmQjPiXgNoSaEpqeGvY

席位核对 · ACCEPT · domain:server seat 1 · os-steve · session_01ADHkmQjPiXgNoSaEpqeGvY · 2026-11-02T12:43Z

Head e38ab2275e, report 6577003677 (on #29278), claim 6575878708. Clause-②: yes (widening) → declaration face, review at TIER_DEFAULT: record 6577415377 on this head, PASS, no must-fix.

item reading
Shape Draft, base main, Fixes #29278. 3 files: driver-mongodb/src/mongodb-schema.ts, one new test file, and a changeset (@objectstack/driver-mongodb: patch, Clause-②: yes (widening), Metadata-protocol: none). No packages/spec/**. Not governed (check-governed-merges governed: false).
Rule Field-level and declared unique indexes are partial over every non-null BSON type, with no sparse, so two null or missing values are both admitted, as on driver-sql and driver-memory. A non-null duplicate, '' included, is still refused with E11000. Each unique index gets a plain read index idx_FIELDS. A legacy sparse index of exactly the old shape is rebuilt at the next sync.
Evidence Measured on a real mongod 8.3.7: base has 8 red, head is 15/15, the driver-mongodb suite passes 911/911, and 3 ablations went red and then green again. CI on this head: 48 runs, 35 green, 13 skipped, none red. check-expected-skips OK (13, all in main's roster). The real-mongod tests run in no CI lane (#5517 standing). The 7 DDL pins are the CI copy.
Open questions OQ2 is A: keep the read index. OQ3 is A: keep the drop-then-create rebuild. OQ1, the shared NULL-distinct unique conformance case-set in packages/spec/src/data, is outside this claim; the seat routes it to the spec lane separately. It does not block.
Should-fix, not filed ① A first-sync assertion that idx_code exists beside the legacy sparse index is unpinned; the next sync self-heals. ② An idx_a_b name collision between a field literally named a_b and a declared plain index over [a, b] is contrived. ③ Deprecated BSON types (undefined, symbol, …) are no longer constrained, but the driver cannot write them. None of these has a user-visible cost that passes the filing gate. The next PR that touches mongodb-schema.ts should add pin ①.
Landing 「按照 pm-dispatch 规则复核过的都授权」 (Leehom, 2026-10-25T11:35Z): ready and auto-merge through the relay.

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

1 participant