Skip to content

Commit 0ea5f9d

Browse files
os-litantclaude
andauthored
docs(cli): state the measured platform-id width at four citation sites (#16414)
* docs(cli): state the measured platform-id width at four citation sites All four sites cited driver-sql's `case 'lookup': case 'user':` arm BY NAME for "a platform id is 26 characters", two of them spelling out a ULID literal. #15522 corrected that origin sentence, so the citation chain pointed at text that no longer exists -- the arm now carries an explicit "do not restore the number this sentence used to carry" guard naming the same four copies. Measured on this branch by driving the real SqlDriver against SQLite rather than reading its constants: - the driver mints a 16-character nanoid when the caller supplies no id (12 samples, exactly one distinct width; the alphabet carries `-` and lowercase, so a Crockford-base32 ULID check over them returns false); - a SUPPLIED id is stored verbatim at whatever width the caller chose -- 10, 17, 18, 26, 40 and 200 all landed and read back unaltered, with a non-vacuity control: a query for an id never written returned 0 rows while the table held 6, so the filter really filters; - width is driver-owned, not a platform constant: driver-sql, mongodb and turso each spell DEFAULT_ID_LENGTH = 16, while driver-memory mints objectName-timestamp-counter, a variable-width shape. So the replacement does not swap 26 for 16. An id's width is not a fixed number at all, and each site now says which half it states -- what the driver MINTS versus what a supplied id is stored at -- because naming a new fixed number would only re-arm the same trap. Every site's conclusion is unchanged: a reference column takes `table.string(...)` / VARCHAR(255) rather than `table.uuid`, because Postgres refuses a platform id in a `uuid` column with 22P02 -- it refuses a 16-character nanoid exactly as it refused a ULID. Comment and failure-message text only: no behaviour, no asserted value and no minted width changes. The two CHANGELOG copies stay untouched as historical records. A fifth live-source site carrying the same sentence in its strongest "minted" form, in packages/platform-objects, is filed as #16410 rather than edited here -- a different package, a different verification surface. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N * docs(cli): reflow an orphaned line left by the previous commit Commit f933d1e ("docs(cli): state the measured platform-id width at four citation sites") left the aligned doc-comment block in `generate.ts` reading: * Postgres refuses either in a `uuid` column with `22P02`. The * width half * is the same rule for the whole REFERENCE_VALUE_TYPES class: "width half" was stranded on a line of its own -- an artifact of where that commit's replacement text ended, not something the surrounding block ever said. Rewrapped to close the orphan; the sentence is unchanged word for word. Presentation only, and no line is being bought: nothing is added here, the same words occupy one line fewer, and the paragraph's content is identical. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D47qPfEWVPmhguWgBZCi5N --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 60ff091 commit 0ea5f9d

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

packages/cli/src/commands/generate-field-type-vocabulary.pin.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,10 @@ describe('#14828 — the SQL answers are the platform’s, not this file’s inv
512512
expect(
513513
tsColumn(type),
514514
`os generate migration (typescript) gave a ${type} column something other than a string ` +
515-
'column. A platform id is 26 characters (driver-sql spells one out in its lookup arm), ' +
516-
'so a `uuid` column refuses it outright on Postgres with 22P02.',
515+
'column. A platform id is not a uuid, and its width is not a fixed number (driver-sql\'s ' +
516+
'lookup arm states both: it mints a 16-character nanoid, and stores a supplied id at ' +
517+
'whatever width the caller chose), so a `uuid` column refuses it outright on Postgres ' +
518+
'with 22P02.',
517519
).toBe(`table.string('f_${type}')`);
518520
}
519521
// The width is knex's default for a bare `table.string(name)`, which is the

packages/cli/src/commands/generate-multiple-json-column.pin.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ describe('#14829 — `multiple: true` is one answer across all three surfaces',
273273
it('#14828 discharged — the five disputed SCALAR answers are the platform’s', () => {
274274
// A reference column holds the target's `id`: `table.string(name)`, knex's
275275
// varchar(255). `table.uuid` was the one HARD failure of the five — a
276-
// platform id is 26 characters and Postgres refuses one in a `uuid` column.
276+
// platform id is not a uuid, and its width is not a fixed number (driver-sql
277+
// mints a 16-character nanoid, and stores a supplied id at whatever width
278+
// the caller chose), so Postgres refuses one in a `uuid` column.
277279
expect(sqlColumn('single_lookup')).toBe('VARCHAR(255)');
278280
expect(tsColumn('single_lookup')).toBe("table.string('single_lookup')");
279281

packages/cli/src/commands/generate.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,13 @@ async function runClientGeneration(configPath: string | undefined, flags: { outp
992992
* `lookup` / VARCHAR(36) → VARCHAR(255), with the migration switch's
993993
* `master_detail` `table.uuid` corrected in the same breath. The
994994
* `uuid` half is the only HARD failure of the five: a platform
995-
* id is 26 characters (`createColumn`'s lookup arm says so and
996-
* spells one out — `01JQ8XKZ9M4N7P2R5T6V8W0Y3B`), and Postgres
997-
* refuses one in a `uuid` column with `22P02`. The width half
998-
* is the same rule for the whole REFERENCE_VALUE_TYPES class:
995+
* id is NOT a uuid, and its width is not a fixed number at all
996+
* (`createColumn`'s lookup arm states both): the driver mints a
997+
* 16-character nanoid when the caller supplies none, and stores
998+
* a SUPPLIED id verbatim at whatever width the caller chose.
999+
* Postgres refuses either in a `uuid` column with `22P02`. The
1000+
* width half is the same rule for the whole
1001+
* REFERENCE_VALUE_TYPES class:
9991002
* `user` and `tree` moved with them, because a reference column
10001003
* holds the TARGET's `id` — which the driver itself emits as
10011004
* `table.string('id').primary()`, i.e. `varchar(255)` — and
@@ -1886,10 +1889,12 @@ export function generateMigrationTs(config: Record<string, unknown>): string {
18861889
// answer: `createColumn`'s `case 'lookup': case 'user':` is
18871890
// `table.string(name)`, and `master_detail` reaches the same call
18881891
// through its catch-all. `table.uuid` was the one HARD failure among
1889-
// this card's five rows — a platform id is 26 characters
1890-
// (`01JQ8XKZ9M4N7P2R5T6V8W0Y3B`, spelled out in that same driver arm),
1891-
// and Postgres refuses one in a `uuid` column with `22P02 invalid
1892-
// input syntax for type uuid` on the very first insert.
1892+
// this card's five rows — a platform id is NOT a uuid, and its width
1893+
// is not a fixed number at all: that same driver arm mints a
1894+
// 16-character nanoid when the caller supplies no id, and stores a
1895+
// SUPPLIED one verbatim at whatever width the caller chose. Postgres
1896+
// refuses either in a `uuid` column with `22P02 invalid input syntax
1897+
// for type uuid` on the very first insert.
18931898
case 'lookup': case 'master_detail':
18941899
case 'user': case 'tree':
18951900
case 'image': case 'file': case 'avatar': case 'video': case 'audio':

0 commit comments

Comments
 (0)