Found while measuring #11567. Filed unassigned. Pre-existing.
What
reference is the only relationship spelling FieldSchema declares. reference_to is a rejected alias — measured on origin/main:
FieldSchema.safeParse({ name:'parent', type:'lookup', reference_to:'p' })
=> success: false, issue.code = unrecognized_keys, keys = ["reference_to"]
Nine test fixtures nevertheless declare it, so each describes an object no author could publish:
| file | line |
|---|
packages/objectql/src/engine-multivalue-normalize.test.ts | 36 |
packages/rest/src/meta-object-materialization-agreement.test.ts | 126 |
packages/rest/src/meta-object-search-companion-agreement.test.ts | 99 |
packages/runtime/src/batch-row-http-status-real-driver.integration.test.ts | 64 |
packages/runtime/src/batch-row-driver-text-real-driver.integration.test.ts | 59 |
packages/lint/src/validate-flow-template-paths.test.ts | 21, 22 |
packages/lint/src/runtime-lazy-deps.test.ts | 120 |
packages/drivers/driver-sql/src/sql-driver-schema.test.ts | 122 |
(packages/spec/src/shared/suggestions.test.ts, packages/spec/src/ui/action.test.ts and packages/lint/src/validate-security-posture.test.ts also name the string, but those are asserting the rejection — they are correct and are not in this list.)
registerObject deliberately skips Zod ("the ones that skip Zod and lint (#3896, raw registerObject)", packages/objectql/src/registry.ts), which is why these fixtures run at all.
Why it matters — this is not only tidiness
These fixtures exercise driver branches that authored metadata never reaches, and one of them is measurably load-bearing for a wrong conclusion. #11567 was filed on a live-MySQL observation that a lookup column "produces a real CONSTRAINT … FOREIGN KEY whenever the field carries reference_to". That reading is true — and irrelevant to production, because the only things that carry reference_to are fixtures like these. The investigation had to run a full live measurement on Postgres 16.13 + MySQL 8.0.46 to establish that an ordinary authored lookup gets no FK.
Per sql-driver-schema.test.ts:122 the reference_to is incidental (the case is about multiple: true producing a JSON column), so most of these are a one-word fixture correction. Two of them (packages/rest, agreement suites) describe objects served over /meta, where a spec-invalid shape is a more interesting question.
The related hole
Repo-wide there is no test that asserts whether a lookup field does or does not get a FOREIGN KEY. Every FK-touching driver test (sql-driver-introspection.test.ts:102/149, sql-driver-11201-introspect-fk-schema-scope.test.ts, sql-driver-11324-*, sqlite-wasm-driver-introspection.test.ts:98/145) creates its FKs with raw knex DDL and then introspects them — none goes through createColumn. So the FK-emission branch at sql-driver.ts:13994-13995 has zero coverage of its own output, in either direction. Whatever #11567 is ruled to be, a pin belongs on the outcome.
Suggested disposition
Correct the nine fixtures to reference, and add one pin at the driver layer asserting the ruled FK behaviour for an authored lookup. ⚠️ Correcting the spelling may change what some of these suites observe (that is the point) — each needs re-judging individually rather than a batch rename.
Generated by Claude Code
Found while measuring #11567. Filed unassigned. Pre-existing.
What
referenceis the only relationship spellingFieldSchemadeclares.reference_tois a rejected alias — measured onorigin/main:Nine test fixtures nevertheless declare it, so each describes an object no author could publish:
packages/objectql/src/engine-multivalue-normalize.test.tspackages/rest/src/meta-object-materialization-agreement.test.tspackages/rest/src/meta-object-search-companion-agreement.test.tspackages/runtime/src/batch-row-http-status-real-driver.integration.test.tspackages/runtime/src/batch-row-driver-text-real-driver.integration.test.tspackages/lint/src/validate-flow-template-paths.test.tspackages/lint/src/runtime-lazy-deps.test.tspackages/drivers/driver-sql/src/sql-driver-schema.test.ts(
packages/spec/src/shared/suggestions.test.ts,packages/spec/src/ui/action.test.tsandpackages/lint/src/validate-security-posture.test.tsalso name the string, but those are asserting the rejection — they are correct and are not in this list.)registerObjectdeliberately skips Zod ("the ones that skip Zod and lint (#3896, rawregisterObject)",packages/objectql/src/registry.ts), which is why these fixtures run at all.Why it matters — this is not only tidiness
These fixtures exercise driver branches that authored metadata never reaches, and one of them is measurably load-bearing for a wrong conclusion. #11567 was filed on a live-MySQL observation that a lookup column "produces a real
CONSTRAINT … FOREIGN KEYwhenever the field carriesreference_to". That reading is true — and irrelevant to production, because the only things that carryreference_toare fixtures like these. The investigation had to run a full live measurement on Postgres 16.13 + MySQL 8.0.46 to establish that an ordinary authored lookup gets no FK.Per
sql-driver-schema.test.ts:122thereference_tois incidental (the case is aboutmultiple: trueproducing a JSON column), so most of these are a one-word fixture correction. Two of them (packages/rest, agreement suites) describe objects served over/meta, where a spec-invalid shape is a more interesting question.The related hole
Repo-wide there is no test that asserts whether a lookup field does or does not get a
FOREIGN KEY. Every FK-touching driver test (sql-driver-introspection.test.ts:102/149,sql-driver-11201-introspect-fk-schema-scope.test.ts,sql-driver-11324-*,sqlite-wasm-driver-introspection.test.ts:98/145) creates its FKs with raw knex DDL and then introspects them — none goes throughcreateColumn. So the FK-emission branch atsql-driver.ts:13994-13995has zero coverage of its own output, in either direction. Whatever #11567 is ruled to be, a pin belongs on the outcome.Suggested disposition
Correct the nine fixtures to⚠️ Correcting the spelling may change what some of these suites observe (that is the point) — each needs re-judging individually rather than a batch rename.
reference, and add one pin at the driver layer asserting the ruled FK behaviour for an authored lookup.Generated by Claude Code