Skip to content

[finding] packages/cli generate.ts: five field-type vocabulary entries that DO exist disagree with what the platform stores (autonumber SERIAL, formula's column, multiselect TEXT, vector VECTOR, lookup uuid) #14828

Description

@os-trump

Found while implementing #14657, which filled the vocabularies' GAPS. Filed unassigned for triage. No severity asserted. #14657 is not addressed here and remains open until its own PR lands.

The shape

#13871 removed entries that named types the platform does not have. #14657 added entries for real FieldType members that had none. This is the third direction: entries that exist, key on a real member, and describe something the platform does not do. Same outcome as the other two — a plausible-looking wrong schema, silently — but neither of those cards covers it, and #14657 deliberately left every pre-existing entry byte-for-byte alone rather than mixing "fill the gaps" with "change emitted DDL for apps that already generated against it".

Measured on origin/main against packages/drivers/driver-sql/src/sql-driver.ts (the emitter that creates the real columns) and the spec's ADR-0104 D1 value classes:

entry generate.ts says the platform does
autonumber in FIELD_TYPE_SQL_MAP SERIAL table.string — the runtime issues a RENDERED string (prefix + counter + suffix), so a SERIAL cannot hold INV-0001. FIELD_TYPE_MAP in the same file already says string, so the file disagrees with itself.
formula in both maps and the switch TEXT / table.text case 'formula': return; — NO column at all. A formula is virtual; the generated migration creates a column the runtime never writes.
multiselect in FIELD_TYPE_SQL_MAP TEXT a JSON column (MULTI_OPTION_TYPES seeds JSON_COLUMN_TYPES). The same table's json: 'JSONB' and the migration switch's table.jsonb for this very member both say JSON, so this is a within-file disagreement too.
vector in FIELD_TYPE_SQL_MAP VECTOR a JSON column (vector is in STRUCTURED_JSON_TYPES). VECTOR is also pgvector-only.
lookup / master_detail in the migration switch table.uuid table.string — a platform id is a 26-character ULID, not a UUID, and sql-driver.ts says so in as many words at its lookup/user arm. On Postgres a uuid column refuses a ULID outright.

The lookup row is the one with a hard failure mode (Postgres rejects the insert); the others are silent shape mismatches.

Why it was not folded into #14657

Every one of these changes DDL that os generate migration already emits, for members that already had an answer. #14657's change is additive — members that emitted the default now emit something — so it can land without asking what an existing generated migration should do. This card cannot: it needs a decision on whether the generator's output is allowed to change for an entry an app may have already run.

The formula row is the largest of them, because "emit no column" is a structural change to the generators rather than a different value in a table.

Notes for triage

  • Landing point is packages/cli ⇒ likely domain:cli.
  • packages/cli/src/commands/generate-field-type-vocabulary.pin.test.ts now pins PRESENCE in both directions (every key is a member, every member has a key). It deliberately does NOT pin correctness — that is this card. If this card decides the values must derive from the ADR-0104 D1 value classes, that pin is where the rule would go, and it already imports the classes' owner.
  • packages/runtime/src/dispatcher-error-vocabulary.ts carries a foreign-vocabulary row for the code: 'TEXT' entry in FIELD_TYPE_SQL_MAP; if that entry's value changes, the row's code needs to change with it.

Dedup

search_issues for this shape returned total_count: 0; a control query in the same session returned #14657 and #13871, so the empty result is a reading rather than a broken search.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions