feat(codegen-ts)!: derive native uuid[]/text[] from isArray; drop uuid_array/text_array dbColumnType values (phase 1)#118
Closed
dmealing wants to merge 1 commit into
Closed
Conversation
…d_array/text_array dbColumnType values (phase 1) dbColumnType slim-and-derive Phase 1 (TS port + migrate-ts). Applies the project's derive-don't-declare principle (ADR-0023) to the @dbColumnType escape hatch: the array-ness of a column already lives on the field's isArray axis, so native Postgres arrays are DERIVED, never declared. - metadata: remove uuid_array/text_array from the legal @dbColumnType value-set (DB_COLUMN_TYPE_VALUES + DB_COLUMN_TYPE_LEGAL_SUBTYPES). Both now fail the loader (ERR_BAD_ATTR_VALUE). Constants kept exported. Keeps uuid/jsonb/ timestamp_with_tz (timestamp_with_tz default flip is Phase 2). The shared attr-description text (registry-conformance + metamodel-docs fixtures) is left unchanged — those cross-port fixtures are coordinated separately. - migrate-ts: derive native text[]/uuid[] from isArray on field.string/ field.uuid in subtypeToSqlType; drop the retired array overrides. Scalar field.uuid -> uuid, no-maxLength field.string -> text (unchanged). - codegen-ts: field.uuid scalar already maps to uuid(); field.uuid + isArray and field.string + isArray already emit .array() via the scalar-array path -> no column-mapper change needed; added explicit coverage. field.uuid was NOT a gap. Tests: targeted unit suites green (metadata attr-schema-validate + db-definition- completeness, codegen-ts column-mapper, migrate-ts expected-schema) plus the registry-conformance + metamodel-docs byte-gates; typecheck clean for metadata/codegen-ts/migrate-ts. No persistence fixture uses native arrays, so the committed canonical schema.postgres.sql is unchanged. Part of #dbcoltype-phase1 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuZWKnWzYGVnESijL7uuky
dmealing
force-pushed
the
feat/dbcoltype-phase1-ts
branch
from
June 30, 2026 03:23
c61dcd4 to
04ccbe4
Compare
Member
Author
|
Folded into the integrated Phase-1 PR (feat/dbcolumntype-slim-derive) which merges all five ports atomically — that's the one that lands. Keeping this open for per-port review history. |
Member
Author
|
Landed via the integrated Phase-1 PR #121 (squash-merged to main). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dbColumnType slim-and-derive — Phase 1 (TypeScript + migrate-ts)
Applies the project's derive-don't-declare principle (ADR-0023) to the
@dbColumnTypeescape hatch. The array-ness of a column already lives on the field'sisArrayaxis, so native Postgres arrays are derived, not declared. Breaking metamodel-vocabulary change, scoped to the pre-1.0 consolidation window.Per the design spec (
docs/superpowers/specs/2026-06-29-dbcolumntype-slim-and-derive-design.md), this PR is only the TS port +migrate-ts. Other ports and the sharedfixtures/corpora are coordinated separately.The change
metadata/db-constants.ts): removeduuid_array+text_arrayfromDB_COLUMN_TYPE_VALUES+DB_COLUMN_TYPE_LEGAL_SUBTYPES. The loader now rejects both (ERR_BAD_ATTR_VALUE). Constants stay exported. Keptuuid/jsonb/timestamp_with_tz(thetimestamp_with_tzdefault-flip is Phase 2).subtypeToSqlTypenow derives native arrays fromisArray—field.stringisArray →text[],field.uuidisArray →uuid[]— via a smallarrayElementSqlTypehelper; dropped the retireduuid_array/text_arrayoverrides. Scalarfield.uuid→uuid, no-maxLengthfield.string→text(unchanged).@dbColumnTypeattr description is carried verbatim in two shared cross-port fixtures (fixtures/registry-conformance/expected-registry.json,fixtures/metamodel-docs/expected/). Those are coordinated separately, so this PR does not edit the description (the loader-level value-set enforcement is indb-constants.ts, independent of the doc text). A follow-up alongside the other ports can refresh the description + those fixtures.What TS already did vs the
field.uuid[]questionfield.uuidscalar was already handled →uuid()column (not a gap, contrary to the worst case the brief flagged).field.uuid+isArrayalready emitsuuid()+.array()(=uuid[]) via the column-mapper's scalar-array path (uuid is neither object nor map), andfield.string+ isArray already emitstext[]. No column-mapper change was needed — added explicit test coverage to lock it in.field.stringno-maxLength→text, withmaxLength→varchar(N): already correct, confirmed.*_arrayoverrides —isArraywas never consulted. Now derived.Test evidence
attr-schema-validate(incl. newuuid_array/text_array→ERR_BAD_ATTR_VALUEcases) +db-definition-completeness; codegen-tscolumn-mapper(newfield.uuid/field.stringisArray →uuid[]/text[]); migrate-tsexpected-schema(derived arrays, scalar uuid/text, removed-value rejection). Plus theregistry-conformance+metamodel-docsbyte-gates stay green (description left unchanged). 131/131 across those 6 suites.typecheckclean formetadata/codegen-ts/migrate-ts; pre-push CI-parity build+typecheck gate passed.schema.postgres.sqlis unchanged — no persistence fixture exercises native arrays, so removing the overrides produces no diff in the committed canonical schema.Part of dbColumnType slim-and-derive Phase 1.
🤖 Generated with Claude Code