Skip to content

platform-objects: 45 system objects declare id as text while the platform emits varchar(255) — the whole remainder of #12015's post-narrowing corpus #12131

Description

@os-warren

Filed unassigned, from the corpus measurement carried out under #12015 (PR #12109). Not fixed there: that card owns the driver's diagnostic, and this is a metadata change in packages/platform-objects and its siblings.

What was measured

#12015 makes SqlDriver say out loud when a declaration on a builtin column name (id / created_at / updated_at) asks for storage the platform's own column does not deliver. The measurement is a real boot, not a grep: all 45 object definitions exported by @objectstack/platform-objects, driven through SqlDriver.initObjects on SQLite with a spy logger.

  • Before the narrowing: 116 warnings (id 45, created_at 42, updated_at 29).
  • After the narrowing:45 warnings — all of one shape, and every one of them a genuine disagreement:
sys_account.id: lost ["type"] — declared type 'text'
sys_api_key.id: lost ["type"] — declared type 'text'
…
sys_migration.id: lost ["type","maxLength"] — declared type 'text'
…
sys_view_definition.id: lost ["type"] — declared type 'text'

Every platform object declares its key as id: Field.text({ label: …, required: true, readonly: true }). The platform emits table.string('id').primary()varchar(255), not TEXT. So the declared type is not what lands, on the platform's own metadata, 45 times. sys_migration.id additionally declares a maxLength that binds nothing.

The created_at / updated_at declarations are not part of this: they declare type: 'datetime' and defaultValue: 'NOW()', which is exactly what createAuditTimestampColumn emits, so they are silent and correct as written.

Why it matters

The presentation half of these declarations is load-bearing and must stay — label feeds the generated *.objects.generated.ts translation files in four locales, highlightFields, FLS and sortability, and required is the ADR-0113 write contract. ⛔ So this is not "delete the id declaration". What disagrees with reality is one key: the declared type.

Left alone, these 45 lines are what a stock boot prints once #12015 lands — true, but a standing reminder that the platform's own metadata says TEXT where the platform stores varchar(255).

Shape of a fix (not decided here)

Either the declaration is corrected to the type the platform actually emits (Field.string(...), keeping every other key), or the platform's key column is what should change. The first is a mechanical metadata edit across ~45 files in platform-objects / metadata-core / the plugin and service packages; the second is a storage decision nobody has asked for. Which one is right is a judgement about what id should be, adjacent to (but not the same as) the question #12015 deliberately left unanswered — whether declaring id should be meaningful for the key's type.

Related: #12015 (where it was measured), #11431, #11374.


Generated by Claude Code

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