You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Measured while implementing #12252, which turned out to be masking this. Filed unassigned by the domain:engine PM seat; the disposition is a maintainer call (see the ⚠️ on #12251 below).
The defect
packages/drivers/driver-mongodb/src/mongodb-schema.ts creates a join index for lookup fields, gated on reference_to:
and its local FieldDef declares that key and no other relationship spelling:
// :37
reference_to?: string;
Measured on origin/main: reference — the canonical and only spelling FieldSchema accepts — appears nowhere in this file as a read. The three other occurrences are reference_to itself, a prose comment, and the word "reference" inside an English sentence.
reference_to is a rejected alias. Per #12252's measurement, FieldSchema.safeParse({ type: 'lookup', reference_to: 'p' }) fails with unrecognized_keys. So an authored object cannot carry the key this branch tests for.
⇒ The lookup half of that condition is dead for every authored object. No lookup field has ever produced idx_<field>_lookup on MongoDB.
Why it looked healthy
Two things hid it, and both are measurable:
The user disjunct is unconditional.field.type === 'user' needs no reference_to, so idx_owner_lookup-shaped indexes are created. Any spot-check that happened to look at a user field saw the feature working.
One test fixture supplied the rejected key.packages/drivers/driver-mongodb/src/mongodb-driver.test.ts:347 is the only live trigger of the lookup arm anywhere in the tree, and its suite asserts the index exists (:366). Differential probe against the real syncCollectionSchema, through the same fake-Db recorder the package's own mongodb-schema-declared-indexes.test.ts uses:
fixture spelling
idx_company_id_lookup
reference_to (current)
present
reference (canonical)
absent
positive control — a user field
idx_owner_lookup present
A minus B = ['idx_company_id_lookup']; B minus A = []. The control proves B's zero is a real zero and not a dead harness.
Per #12251's own measurement: all 57 relationship fields across the 44 exported platform objects carry reference. So the count of authored lookup fields indexed on MongoDB today is zero, platform-wide.
#12251 covered this and was closed not_planned. This card is not a unilateral reversal of that — filing evidence is not overturning a ruling, and I am explicitly not reopening it. What is new since it was closed:
the branch is measured entirely dead for authored metadata, not merely inconsistent;
the same wrong spelling is published to npm in the driver's README (filed separately).
If the answer is still "not planned", that is a legitimate outcome — but it should be recorded against this evidence rather than inherited, because #12252's inverted pin will assert the absence as current behaviour and should name the card that owns it.
Deliverable, if ruled fixable
Read the canonical spelling in the branch and the FieldDef (accepting reference_to too, if back-compat with stored non-conforming data matters). ⚠️ This is a behaviour change on boot for existing deployments — index builds on large collections — which is exactly why #12251 asked for a deliberate decision. It should be graded on its own merits, not inherited from #12252's priority:p2 tidy-up.
Related
#12252 (the fixture card that surfaced it) · #12251 (closed not_planned) · #11567 (the SQL-side FK counterpart) · #5517 (why the covering suite is opt-in)
Measured while implementing #12252, which turned out to be masking this. Filed unassigned by the⚠️ on #12251 below).
domain:enginePM seat; the disposition is a maintainer call (see theThe defect
packages/drivers/driver-mongodb/src/mongodb-schema.tscreates a join index for lookup fields, gated onreference_to:and its local
FieldDefdeclares that key and no other relationship spelling:Measured on
origin/main:reference— the canonical and only spellingFieldSchemaaccepts — appears nowhere in this file as a read. The three other occurrences arereference_toitself, a prose comment, and the word "reference" inside an English sentence.reference_tois a rejected alias. Per #12252's measurement,FieldSchema.safeParse({ type: 'lookup', reference_to: 'p' })fails withunrecognized_keys. So an authored object cannot carry the key this branch tests for.⇒ The
lookuphalf of that condition is dead for every authored object. Nolookupfield has ever producedidx_<field>_lookupon MongoDB.Why it looked healthy
Two things hid it, and both are measurable:
The
userdisjunct is unconditional.field.type === 'user'needs noreference_to, soidx_owner_lookup-shaped indexes are created. Any spot-check that happened to look at auserfield saw the feature working.One test fixture supplied the rejected key.
packages/drivers/driver-mongodb/src/mongodb-driver.test.ts:347is the only live trigger of thelookuparm anywhere in the tree, and its suite asserts the index exists (:366). Differential probe against the realsyncCollectionSchema, through the same fake-Dbrecorder the package's ownmongodb-schema-declared-indexes.test.tsuses:idx_company_id_lookupreference_to(current)reference(canonical)userfieldidx_owner_lookuppresentA minus B =
['idx_company_id_lookup']; B minus A =[]. The control proves B's zero is a real zero and not a dead harness.OS_TEST_MONGODB_MEMORY_SERVER_ENABLED=1, driver-mongodb 测试:两个套件并发下载 MongoDB 二进制,mongodb-memory-server 的 rename 竞态让全绿测试 exit 1(队列 flaky) #5517) — so the one test standing on this branch does not run.Scale
Per #12251's own measurement: all 57 relationship fields across the 44 exported platform objects carry
reference. So the count of authored lookup fields indexed on MongoDB today is zero, platform-wide.#12251 covered this and was closed
not_planned. This card is not a unilateral reversal of that — filing evidence is not overturning a ruling, and I am explicitly not reopening it. What is new since it was closed:reference_toon a lookup — a keyFieldSchemarefuses — and the SQL driver's FK-emission branch has no test at all #12252 is poised to remove it;If the answer is still "not planned", that is a legitimate outcome — but it should be recorded against this evidence rather than inherited, because #12252's inverted pin will assert the absence as current behaviour and should name the card that owns it.
Deliverable, if ruled fixable
Read the canonical spelling in the branch and the⚠️ This is a behaviour change on boot for existing deployments — index builds on large collections — which is exactly why #12251 asked for a deliberate decision. It should be graded on its own merits, not inherited from #12252's
FieldDef(acceptingreference_totoo, if back-compat with stored non-conforming data matters).priority:p2tidy-up.Related
#12252 (the fixture card that surfaced it) · #12251 (closed
not_planned) · #11567 (the SQL-side FK counterpart) · #5517 (why the covering suite is opt-in)