Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/platform-objects-import-job-minted-id-width.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@objectstack/platform-objects': patch
---

`sys_import_job.created_by`'s bound derivation no longer justifies its headroom with a false width. The comment claimed "a minted platform id is 26 characters"; measured on this tree by driving the real `SqlDriver` against SQLite, twelve `create()` calls supplying no id yield exactly one distinct width, **16** — and a caller-supplied id is stored verbatim at whatever width the caller chose (10, 17, 18, 26, 40 and 200 all landed and read back unaltered), so nothing on the write path bounds an id's width at all.

This is a published byte, not an internal note: `@objectstack/platform-objects` ships no `src/` in its `files[]`, but the comment survives bundling and appears verbatim in four shipped artefacts — `dist/index.js`, `dist/index.mjs`, `dist/audit/index.js` and `dist/audit/index.mjs`.

The correction does **not** restate a new number, because a number is what expires: a mint width is driver-owned (`driver-sql`, `driver-mongodb` and `driver-turso` each spell their own `DEFAULT_ID_LENGTH`, and `driver-memory` mints a variable-width shape that is not one at all), so the comment now points at `driver-sql`'s `[#15522]` note beside that constant — where the claim is measured and maintained — and states the reason `255` is safe without appealing to a floor: it is the width of the column this value is copied from, which is the referenced-column transitivity the block already derives.

`maxLength: 255` is unchanged, the derivation above it is unchanged, and no accept set, schema arm, index or export moves. `DEFAULT_ID_LENGTH` is untouched.
16 changes: 13 additions & 3 deletions packages/platform-objects/src/audit/sys-import-job.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,19 @@ export const SysImportJob = ObjectSchema.create({
// - the landed text declarations for the same value class:
// `sys_metadata_audit.actor`, `sys_metadata_commit.actor` and
// `sys_view_definition.owner` all declare `maxLength: 255`.
// The floor is cleared with room to spare: a minted platform id is 26
// characters (measured on #11431, where honouring a bound below that made a
// column structurally unable to hold any id at all).
// [#16410] There is no fixed "floor" to clear, because an id has no fixed
// width. `driver-sql` mints `nanoid(DEFAULT_ID_LENGTH)` — a per-driver
// constant — and `driver-memory` mints no fixed width at all, while a
// caller-SUPPLIED id is stored verbatim at whatever width the caller chose,
// so nothing on the write path bounds one. 255 is safe not as headroom over
// some id width but by the referenced-column transitivity derived above: it
// is the width of the column this value is COPIED FROM. Read the width
// claim where it is maintained — `driver-sql`'s `[#15522]` note beside
// `DEFAULT_ID_LENGTH`, measured there against a live driver — never a number
// restated here; a restated number is exactly how this sentence came to
// assert 26. (#11431 is the same trap from the other side: honouring a
// declared bound BELOW what a driver mints makes a column structurally
// unable to hold any id at all.)
// 255 is also <= the 768-character utf8mb4 key ceiling, so the
// `(created_by, created_at)` index below is expressible on MySQL — which is
// the whole point: unbounded, this column was emitted TEXT and MySQL refused
Expand Down
Loading