Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

TML-2623: hard-cut Postgres enum slot from framework-shared types to namespace-scoped enum - #595

Merged
wmadden merged 12 commits into
mainfrom
tml-2623-s1b-enum-migration
May 27, 2026
Merged

wmadden merged 12 commits into
mainfrom
tml-2623-s1b-enum-migration

Conversation

@wmadden

@wmadden wmadden commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

At a glance

This slice retires the legacy Postgres-enum slot from the framework-shared storage.namespaces.<ns>.types.* location and lands it under the namespace-scoped storage.namespaces.<ns>.enum.* slot, owned by the Postgres pack via the descriptor mechanism introduced in S1.A.

// Before — enum sits under the framework-shared `types` slot
"storage": {
  "namespaces": {
    "public": {
      "id": "public",
      "kind": "postgres-schema",
      "types": { "user_role": { "kind": "postgres-enum", "values": ["admin", "user"] } }
    }
  }
}

// After — enum sits under the pack-contributed `enum` slot
"storage": {
  "namespaces": {
    "public": {
      "id": "public",
      "kind": "postgres-schema",
      "enum": { "user_role": { "kind": "postgres-enum", "values": ["admin", "user"] } }
    }
  }
}

The framework no longer carries a slot dedicated to Postgres-pack content. The enum slot only exists for namespaces whose kind belongs to a pack that contributes it.

The decision

Hard-cut, not deprecation shim.

storage.<ns>.types had been doing double duty: a generic catch-all for type-shaped storage entries and the load-bearing home of Postgres enums. S1.A's descriptor mechanism made the second role unnecessary — packs can now contribute namespace-scoped entity-kind slots through AuthoringContributions.entityTypes, and the framework no longer needs to know what's living under types. This slice cashes in that capability for the Postgres enum case.

A6 ("no off-repo @prisma-next/* consumer pins on contract.json shape or storageHash values") was confirmed by the operator pre-slice. With no external pin to honour, a shim phase would only add a temporary discriminator-aware reader and a removal commit later; the hard-cut compresses that into the byte-stability hash bump this slice already needs.

Narrative

D1 — source hard-cut + TML-2658 fold-in (0339f348e, 24 files)

D1 retired every framework- and family-side use of types for enum content. The Postgres pack's AuthoringContributions.entityTypes gained an enum entry; the descriptor mechanism routed serialization/hydration/validation through it. Folded in TML-2658 (NamespaceRawSchema '+': 'ignore' directive parity with validators.ts) as a one-line touch on a file D1 already had open.

Spec patch 5f22452b8 corrected the slice's SDoD6 grep gate from the over-strict original PostgresEnumStorageEntry|'postgres-enum' pattern to the project-PDoD3 verbatim 'postgres-enum' literal. The PostgresEnumStorageEntry symbol stays as a legitimate bridging-adapter type signature in family-sql; retiring it is the scope of follow-up TML-2667, not S1.B.

D2 — fixture regen + A4 probe + JSDoc fold-in + snapshot revert (9cebc27dc)

Regenerated four contracts (two examples/ demos, one integration fixture, one snapshot-read fixture) plus paired contract.d.ts files. New storageHash values land alongside the new slot. Two framework JSDoc lines that named 'postgres-enum' as the example discriminator were generalized to 'pack-contributed-kind' and '<kind>', removing the substrate's pre-existing soft-coupling to one pack's vocabulary. snapshot-read-shapes.test.ts reverted to loading from regenerated on-disk fixtures (D1 had inlined JSON as a workaround pending D2's regen).

A4 (pre-#534 bookend replay): PASS. Pre-S1.B bookend contracts retain their original document-scoped storage.types enum shape; strict deserialize of those bookends behaves identically pre-D1 (0339f348e^) and post-D2 — the namespace-slot migration introduces no replay regression. Bookends not regenerated.

D2-R2 — lockfile reconcile (3829f634a)

D2's pnpm fixtures:emit invocation left a transient test-app importer (test-1779440829345-2mmflhsudq4) and ~20 @prisma-next/*@0.10.0 published-package resolutions in pnpm-lock.yaml. R2 ran pnpm install, removing the 133-line cruft.

Test plan

  • CI runs all gates (typecheck, fixtures:check, lint:deps, test:packages, test:integration, e2e)
  • PDoD3 grep gate: rg "'postgres-enum'" packages/1-framework/ packages/2-sql/9-family/ returns one hit (framework-components/test/control-stack.test.ts:235, allowed by SDoD6 carve-out)
  • Confining grep: rg "'postgres-enum'" packages/ --glob '!**/node_modules/**' --glob '!**/dist/**' returns hits only under packages/3-targets/3-targets/postgres/**, packages/3-targets/6-adapters/postgres/**, packages/3-targets/6-adapters/sqlite/**, and test fixtures
  • Substrate-retirement sanity: rg 'storageSlotKey|reservedStorageSlotKeys|namespaceSlotHydrationRegistry' packages/ --glob '!**/node_modules/**' --glob '!**/dist/**' returns zero (no S1.A regression)
  • Hash-shift inventory matches: four regenerated storageHash values in examples/prisma-next-demo/, examples/prisma-next-cloudflare-worker/, test/integration/test/authoring/parity/core-surface/, and packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json

Typecheck hygiene reminder. Run pnpm install && pnpm build (or rm -rf .turbo test/integration/.tsbuildinfo && pnpm build --force) before pnpm typecheck. Stale dist/*.d.mts artifacts have repeatedly produced false-fail typechecks across this slice's dispatches; see drive/retro/findings.md 2026-05-22 entry.

What this slice deliberately does not do

  • PostgresEnumStorageEntry symbol retirement in family-sql. Bridging adapters keep the type-import; follow-up TML-2667 introduces a descriptor-driven verifier that lets family-sql drop the import.

  • Plural slot naming refactor (enum → enums or similar). ADR Decision 5 picked "essence + singular"; mass rename across existing pack slots is deferred to TML-2634.

  • Namespace shape refactor (entries-redirected vs flat map). A02(b) deferred to TML-2636.

  • SQLite analogue of the Mongo builder lift from S1.A D6. TML-2648 tracks new SqliteStorage() parity.

  • TML-2654 emit-pipeline plain-literal namespace fix. Separate scope; tracked at TML-2654.

  • Bookend contract regeneration. A4 PASS rationale — replay-clean pre/post, no regen needed.

  • S1.C / S1.D scope. Domain-plane population (S1.C) and project-level cleanup (S1.D) remain follow-on slices on contract-ir-planes.

  • Namespace-aware Postgres enum planning. The Postgres migration planner keys enum lookups by bare TypeScript name across namespaces (locateNamespaceType, collectPostgresEnumTypes, locateNamespaceTypeInStorage), so two namespaces holding enum.<sameName> collide silently. Pre-existing bug on origin/main; S1.B D1 only renamed .types. → .enum. inside the existing loops. Sized L per drive/calibration/sizing.md — deferred to its own slice S1.E (TML-2686), full spec + plan in projects/contract-ir-planes/slices/namespace-aware-enum-planning/. Decomposed into 5 dispatches (M/M/M/S/S); sequenced after S1.D.

Alternatives considered

  1. Deprecation shim — keep types reading enums for one minor with a deprecation log line, hard-cut next minor. Rejected: A6 confirmed no off-repo pin needs the grace period; the byte-stability hash bump lands either way; a shim phase only adds a deletion commit.
  2. Family-sql PostgresEnumStorageEntry retirement in this slice — extend the descriptor mechanism to expose verifier-side type-narrowing so family-sql doesn't need the import. Rejected for scope: descriptor-driven verifier work is one slice on its own (TML-2667); pulling it into S1.B blows the M-cap.
  3. Defer fixture regen to a follow-up slice — keep D1's hard-cut on its own, regenerate fixtures in S1.C. Rejected: byte-stability is a hard gate; D1 without regen leaves fixtures:check red on main.
  4. Mongo half of the enum migration — symmetric work for Mongo's storage. Out of scope: Mongo doesn't have a types slot to migrate from; the analogue is a future-pack contribution.

References

Summary by CodeRabbit

  • Documentation

    • Added new Drive trial findings documenting two audit/gating edge cases and recommended verification steps.
  • Refactor

    • Standardized contract/storage shape across examples and core packages: Postgres enum entries are now emitted and read under a dedicated "enum" slot (replacing the prior "types" placement), and fixtures/tests updated to match.

Review Change Stack

@wmadden
wmadden requested a review from a team as a code owner May 26, 2026 16:02
@coderabbitai

coderabbitai Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR renames the Postgres enum storage container in SQL namespaces from types to enum across IR, contract builders, serialization/hydration, Postgres schema/types, migration planners, codegen, tests, and generated artifacts.

Changes

Namespace Enum Storage Refactor

Layer / File(s) Summary
Core IR contract types and validation
packages/2-sql/1-core/contract/src/ir/sql-storage.ts, packages/2-sql/1-core/contract/src/validators.ts
SqlNamespaceTablesInput, SqlNamespacePayload, and SqlNamespace rename the optional enum field from types? to enum?; contract schema validators validate the enum? slot instead of types?.
Contract building and authoring
packages/2-sql/2-authoring/contract-ts/src/build-contract.ts, packages/2-sql/2-authoring/contract-ts/src/contract-types.ts, packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts, packages/2-sql/2-authoring/contract-psl/test/interpreter*.test.ts
Namespace assembly emits enum instead of types; exported SqlContractResult surfaces the enum property; PSL interpreter tests verify enum lowering into the enum slot.
Contract serialization and hydration
packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts, packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
Raw contract validation targets enum entries; hydrated namespaces conditionally include enum; both base and Postgres serializers extract/emit enum data under the enum key.
Postgres schema definition
packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
PostgresSchemaInput and PostgresSchema replace types with enum; constructor materializes enum entries as PostgresEnumType instances; the schema exposes a read-only frozen enum map.
Type emission and code generation
packages/2-sql/3-tooling/emitter/src/index.ts, packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
Code generators emit enum properties in namespace types; field type resolution looks up references from storage.namespaces[nsId].enum; error messages and type predicates reference the enum slot.
Schema IR conversion and verification
packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts, packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
Schema IR conversion aggregates enum types from namespace.enum; verification populates allStorageTypesMap from enum entries.
Migration planning and type location
packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts, packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
Planners locate enum types under storage.namespaces[nsId].enum; enum collection and indexing use the enum map; docs clarify enum types reside in namespace.enum.
Test contracts and generated artifacts
packages/3-targets/3-targets/postgres/test/migrations/*.test.ts, packages/3-targets/3-targets/postgres/test/*.test.ts, examples/*/src/prisma/contract.*, test/integration/test/authoring/parity/core-surface/expected.contract.json
Test contracts use the enum property; assertions read from storage.namespaces[*].enum; generated contract JSON and TypeScript declarations reflect the new enum structure and updated storage hashes.
Documentation and comments
packages/1-framework/1-core/framework-components/src/ir/ir-node.ts, packages/1-framework/1-core/framework-components/src/ir/storage-type.ts, drive/retro/findings.md
Inline docs and JSDoc reference storage.namespaces[nsId].enum; example comments generalize enum kind examples; drive retro notes two trial findings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

"A rabbit in the code hops light and spry,
Renaming types to enum beneath the sky,
Tests refreshed, serializers tidy and trim,
I nibble carrots of consistency on a whim,
Hooray — namespace enums now sing in sync! 🥕"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'hard-cut Postgres enum slot from framework-shared types to namespace-scoped enum' clearly and concisely describes the main architectural change in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2623-s1b-enum-migration

Comment @coderabbitai help to get the list of available commands and usage tips.

@wmadden
wmadden force-pushed the tml-2623-s1b-enum-migration branch from 3394cbf to 49b5ff1 Compare May 26, 2026 16:07
@pkg-pr-new

pkg-pr-new Bot commented May 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/@prisma-next/extension-author-tools@595

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/@prisma-next/mongo-runtime@595

@prisma-next/family-mongo

npm i https://pkg.pr.new/@prisma-next/family-mongo@595

@prisma-next/sql-runtime

npm i https://pkg.pr.new/@prisma-next/sql-runtime@595

@prisma-next/family-sql

npm i https://pkg.pr.new/@prisma-next/family-sql@595

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/@prisma-next/extension-arktype-json@595

@prisma-next/extension-cipherstash

npm i https://pkg.pr.new/@prisma-next/extension-cipherstash@595

@prisma-next/middleware-cache

npm i https://pkg.pr.new/@prisma-next/middleware-cache@595

@prisma-next/mongo

npm i https://pkg.pr.new/@prisma-next/mongo@595

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/@prisma-next/extension-paradedb@595

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/@prisma-next/extension-pgvector@595

@prisma-next/extension-postgis

npm i https://pkg.pr.new/@prisma-next/extension-postgis@595

@prisma-next/postgres

npm i https://pkg.pr.new/@prisma-next/postgres@595

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/@prisma-next/sql-orm-client@595

@prisma-next/sqlite

npm i https://pkg.pr.new/@prisma-next/sqlite@595

@prisma-next/target-mongo

npm i https://pkg.pr.new/@prisma-next/target-mongo@595

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/@prisma-next/adapter-mongo@595

@prisma-next/driver-mongo

npm i https://pkg.pr.new/@prisma-next/driver-mongo@595

@prisma-next/contract

npm i https://pkg.pr.new/@prisma-next/contract@595

@prisma-next/utils

npm i https://pkg.pr.new/@prisma-next/utils@595

@prisma-next/config

npm i https://pkg.pr.new/@prisma-next/config@595

@prisma-next/errors

npm i https://pkg.pr.new/@prisma-next/errors@595

@prisma-next/framework-components

npm i https://pkg.pr.new/@prisma-next/framework-components@595

@prisma-next/operations

npm i https://pkg.pr.new/@prisma-next/operations@595

@prisma-next/ts-render

npm i https://pkg.pr.new/@prisma-next/ts-render@595

@prisma-next/contract-authoring

npm i https://pkg.pr.new/@prisma-next/contract-authoring@595

@prisma-next/ids

npm i https://pkg.pr.new/@prisma-next/ids@595

@prisma-next/psl-parser

npm i https://pkg.pr.new/@prisma-next/psl-parser@595

@prisma-next/psl-printer

npm i https://pkg.pr.new/@prisma-next/psl-printer@595

@prisma-next/cli

npm i https://pkg.pr.new/@prisma-next/cli@595

@prisma-next/cli-telemetry

npm i https://pkg.pr.new/@prisma-next/cli-telemetry@595

@prisma-next/emitter

npm i https://pkg.pr.new/@prisma-next/emitter@595

@prisma-next/migration-tools

npm i https://pkg.pr.new/@prisma-next/migration-tools@595

prisma-next

npm i https://pkg.pr.new/prisma-next@595

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/@prisma-next/vite-plugin-contract-emit@595

@prisma-next/mongo-codec

npm i https://pkg.pr.new/@prisma-next/mongo-codec@595

@prisma-next/mongo-contract

npm i https://pkg.pr.new/@prisma-next/mongo-contract@595

@prisma-next/mongo-value

npm i https://pkg.pr.new/@prisma-next/mongo-value@595

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/@prisma-next/mongo-contract-psl@595

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/@prisma-next/mongo-contract-ts@595

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/@prisma-next/mongo-emitter@595

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/@prisma-next/mongo-schema-ir@595

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/@prisma-next/mongo-query-ast@595

@prisma-next/mongo-orm

npm i https://pkg.pr.new/@prisma-next/mongo-orm@595

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/@prisma-next/mongo-query-builder@595

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/@prisma-next/mongo-lowering@595

@prisma-next/mongo-wire

npm i https://pkg.pr.new/@prisma-next/mongo-wire@595

@prisma-next/sql-contract

npm i https://pkg.pr.new/@prisma-next/sql-contract@595

@prisma-next/sql-errors

npm i https://pkg.pr.new/@prisma-next/sql-errors@595

@prisma-next/sql-operations

npm i https://pkg.pr.new/@prisma-next/sql-operations@595

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/@prisma-next/sql-schema-ir@595

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/@prisma-next/sql-contract-psl@595

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/@prisma-next/sql-contract-ts@595

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/@prisma-next/sql-contract-emitter@595

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/@prisma-next/sql-lane-query-builder@595

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/@prisma-next/sql-relational-core@595

@prisma-next/sql-builder

npm i https://pkg.pr.new/@prisma-next/sql-builder@595

@prisma-next/target-postgres

npm i https://pkg.pr.new/@prisma-next/target-postgres@595

@prisma-next/target-sqlite

npm i https://pkg.pr.new/@prisma-next/target-sqlite@595

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/@prisma-next/adapter-postgres@595

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/@prisma-next/adapter-sqlite@595

@prisma-next/driver-postgres

npm i https://pkg.pr.new/@prisma-next/driver-postgres@595

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/@prisma-next/driver-sqlite@595

commit: 82913d7

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts (1)

27-27: ⚡ Quick win

Use ifDefined() for conditional spread in the contract helper.

Line 27 uses an inline conditional spread; please switch this to ifDefined(...) for consistency with repo conventions.

Suggested change
+import { ifDefined } from '`@prisma-next/utils/defined`';
...
   const unboundNs: SqlNamespaceTablesInput = {
     id: UNBOUND_NAMESPACE_ID,
     tables: overrides.tables ?? {},
-    ...(overrides.enum !== undefined ? { enum: overrides.enum } : {}),
+    ...ifDefined(overrides.enum, (value) => ({ enum: value })),
   };

As per coding guidelines: "Use ifDefined() from @prisma-next/utils/defined for conditional object spreads instead of inline conditional spread patterns".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts`
at line 27, Replace the inline conditional spread "(...(overrides.enum !==
undefined ? { enum: overrides.enum } : {}))" in the contract helper with the
repository-standard ifDefined(...) helper: import ifDefined from
'`@prisma-next/utils/defined`' (or the named export used in the repo) and spread
...ifDefined({ enum: overrides.enum }) instead; this keeps behavior identical
but follows the project's conditional-spread convention and uses the helper
wherever the overrides.enum conditional currently appears.
packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts (1)

106-109: ⚡ Quick win

Prefer ifDefined() for the optional enum spread.

This block uses the inline ternary spread pattern the package guidelines ask us to avoid.

As per coding guidelines, "Always use ifDefined() from @prisma-next/utils/defined for conditional object spreads instead of inline conditional spread patterns."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts`
around lines 106 - 109, The object construction returning new PostgresSchema
uses an inline ternary spread for the optional enum field (hydratedNsEnums);
replace that pattern with ifDefined(hydratedNsEnums) from
`@prisma-next/utils/defined` so the spread becomes conditional via the utility.
Update the return in the PostgresSchema creation (the block that currently
spreads ...(hydratedNsEnums !== undefined ? { enum: hydratedNsEnums } : {})) to
instead use ifDefined(hydratedNsEnums) so the enum property is only added when
defined.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts`:
- Around line 193-199: hydrateSqlNamespaceEntry currently reconstructs the
namespace return value using only id, tables and enum, dropping any other
hydrated slots stored in result; change the return to preserve all other keys
from result by extracting tables and enumSlot from result and spreading the
remaining entries (e.g. otherSlots) into the returned object alongside id,
tables and enum when present so arbitrary object-valued slots survive
deserialization and round-trips.

---

Nitpick comments:
In
`@packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts`:
- Around line 106-109: The object construction returning new PostgresSchema uses
an inline ternary spread for the optional enum field (hydratedNsEnums); replace
that pattern with ifDefined(hydratedNsEnums) from `@prisma-next/utils/defined` so
the spread becomes conditional via the utility. Update the return in the
PostgresSchema creation (the block that currently spreads ...(hydratedNsEnums
!== undefined ? { enum: hydratedNsEnums } : {})) to instead use
ifDefined(hydratedNsEnums) so the enum property is only added when defined.

In `@packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts`:
- Line 27: Replace the inline conditional spread "(...(overrides.enum !==
undefined ? { enum: overrides.enum } : {}))" in the contract helper with the
repository-standard ifDefined(...) helper: import ifDefined from
'`@prisma-next/utils/defined`' (or the named export used in the repo) and spread
...ifDefined({ enum: overrides.enum }) instead; this keeps behavior identical
but follows the project's conditional-spread convention and uses the helper
wherever the overrides.enum conditional currently appears.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 34cc5497-32ba-4f17-8591-61a3b35ac7c6

📥 Commits

Reviewing files that changed from the base of the PR and between 5b075bd and 3394cbf.

⛔ Files ignored due to path filters (5)
  • projects/contract-ir-planes/slices/enum-migration/dispatches/01-source-migration.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/enum-migration/dispatches/02-fixture-regen.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/enum-migration/dispatches/03-grep-and-pr.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/enum-migration/plan.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/enum-migration/spec.md is excluded by !projects/**
📒 Files selected for processing (33)
  • drive/retro/findings.md
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.json
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • packages/1-framework/1-core/framework-components/src/ir/ir-node.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage-type.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.types.test.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.contract-definition.test.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
  • packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json
  • packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/3-targets/3-targets/postgres/test/snapshot-read-shapes.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.storage-types.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/schema-verify.after-runner.integration.test.ts
  • test/integration/test/authoring/parity/core-surface/expected.contract.json

wmadden added a commit that referenced this pull request May 26, 2026
CodeRabbit (PR #595) caught: hydrateSqlNamespaceEntry's generic loop
populates result with arbitrary contributed slots, but the return only
forwarded id/tables/enum — any future pack-contributed slot would be
silently dropped on hydration. Spread ...result so all hydrated slots
survive, keeping explicit tables/enum overrides for the typed shape.

Refs: #595 (comment)
Signed-off-by: Will Madden <[email protected]>
wmadden added 11 commits May 26, 2026 22:39
…ared types slot

Slice S1.B settles the hard-cut migration design that proves the S1.A
substrate works: Postgres enum moves from storage.namespaces.<ns>.types
(framework-shared) to storage.namespaces.<ns>.enum (pack-contributed via
the descriptor mechanism). PDoD3 from the parent project spec gets
satisfied at the end of this slice.

A6 confirmed by operator 2026-05-22: no off-repo EA consumer pins
contract.json shape or storageHash literals across the npm minor, so the
slice ships as a single hard-cut PR (no deprecation-shim sub-slice
composition required).

Spec embeds the project-plan Risk #5 mitigation as a Per-dispatch DoR
overlay: every brief assembled within the slice answers (a) the
non-redundancy question for any new public-surface field and (b) the
enforcement-beyond-hydration question for any new identity-encoding
framework structure, before locking decisions. Spec-level answers for
the six surfaces the slice already knows it touches are tabulated;
briefs may refine but must not contradict.

Fold/defer decisions on the five cleanup tickets surfaced during S1.A:

- TML-2658 (NamespaceRawSchema +: ignore nit) folds into D1 family-sql
  touch — one-line change in the same file as enum slot hydration.
- TML-2654 (executeContractEmit pipeline) stays standalone — different
  code path from S1.B emitter codegen, folding would expand scope.
- TML-2634 (plural slot rename), TML-2636 (.entries redirect),
  TML-2648 (SQLite kind materialization) all defer — no overlap with
  enum slot migration, best landed after S1 closes.

Next: drive-plan-slice decomposes the spec into dispatches.

Refs TML-2623.

Signed-off-by: Will Madden <[email protected]>
…e PR

D1 (M, Composer-2.5) hard-cuts the source surface: IR typing, validator,
serializer hydration + folded TML-2658, verifier, emitter codegen,
authoring lowering, and Postgres target read/write paths — document-
scoped storage.types preserved as out-of-scope guard. fixtures:check is
explicitly a non-gate for D1; expected to fail until D2 runs. Re-
decomposition trigger at >25 package files or >30-file typecheck cascade
splits into D1a (contract IR + family) + D1b (authoring + postgres
target).

D2 (M, Composer-2.5) grep-audits enum-bearing committed contracts, runs
pnpm fixtures:emit, gates on pnpm fixtures:check, and runs the A4
migration-replay probe on pre-#534 bookends. Bookend regen is
conditional on replay falsification; if A4 needs >3 source files the
dispatch halts (promote per spec edge #12).

D3 (S, Composer-2.5) closes the slice: PDoD3 grep gate, SDoD2 edge-case
disposition audit, SDoD7 TML-2658 verification, and the full slice
validation gate (typecheck, test:packages, test:integration,
fixtures:check, lint:deps). No implementation changes expected; >3
straggler files routes failure back to D1 or D2 rather than band-aiding
in D3.

Risk #5 (Per-dispatch DoR overlay) is wired per-dispatch with explicit
brief-assembly discipline drawn from drive/retro/findings.md 2026-05-21:
do not lift spec table rows into a "do not relitigate" block without
the (a) non-redundancy justification per row; default stance for S1.B
is retire framework-encoded Postgres identity, do not add parallel
slot registries; if (b) answer is "hydration/validation already enforce
this", the dispatch must not introduce that structure.

Each dispatch carries refusal triggers naming F1 (no read-fallback
shim), F5 (no destructive git), F6 (no redundant descriptor fields),
F7 (no unbriefed-blocker workarounds) from drive/calibration/
failure-modes.md. Hard-cut path is preserved.

Refs TML-2623.

Signed-off-by: Will Madden <[email protected]>
D1 walks Risk #5 (a)+(b) per surface (all eight subtractive); enumerates
the 4-package source migration; pins the descriptor surface as unchanged;
makes pnpm fixtures:check an explicit non-gate for D1 (D2 regenerates).
Composer-2.5; ~15-22 files; >25-file or >30-cascade trigger splits D1 → D1a+D1b.

TML-2623

Signed-off-by: Will Madden <[email protected]>
Move Postgres enum entries to storage.namespaces[ns].enum across IR
typing, validation, serializer hydration, emitter codegen, authoring
lowering, and postgres target read paths. Delete the framework-shared
namespace types slot with no read-fallback. Fold TML-2658 explicit
'+': 'ignore' on NamespaceRawSchema.

Pre-flight grep inventory (step 1):
- packages/3-targets/3-targets/postgres/src/exports/types.ts
- packages/2-sql/5-runtime/src/sql-context.ts (no edit — comment only)
- packages/3-targets/3-targets/postgres/src/core/authoring.ts (no edit)
- packages/3-targets/3-targets/postgres/src/core/postgres-enum-type.ts (no edit)
- packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
- packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
- packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-ddl-builders.ts (no edit)
- packages/3-targets/3-targets/postgres/test/snapshot-read-shapes.test.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-sql-checks.ts (no edit)
- packages/2-sql/1-core/contract/src/validators.ts
- packages/2-sql/1-core/contract/src/types.ts (no edit)
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-type-resolution.ts (no edit)
- packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
- packages/2-sql/1-core/contract/src/exports/types.ts (no edit)
- packages/2-sql/3-tooling/emitter/src/index.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-recipes.ts (no edit)
- packages/3-targets/3-targets/postgres/src/core/migrations/enum-planning.ts (no edit)
- packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts
- packages/3-targets/3-targets/postgres/src/core/migrations/planner-identity-values.ts (no edit)
- packages/2-sql/1-core/contract/src/ir/storage-type-instance.ts (no edit)
- packages/2-sql/1-core/contract/test/sql-storage.test.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
- packages/2-sql/1-core/contract/src/ir/sql-storage.ts
- packages/2-sql/1-core/contract/vitest.config.ts (no edit)
- packages/2-sql/1-core/contract/src/ir/postgres-enum-storage-entry.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/contract-lowering.ts (no edit)
- packages/2-sql/1-core/contract/src/ir/sql-node.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/contract-warnings.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
- packages/2-sql/9-family/src/core/control-adapter.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/contract-builder.ts (no edit)
- packages/2-sql/2-authoring/contract-psl/src/interpreter.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/test/contract-builder.contract-definition.test.ts
- packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
- packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
- packages/2-sql/2-authoring/contract-psl/test/interpreter.extensions.test.ts (no edit)
- packages/2-sql/2-authoring/contract-psl/test/fixtures.ts (no edit)
- packages/2-sql/2-authoring/contract-ts/src/contract-dsl.ts (no edit)
- packages/2-sql/2-authoring/contract-psl/test/interpreter.types.test.ts
- packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
- packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
- packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
- packages/3-targets/6-adapters/postgres/test/migrations/*.integration.test.ts (typecheck cascade)

Surprise files outside brief table (grep-bounded, reported):
- codec-ref-for-column.ts, contract-to-schema-ir.ts, adapter-postgres integration tests

Signed-off-by: Will Madden <[email protected]>
D1 post-flight surfaced that SDoD6 added PostgresEnumStorageEntry to a
project-PDoD3 pattern that only audits literal 'postgres-enum' \
discriminator paths. The type-import bridging in family-sql is a separate
descriptor-driven verifier scope (filed as TML-2667); D1 satisfies the
corrected gate. Folds 2-line JSDoc cleanup into D2.

TML-2623 TML-2667

Signed-off-by: Will Madden <[email protected]>
…st fold-ins

Pure regen + verification dispatch. Reverts D1 test workaround
(snapshot-read-shapes.test.ts skip-paths + inline JSON) once on-disk
fixtures regen. Folds 2-line JSDoc cleanup per D1 reviewer signal.
A4 replay probe documented as binary outcome (PASS or REGEN+rationale).
Composer-2.5; no source changes beyond 2 JSDoc lines (F7 halt otherwise).

TML-2623

Signed-off-by: Will Madden <[email protected]>
Pre-flight grep inventory (postgres-enum in contract.json / *.json):
- examples/prisma-next-demo/src/prisma/contract.json
- examples/prisma-next-cloudflare-worker/src/prisma/contract.json
- packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json
- test/integration/test/authoring/parity/core-surface/expected.contract.json
- examples/prisma-next-demo/migrations/app/20260422T0720_initial/end-contract.json
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/end-contract.json
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/end-contract.json
- examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/end-contract.json
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/start-contract.json
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/start-contract.json
- examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/start-contract.json

Regenerated enum-bearing fixtures via pnpm fixtures:emit (and parity
UPDATE_AUTHORING_PARITY_EXPECTED=1). postgres-enum.json via serializer
round-trip. Reverted snapshot-read-shapes.test.ts D1 workaround.

A4 PASS: pre-#534 bookends retain document-scoped storage.types enums;
strict deserialize of bookends fails identically pre-D1 (0339f34^)
and post-D2 — no replay regression from namespace enum slot migration.
Bookends not regenerated.

JSDoc: ir-node.ts uses 'pack-contributed-kind'; storage-type.ts uses '<kind>'.
Signed-off-by: Will Madden <[email protected]>
…-app importer

D2 (9cebc27) accidentally committed an importer for a temp test-app
directory that no longer exists on disk, plus its transitive
@prisma-next/*@0.10.0 published-package resolutions. pnpm install
reconciles the lockfile against on-disk package.json files; the importer
and its closure drop out.

Signed-off-by: Will Madden <[email protected]>
D3 closes the slice: PDoD3 grep + slice validation + PR open. Pure
verification + PR assembly; zero source changes; halt-and-route on any
gate failure. Operator preference encoded in PR-body outline (lead with
decisions, end with alternatives).

Retro (2nd instance of 2026-05-21 stale-dist hygiene): both D2-R2
implementer and D2 reviewer false-failed pnpm typecheck despite explicit
brief guidance to run pnpm build first. Brief-text mitigation insufficient;
proposed runner-script + brief-template fixes.

TML-2623

Signed-off-by: Will Madden <[email protected]>
CodeRabbit (PR #595) caught: hydrateSqlNamespaceEntry's generic loop
populates result with arbitrary contributed slots, but the return only
forwarded id/tables/enum — any future pack-contributed slot would be
silently dropped on hydration. Spread ...result so all hydrated slots
survive, keeping explicit tables/enum overrides for the typed shape.

Refs: #595 (comment)
Signed-off-by: Will Madden <[email protected]>
…um slot

D1's source hard-cut missed three PSL-interpreter test-fixture
assertions that still expected the legacy storage.namespaces.<ns>.types
shape for Postgres enums. Renamed the namespace-scoped 'types:' key to
'enum:' in each toMatchObject block. Top-level storage.types (document-
scoped, holds Email / Embedding1536) is intentionally preserved per
project scope.

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden force-pushed the tml-2623-s1b-enum-migration branch from 6070467 to 7f07c53 Compare May 26, 2026 20:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts`:
- Around line 136-138: The planner currently looks up enums by bare typeName
across all namespaces (see the enum access using ns.enum and typeName which
returns PostgresEnumStorageEntry), causing collisions; update the enum lookup,
collection and all enum-related planner functions (lookup, diff, and operation
construction) to accept and use namespaceId so you scope keys by namespace
(e.g., use a compound key or index by namespaceId then typeName) instead of
name-only, thread namespaceId through the functions that reference ns.enum /
PostgresEnumStorageEntry (the places around the current typeName lookup and the
corresponding collection sites referenced in the diff) and ensure enum diffing
and operation construction use the namespace-aware entry to avoid
cross-namespace overwrites.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 00a6b49a-6264-4b98-ab9c-5a9d42e40f7f

📥 Commits

Reviewing files that changed from the base of the PR and between 3394cbf and 7f07c53.

📒 Files selected for processing (31)
  • drive/retro/findings.md
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.json
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • packages/1-framework/1-core/framework-components/src/ir/ir-node.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage-type.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.extensions.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.types.test.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.contract-definition.test.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
  • packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json
  • packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/3-targets/3-targets/postgres/test/snapshot-read-shapes.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
✅ Files skipped from review due to trivial changes (7)
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage-type.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
  • packages/1-framework/1-core/framework-components/src/ir/ir-node.ts
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.json

Spec + plan for S1.E: namespace-aware enum planning (TML-2686).
Follow-on correctness fix surfaced by CodeRabbit on PR #595 — the
Postgres migration planner keys enum lookups by bare TypeScript name
across namespaces, so two namespaces holding enum.<sameName> collide
silently. Pre-existing bug, surfaced by S1.B's slot rename touching
the line.

Sized L per drive/calibration/sizing.md; decomposed into 5 dispatches
(M/M/M/S/S). Sequenced after S1.D per operator decision (could
parallelise with S1.C/D but reviewer attention stays on the critical
path until the structural slices close).

Project plan adjustments:
- At-a-glance: four → five slices
- New S1.E section under Stack with Purpose/Dispatches/Scope/Linear
- Parallel groups: extended stack thread + sequencing rationale
- Sequencing visualisation: S1.E node added
- Realistic budget: × 4 structural + ~0.5 day S1.E = ~10.5-12.5 days
- PDoD1 row: 4 → 5 slices (no new PDoD added; S1.E satisfies none)
- Risk #6: SchemaIssue shape blast radius (goldens regen at D4)

No commits to follow on this branch — slice execution starts after S1.D
closes. Documenting here so the deferred follow-up is discoverable.

Linear: TML-2686 (relatedTo TML-2584 parent project; relatedTo TML-2623
S1.B PR that surfaced this).

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden merged commit 89bcd61 into main May 27, 2026
16 checks passed
wmadden added a commit that referenced this pull request May 27, 2026
CodeRabbit (PR #595) caught: hydrateSqlNamespaceEntry's generic loop
populates result with arbitrary contributed slots, but the return only
forwarded id/tables/enum — any future pack-contributed slot would be
silently dropped on hydration. Spread ...result so all hydrated slots
survive, keeping explicit tables/enum overrides for the typed shape.

Refs: #595 (comment)
Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden deleted the tml-2623-s1b-enum-migration branch May 27, 2026 09:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant