This repository was archived by the owner on Nov 25, 2026. It is now read-only.
Repository navigation
Package layering - #2
Merged
Merged
Conversation
…pace, initial attempt
…e relative paths otherwise TS can't resolve the package root
3 tasks
jkomyno
added a commit
that referenced
this pull request
May 4, 2026
The `Embedding.profile` column has been in the e2e fixture since the
arktype-json landing but no test ever wrote or read it — which is why
the runtime cast lookup gap and the JSON.parse decode mismatch slipped
through. Add direct coverage:
1. Happy round-trip — `Embedding.create({ profile: { ... } })` followed
by a where-eq read. Exercises the full encode path (schema validate
→ JSON.stringify → SQL renderer cast lookup → driver write) and the
full decode path (driver read with pre-parsed jsonb → schema validate
→ ORM result).
2. Schema rejection on write — confirms `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED`
surfaces unchanged through the encode-side rethrow guard.
Decode-side rejection is already covered by the unit test in
sql-runtime/test/json-schema-validation.test.ts; not duplicated here.
Refs #418 self-review (subideal item #2).
jkomyno
added a commit
that referenced
this pull request
May 4, 2026
Postgres `pg` returns `jsonb` cells as already-parsed JS values by default. The arktype-json codec was hardcoded to `JSON.parse(wire)` and would SyntaxError on every read where the driver pre-parsed. Mirror `pgJsonbCodec`'s `string | JsonValue` tolerance so selects against arktypeJson columns work end-to-end. Widens `ArktypeJsonCodec`'s `TWire` from `string` to `string | JsonValue` to match the runtime tolerance. Adds two test cases covering both wire shapes for `decode`. Refs #402 review (P1 #2).
jkomyno
added a commit
that referenced
this pull request
May 4, 2026
The `Embedding.profile` column has been in the e2e fixture since the
arktype-json landing but no test ever wrote or read it — which is why
the runtime cast lookup gap and the JSON.parse decode mismatch slipped
through. Add direct coverage:
1. Happy round-trip — `Embedding.create({ profile: { ... } })` followed
by a where-eq read. Exercises the full encode path (schema validate
→ JSON.stringify → SQL renderer cast lookup → driver write) and the
full decode path (driver read with pre-parsed jsonb → schema validate
→ ORM result).
2. Schema rejection on write — confirms `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED`
surfaces unchanged through the encode-side rethrow guard.
Decode-side rejection is already covered by the unit test in
sql-runtime/test/json-schema-validation.test.ts; not duplicated here.
Refs #418 self-review (subideal item #2).
saevarb
pushed a commit
that referenced
this pull request
May 5, 2026
Will flagged three places in his review where I claimed `migration verify`
was the integrity gate. The command doesn't exist — manifest integrity
runs at load time in readMigrationPackage (re-derive providedInvariants
from ops.json + recompute migrationHash). Self-review of all our edits
turned up additional issues, mostly clustered in ADR 208's §"At a glance"
example.
ADR 208 §"At a glance" example:
- this.dataTransform(endContract, name, options) — was 2-arg
dataTransform(name, options), which doesn't exist on Postgres.
- check / run closures take no parameters and return SqlQueryPlan |
Buildable. Was check: db => ... / run: db => ..., neither shape exists.
- addColumn requires defaultSql in ColumnSpec — was missing.
- Made the example explicitly schematic ("query bodies elided") since the
full SQL DSL surface isn't relevant to the routing story.
- Migration class needs describe() and the bottom MigrationCLI.run(...)
to be a complete authored migration; both added.
ADR 208 §"At a glance" prose:
- "MIGRATION.UNKNOWN_INVARIANT before any database activity" was wrong;
the check now runs after client.connect + readMarker (per the post-#404
fix that defers the check until marker.invariants is available).
- "no migration provides" was incomplete; the actual rule checks
declared ∪ marker.invariants, so an id from a retired migration that
the marker still has does not fail UNKNOWN_INVARIANT.
- Replaced the fictitious "→ prod / required / applied / missing /
route" output box with prose; the box doesn't match real apply output.
ADR 208 §"Manifest aggregate" / §"Plan envelope" / §"Alternatives":
- All three referenced `migration verify`. Replaced with "load-time
integrity check" or equivalent.
ADR 169 §3 (Will's #1): "The migration `verify` step ..." → "When a
migration is loaded from disk, the loader ..."
ADR 192 (Will's #2): "at verify time" → "at load time"
jkomyno
added a commit
that referenced
this pull request
May 8, 2026
…-less reload Resolves todos #2-#6 from the PR #440 multi-agent review: * #2 — Add unit tests for the new returning-capability requirement on updateCount() / deleteCount(). Both throw with an explanatory message when the contract lacks the returning capability, locking the breaking-change behavior introduced in M1. * #3 — Pass a single trivial column to compileUpdateReturning / compileDeleteReturning in updateCount() / deleteCount() instead of the previous undefined (which expanded to "every column"). New helper pickCountReturningColumn() in collection-contract.ts prefers the first PK column when present (always non-null) and falls back to any storage column for id-less tables. * #4 — Stream-count the RETURNING result instead of materializing the full row buffer via .toArray(). Both count helpers now use for-await + counter, dropping memory cost from O(N×W) to O(1). * #5 — Add integration test covering the id-less mutation reload code path: nested update() on an id-less Users contract (PK stripped, UNIQUE (email) retained) routes through buildRowIdentityCriterion id-less branch and reloads the row via the row-identity criterion. New createIdlessUsersCollection helper. * #6 — Remove dead code: compileDeleteCount has no callers post-M1. Drops the function from query-plan-mutations.ts, the export from query-plan.ts, and the corresponding test fixture. Mark todos 002-006 as complete in the todos/ directory.
wmadden
added a commit
that referenced
this pull request
May 12, 2026
Captures the design pass driven by the example-app forcing function: - decisions.md: canonical decision log (A1-A7 TS authoring, B1-B6 PSL authoring, C1-C8 cross-cutting). Records the closes on holes #1, #2, #3, #4, #5, #15, #16, #17 and the elevation of roles/posture/extension structure to first-class concepts. - design-holes.md: marks resolved holes against decisions, updates the blocking-holes summary table. - rls.md: rewritten to the .rls([...]) array form (TS) and top-level policy <name> { key = value } blocks (PSL), with ref() helper semantics documented. - overview.md: refreshed at-a-glance snippet, capability bullets, stretch goals to align with the array-of-descriptors RLS surface and the out-of-scope-for-v0.1 framing of functions-as-IR. - example/src/prisma/contract.ts: rewritten to exercise the settled surface (composite uniques in .attributes(), .rls([...]) descriptor array, ref() helper for cross-model predicates, no capability flag). - extension-package.md, posture.md, README.md: cross-reference updates pointing at decisions.md and reflecting the role IR + subpath entrypoint decisions.
wmadden
added a commit
that referenced
this pull request
May 13, 2026
Captures the design pass driven by the example-app forcing function: - decisions.md: canonical decision log (A1-A7 TS authoring, B1-B6 PSL authoring, C1-C8 cross-cutting). Records the closes on holes #1, #2, #3, #4, #5, #15, #16, #17 and the elevation of roles/posture/extension structure to first-class concepts. - design-holes.md: marks resolved holes against decisions, updates the blocking-holes summary table. - rls.md: rewritten to the .rls([...]) array form (TS) and top-level policy <name> { key = value } blocks (PSL), with ref() helper semantics documented. - overview.md: refreshed at-a-glance snippet, capability bullets, stretch goals to align with the array-of-descriptors RLS surface and the out-of-scope-for-v0.1 framing of functions-as-IR. - example/src/prisma/contract.ts: rewritten to exercise the settled surface (composite uniques in .attributes(), .rls([...]) descriptor array, ref() helper for cross-model predicates, no capability flag). - extension-package.md, posture.md, README.md: cross-reference updates pointing at decisions.md and reflecting the role IR + subpath entrypoint decisions.
wmadden
added a commit
that referenced
this pull request
May 13, 2026
Captures the design pass driven by the example-app forcing function: - decisions.md: canonical decision log (A1-A7 TS authoring, B1-B6 PSL authoring, C1-C8 cross-cutting). Records the closes on holes #1, #2, #3, #4, #5, #15, #16, #17 and the elevation of roles/posture/extension structure to first-class concepts. - design-holes.md: marks resolved holes against decisions, updates the blocking-holes summary table. - rls.md: rewritten to the .rls([...]) array form (TS) and top-level policy <name> { key = value } blocks (PSL), with ref() helper semantics documented. - overview.md: refreshed at-a-glance snippet, capability bullets, stretch goals to align with the array-of-descriptors RLS surface and the out-of-scope-for-v0.1 framing of functions-as-IR. - example/src/prisma/contract.ts: rewritten to exercise the settled surface (composite uniques in .attributes(), .rls([...]) descriptor array, ref() helper for cross-model predicates, no capability flag). - extension-package.md, posture.md, README.md: cross-reference updates pointing at decisions.md and reflecting the role IR + subpath entrypoint decisions. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 13, 2026
Captures the design pass driven by the example-app forcing function: - decisions.md: canonical decision log (A1-A7 TS authoring, B1-B6 PSL authoring, C1-C8 cross-cutting). Records the closes on holes #1, #2, #3, #4, #5, #15, #16, #17 and the elevation of roles/posture/extension structure to first-class concepts. - design-holes.md: marks resolved holes against decisions, updates the blocking-holes summary table. - rls.md: rewritten to the .rls([...]) array form (TS) and top-level policy <name> { key = value } blocks (PSL), with ref() helper semantics documented. - overview.md: refreshed at-a-glance snippet, capability bullets, stretch goals to align with the array-of-descriptors RLS surface and the out-of-scope-for-v0.1 framing of functions-as-IR. - example/src/prisma/contract.ts: rewritten to exercise the settled surface (composite uniques in .attributes(), .rls([...]) descriptor array, ref() helper for cross-model predicates, no capability flag). - extension-package.md, posture.md, README.md: cross-reference updates pointing at decisions.md and reflecting the role IR + subpath entrypoint decisions. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 13, 2026
Captures the design pass driven by the example-app forcing function: - decisions.md: canonical decision log (A1-A7 TS authoring, B1-B6 PSL authoring, C1-C8 cross-cutting). Records the closes on holes #1, #2, #3, #4, #5, #15, #16, #17 and the elevation of roles/posture/extension structure to first-class concepts. - design-holes.md: marks resolved holes against decisions, updates the blocking-holes summary table. - rls.md: rewritten to the .rls([...]) array form (TS) and top-level policy <name> { key = value } blocks (PSL), with ref() helper semantics documented. - overview.md: refreshed at-a-glance snippet, capability bullets, stretch goals to align with the array-of-descriptors RLS surface and the out-of-scope-for-v0.1 framing of functions-as-IR. - example/src/prisma/contract.ts: rewritten to exercise the settled surface (composite uniques in .attributes(), .rls([...]) descriptor array, ref() helper for cross-model predicates, no capability flag). - extension-package.md, posture.md, README.md: cross-reference updates pointing at decisions.md and reflecting the role IR + subpath entrypoint decisions. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 19, 2026
…scope DoD previously lumped CI gates and intent-validation under a single "validation gates" category, leaving manual QA implicit. Per PR #93 (prisma/ignite), drive-qa-plan and drive-qa-run are the canonical manual-QA discipline; the gate they enforce closes a class of gaps neither CI nor intent-validation can reach (diagnostic clarity, end-to-end developer journey, original-bug re-enactment, gate-of-gate sanity, exploratory probing). Add a "Three gates" framing section, slice-DoD + project-DoD items requiring a drive-qa-plan script + drive-qa-run report whenever the change touches user-observable surface (or explicit N/A for pure-refactor slices), updated templates, broadened anti-pattern #2 from "validation-gates only" to "CI-gates only", and reference drive-qa-plan / drive-qa-run / drive/qa/README.md in the Related principles section. Assumes PR #93 as base.
wmadden
added a commit
that referenced
this pull request
May 19, 2026
…scope DoD previously lumped CI gates and intent-validation under a single "validation gates" category, leaving manual QA implicit. Per PR #93 (prisma/ignite), drive-qa-plan and drive-qa-run are the canonical manual-QA discipline; the gate they enforce closes a class of gaps neither CI nor intent-validation can reach (diagnostic clarity, end-to-end developer journey, original-bug re-enactment, gate-of-gate sanity, exploratory probing). Add a "Three gates" framing section, slice-DoD + project-DoD items requiring a drive-qa-plan script + drive-qa-run report whenever the change touches user-observable surface (or explicit N/A for pure-refactor slices), updated templates, broadened anti-pattern #2 from "validation-gates only" to "CI-gates only", and reference drive-qa-plan / drive-qa-run / drive/qa/README.md in the Related principles section. Assumes PR #93 as base. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 19, 2026
…scope DoD previously lumped CI gates and intent-validation under a single "validation gates" category, leaving manual QA implicit. Per PR #93 (prisma/ignite), drive-qa-plan and drive-qa-run are the canonical manual-QA discipline; the gate they enforce closes a class of gaps neither CI nor intent-validation can reach (diagnostic clarity, end-to-end developer journey, original-bug re-enactment, gate-of-gate sanity, exploratory probing). Add a "Three gates" framing section, slice-DoD + project-DoD items requiring a drive-qa-plan script + drive-qa-run report whenever the change touches user-observable surface (or explicit N/A for pure-refactor slices), updated templates, broadened anti-pattern #2 from "validation-gates only" to "CI-gates only", and reference drive-qa-plan / drive-qa-run / drive/qa/README.md in the Related principles section. Assumes PR #93 as base. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 19, 2026
…scope DoD previously lumped CI gates and intent-validation under a single "validation gates" category, leaving manual QA implicit. Per PR #93 (prisma/ignite), drive-qa-plan and drive-qa-run are the canonical manual-QA discipline; the gate they enforce closes a class of gaps neither CI nor intent-validation can reach (diagnostic clarity, end-to-end developer journey, original-bug re-enactment, gate-of-gate sanity, exploratory probing). Add a "Three gates" framing section, slice-DoD + project-DoD items requiring a drive-qa-plan script + drive-qa-run report whenever the change touches user-observable surface (or explicit N/A for pure-refactor slices), updated templates, broadened anti-pattern #2 from "validation-gates only" to "CI-gates only", and reference drive-qa-plan / drive-qa-run / drive/qa/README.md in the Related principles section. Assumes PR #93 as base. Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 27, 2026
… S1.E OQ#2
S1.C kickoff — slice spec + plan for the cross-reference encoding
migration (TML-2624). Object-pair encoding (`{ namespace, model }`)
replaces string-keyed `relation.to` / `model.base` / `roots[*]`; PDoD4
satisfaction point; subsumes TML-2586 (FK NamespaceId shape).
Decomposed into 3 dispatches (M/M/M) vs the project plan's working
position of 2 — slice sizing landed at M-borderline-L, three-dispatch
shape keeps D1 and D2 under the M-cap. D1 framework shape + validators
+ family serializer hydration / D2 family lowering + emitter typegen +
downstream consumers / D3 fixture regen + A4 replay + grep gate + slice
validation. Each dispatch carries explicit re-decomposition triggers,
the lockfile-cruft refusal trigger, and the stale-dist hygiene pre-flight
(both inherited from S1.B retro lessons).
Pre-audit subsection in the slice spec investigates the column→enum
reference resolution path (operator-directed during spec authoring,
to close S1.E Open Question #2). Verdict: `column.typeRef === typeName`
walk at `planner-strategies.ts:384–394` (enumRebuildCallRecipe) uses
bare-string matching across all namespaces — identical collision shape
to the enum-lookup helpers S1.E is fixing. S1.C does NOT change
`column.typeRef` shape; S1.E D2 absorbs the fix as a single namespace-
narrow filter (`column.typeRef === typeName && nsId === sourceNamespaceId`).
S1.E spec + plan back-propagated:
- Spec OQ#2: rewritten as Resolved 2026-05-27 with audit finding +
disposition + cross-link to S1.C pre-audit subsection.
- Plan D2: intent rewritten to name the column-ref narrowing as
in-scope; Files-in-play row de-conditionalised with file+line
anchor; Done-when carries the explicit filter shape; D4 done-when
augmented with a cross-namespace column→enum binding regression
test (audit.log_entry.priority vs public.post.status on same enum
name, distinct namespaces).
- Sizing unchanged (D2 still M; absorbed via one filter clause).
Linear: TML-2624 (Canceled 2026-05-20 per project convention; still
referenced for traceability — same pattern as S1.A/S1.B). Tracking
via parent project TML-2584.
Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 27, 2026
… S1.E OQ#2
S1.C kickoff — slice spec + plan for the cross-reference encoding
migration (TML-2624). Object-pair encoding (`{ namespace, model }`)
replaces string-keyed `relation.to` / `model.base` / `roots[*]`; PDoD4
satisfaction point; subsumes TML-2586 (FK NamespaceId shape).
Decomposed into 3 dispatches (M/M/M) vs the project plan's working
position of 2 — slice sizing landed at M-borderline-L, three-dispatch
shape keeps D1 and D2 under the M-cap. D1 framework shape + validators
+ family serializer hydration / D2 family lowering + emitter typegen +
downstream consumers / D3 fixture regen + A4 replay + grep gate + slice
validation. Each dispatch carries explicit re-decomposition triggers,
the lockfile-cruft refusal trigger, and the stale-dist hygiene pre-flight
(both inherited from S1.B retro lessons).
Pre-audit subsection in the slice spec investigates the column→enum
reference resolution path (operator-directed during spec authoring,
to close S1.E Open Question #2). Verdict: `column.typeRef === typeName`
walk at `planner-strategies.ts:384–394` (enumRebuildCallRecipe) uses
bare-string matching across all namespaces — identical collision shape
to the enum-lookup helpers S1.E is fixing. S1.C does NOT change
`column.typeRef` shape; S1.E D2 absorbs the fix as a single namespace-
narrow filter (`column.typeRef === typeName && nsId === sourceNamespaceId`).
S1.E spec + plan back-propagated:
- Spec OQ#2: rewritten as Resolved 2026-05-27 with audit finding +
disposition + cross-link to S1.C pre-audit subsection.
- Plan D2: intent rewritten to name the column-ref narrowing as
in-scope; Files-in-play row de-conditionalised with file+line
anchor; Done-when carries the explicit filter shape; D4 done-when
augmented with a cross-namespace column→enum binding regression
test (audit.log_entry.priority vs public.post.status on same enum
name, distinct namespaces).
- Sizing unchanged (D2 still M; absorbed via one filter clause).
Linear: TML-2624 (Canceled 2026-05-20 per project convention; still
referenced for traceability — same pattern as S1.A/S1.B). Tracking
via parent project TML-2584.
Signed-off-by: Will Madden <[email protected]>
wmadden
added a commit
that referenced
this pull request
May 28, 2026
… S1.E OQ#2
S1.C kickoff — slice spec + plan for the cross-reference encoding
migration (TML-2624). Object-pair encoding (`{ namespace, model }`)
replaces string-keyed `relation.to` / `model.base` / `roots[*]`; PDoD4
satisfaction point; subsumes TML-2586 (FK NamespaceId shape).
Decomposed into 3 dispatches (M/M/M) vs the project plan's working
position of 2 — slice sizing landed at M-borderline-L, three-dispatch
shape keeps D1 and D2 under the M-cap. D1 framework shape + validators
+ family serializer hydration / D2 family lowering + emitter typegen +
downstream consumers / D3 fixture regen + A4 replay + grep gate + slice
validation. Each dispatch carries explicit re-decomposition triggers,
the lockfile-cruft refusal trigger, and the stale-dist hygiene pre-flight
(both inherited from S1.B retro lessons).
Pre-audit subsection in the slice spec investigates the column→enum
reference resolution path (operator-directed during spec authoring,
to close S1.E Open Question #2). Verdict: `column.typeRef === typeName`
walk at `planner-strategies.ts:384–394` (enumRebuildCallRecipe) uses
bare-string matching across all namespaces — identical collision shape
to the enum-lookup helpers S1.E is fixing. S1.C does NOT change
`column.typeRef` shape; S1.E D2 absorbs the fix as a single namespace-
narrow filter (`column.typeRef === typeName && nsId === sourceNamespaceId`).
S1.E spec + plan back-propagated:
- Spec OQ#2: rewritten as Resolved 2026-05-27 with audit finding +
disposition + cross-link to S1.C pre-audit subsection.
- Plan D2: intent rewritten to name the column-ref narrowing as
in-scope; Files-in-play row de-conditionalised with file+line
anchor; Done-when carries the explicit filter shape; D4 done-when
augmented with a cross-namespace column→enum binding regression
test (audit.log_entry.priority vs public.post.status on same enum
name, distinct namespaces).
- Sizing unchanged (D2 still M; absorbed via one filter clause).
Linear: TML-2624 (Canceled 2026-05-20 per project convention; still
referenced for traceability — same pattern as S1.A/S1.B). Tracking
via parent project TML-2584.
Signed-off-by: Will Madden <[email protected]>
5 tasks done
paulwer
pushed a commit
to paulwer/prisma-next
that referenced
this pull request
Jun 11, 2026
…t split (prisma#810) Gives Postgres a real native UUID storage type, and makes the uuid authoring surface unambiguous about what it stores. Until now, PSL `String @db.Uuid` set `nativeType: 'uuid'` but carried `codecId: null`, silently inheriting the text codec — DDL rendered a `uuid` column while the contract claimed text. Separately, the TS helpers `field.uuid()` / `field.id.uuidv4()` *read* like native uuid but actually store `character(36)` (they're shared with SQLite, which has no uuid type). This PR fixes the first by introducing `pg/uuid@1` end-to-end, and the second by renaming the helpers so storage is explicit. ## Changes - **Target pack (`@prisma-next/target-postgres`, Adapters layer)**: new non-parameterized `pg/uuid@1` codec — `PgUuidCodec`/`PgUuidDescriptor`/`pgUuidColumn`, registered in `codecDescriptors`, the codec type map, and the export surfaces. String passthrough on the wire; traits are `equality` + `order` only, deliberately not `textual` (Postgres rejects `LIKE` on `uuid` without a cast). - **PSL authoring (`@prisma-next/sql-contract-psl`, Authoring layer)**: `NATIVE_TYPE_SPECS['db.Uuid']` now resolves to `pg/uuid@1` instead of inheriting the String codec. `@db.*` attributes live on named types (`types { UuidId = String @db.Uuid }`), as before. - **ID generators (`@prisma-next/ids`, Authoring layer)**: `uuidv4`/`uuidv7` gained `pg/uuid@1` in `applicableCodecIds`, so `@default(uuid())` / `@default(uuid(7))` are valid on native-uuid columns. Other generators still reject uuid columns (their output is not a uuid literal). - **Adapter (`@prisma-next/adapter-postgres`, Adapters layer)**: control-plane metadata for `pg/uuid@1` (`identityHooks` + storage entry), which lets DDL render `uuid` and introspection resolve a live `uuid` column back to the codec. - **Authoring presets renamed — String/Native split (breaking)**: family presets `field.uuid()` → `field.uuidString()`, `field.id.uuidv4()` → `field.id.uuidv4String()`, `field.id.uuidv7()` → `field.id.uuidv7String()` (same `character(36)` storage, cross-target). The Postgres pack now contributes `field.uuidNative()`, `field.id.uuidv4Native()`, `field.id.uuidv7Native()` with native `uuid` storage; on SQLite these don't exist, so using them is an immediate composition error rather than a silent fallback. Unsuffixed names are removed — no compat aliases. All call sites (examples, CLI init templates, docs, ADRs 170/181, READMEs) are swept; the renames are semantics-preserving, proven by zero `contract.json` churn in `fixtures:check`. - **Upgrade instructions**: recorded under `skills/upgrade/.../0.13-to-0.14/` and `skills/extension-author/.../0.13-to-0.14/` with a codemod for the three renames. - **Framework fix (`@prisma-next/framework-components`, Core layer)**: `mergeAuthoringNamespaces` grafted later packs' helpers onto the first pack's sub-namespace object by reference, so composing the same pack singletons twice in one process threw a spurious "Duplicate authoring field helper". Latent until the postgres pack started contributing `field.id.*Native` alongside the family's `field.id.*String`; now merges copy sub-namespaces on first assignment, with a regression test pinning source-pack immutability and duplicate detection. - **Supabase example adopts native uuid end-to-end**: `Profile.id` becomes `id Uuid @id @default(uuid())` — a native `uuid` primary key with the client-side uuidv4 generator, alongside the already-native `userId` FK to Supabase auth. This exposed and fixed a latent PSL bug: the generator-default path unconditionally replaced a field's resolved descriptor with the generator's `char(36)` fallback, clobbering named-type native descriptors; the fallback now applies only when the field has no named type (which is what the design always intended). - **Framework fix prisma#2 (`mergeAuthoringNamespaces`)**: the source-pack-immutability fix above initially shallow-copied *any* object sub-namespace, which dropped prototype getters off class-instance descriptors (surfaced by TML-2882's enum2 blocks after merging main: 11/14 enum2 tests red). The copy now applies to plain-prototype objects only; class instances pass by reference. Regression tests pin both guarantees. - **Fixture regen**: supabase example + extension contracts pick up the `pg/text@1` → `pg/uuid@1` codecId flip on their `@db.Uuid` columns (+ `storageHash`). That and the CLI template snapshot are the entire regen diff. ## Why The codec is the unit of target-type identity in this architecture (codec-owned storage hooks, not shared-IR enums), so native UUID support is a new codec plus wiring — zero changes to shared IR, the emitter, or DDL rendering, which are generic over descriptor metadata. The rename (rather than changing `field.uuid()`'s meaning per target) keeps every existing column type stable: migrating is a mechanical find/replace, not a schema migration. The String/Native suffix pair also keeps foreign-key typing honest — a `char(36)` id pairs with `uuidString()` FKs, a native id with `uuidNative()` FKs. ## Verification - `packages/3-targets/6-adapters/postgres/test/migrations/planner.uuid.integration.test.ts` (PGlite): DDL produces `udt_name = 'uuid'`; insert/select round-trips; introspection + `verifySchema` reconcile the live column with `pg/uuid@1`; v4-format and `gen_random_uuid()` values accepted. - PSL tests: `@db.Uuid` → `pg/uuid@1`; `uuid()`/`uuid(7)` applicability positive; nanoid-on-uuid pins the `PSL_INVALID_DEFAULT_APPLICABILITY` diagnostic. - Emit-then-consume tests: `field.uuidNative()` / `field.id.uuidv4Native()` emit `pg/uuid@1` + `nativeType: 'uuid'` + the uuidv4 generator in contract JSON. - Gates: root `pnpm typecheck` green (138 tasks), `pnpm lint:deps` clean, `pnpm fixtures:check` exit 0, grep gate shows no surviving old preset names outside the upgrade-instruction artifacts (which carry them by design as codemod find-patterns). Pre-existing test failures in target-postgres / contract-psl suites (class-instance vs plain-object drift) were verified pre-existing on the merge base during review. ## Follow-ups (not in this PR) - Optional test: one vertical PSL-to-runtime test for `@default(uuid())` on a native-uuid column (the halves are each covered separately today). - Examples/templates still author `uuidString()` ids; adopting `uuidNative()` in the Postgres demo is a separate, DDL-changing decision. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added native PostgreSQL UUID support and new string-typed UUID helpers (uuidString / uuidv4String / uuidv7String) plus Postgres-native UUID presets. * **Bug Fixes** * Identifier fields now emit and map to a proper UUID codec/native type instead of text/char, improving schema fidelity and runtime round-trips. * **Tests** * Added unit, integration, and end-to-end coverage for UUID codecs, generators, planners, and migrations. * **Docs** * Updated docs, upgrade instructions, and included a migration helper to rename old UUID presets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Will Madden <[email protected]> Co-authored-by: Will Madden <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Jun 15, 2026
Read the rule with the eyes of an agent mid-task. Fixes the gaps an agent following it literally would still trip on: - The rule's namesake "don't" (re-running to refine a filter) was bullet #2; promote it to #1. - "Don't pass --force to turbo" left the right thing unsaid; name the cached invocation (pnpm turbo typecheck plain). - The recipe captured the exit code but never told the agent to read it back; add the tail step plus a note for the crash-before-tests case (log has no FAIL lines). - The re-run-after-a-fix case was unspecified; say to overwrite the same file with >. - wip/ was presented as a magic convention; note that it's gitignored at the repo root. - Scope-limit the rule explicitly to the listed slow commands; tell agents short commands run normally. - Replace the orphaned "if a pipe is unavoidable" line with a worked tee + PIPESTATUS example. - Drop the meta "largest waste of agent time" framing — it's for the reviewer, not the executing agent. Bytes threshold bumped 31500 → 32000 to fit the richer recipe; lines threshold unchanged. Co-authored-by: Claude Opus 4.7 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
SevInf
added a commit
that referenced
this pull request
Jun 18, 2026
Slice 5 dispatch 2 (consume-resolved-block-delete-enum-block), the final dispatch of the slice. The SQL enum factory path now reads the resolved PslExtensionBlock that buildSymbolTable produces (BlockSymbol.block, slice 5 D1) instead of reconstructing it locally. - interpreter.ts: the topLevelEnums walk maps each enum BlockSymbol to block.block (the descriptor-classified PslExtensionBlock) rather than calling SQL's reconstructExtensionBlock; ProcessEnumDeclarationsInput.enumBlocks is now readonly PslExtensionBlock[]. The enum factory consumes the same shape. - Deleted src/enum-block.ts (its reconstruction moved to psl-parser's block-reconstruction.ts in D1) and test/enum-block.test.ts (10 tests; reconstruction coverage relocated to psl-parser's D1 block-resolution tests). Test-fixtures fix (the load-bearing prerequisite): buildSymbolTableInput / symbolTableInputFromParseArgs now (a) thread pslBlockDescriptors into buildSymbolTable so BlockSymbol.block is descriptor-classified (the enum descriptor's discriminator + params), and (b) return buildSymbolTable's diagnostics as seedDiagnostics (mapped ParseDiagnostic -> ContractSourceDiagnostic via rangeToPslSpan, mirroring the provider) so the interpreter-driven tests see the same diagnostic set the real provider produces. Without this, deleting enum-block.ts would have dropped the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER diagnostic. Corrected one stale test (operator-approved): interpreter.enum.test.ts "duplicate enum block names" asserted silent last-writer-wins (ok:true) - deleted-parser behaviour that contradicts the shipped provider path (provider.test.ts already asserts duplicate top-level declarations -> PSL_DUPLICATE_DECLARATION + ok:false) and operator decisions #2/#4 (duplicate names collide first-wins AND are flagged). Now asserts ok:false + PSL_DUPLICATE_DECLARATION, title/comment rewritten to the symbol-table first-wins-and-flag behaviour. No other assertion touched. PARITY: every diagnostic code + the emitted enum contract preserved (the block.block the factory gets is byte-identical to enum-block.ts's output, given the now-threaded enum descriptor); the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER test passes via seedDiagnostics. SQL suite green (251, = 261 - 10 deleted enum-block.test.ts); psl-printer policy_select round-trip green unchanged. Slice DoD: pnpm build (66/66) + pnpm typecheck (138/138) clean; lint:deps green (1085 modules); rg 'reconstructExtensionBlock|enum-block' packages/2-sql packages/2-mongo-family empty. The four slice packages green in isolation: psl-parser 368, sql-contract-psl 251, mongo-contract-psl 137, psl-printer 46. The 43 test:packages failures are all environmental (mongodb-memory-server mongod-binary unavailable on NixOS; CLI spawnSync subprocess timeouts) - no new regression. Closes slice 5. Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf
added a commit
that referenced
this pull request
Jun 19, 2026
Slice 5 dispatch 2 (consume-resolved-block-delete-enum-block), the final dispatch of the slice. The SQL enum factory path now reads the resolved PslExtensionBlock that buildSymbolTable produces (BlockSymbol.block, slice 5 D1) instead of reconstructing it locally. - interpreter.ts: the topLevelEnums walk maps each enum BlockSymbol to block.block (the descriptor-classified PslExtensionBlock) rather than calling SQL's reconstructExtensionBlock; ProcessEnumDeclarationsInput.enumBlocks is now readonly PslExtensionBlock[]. The enum factory consumes the same shape. - Deleted src/enum-block.ts (its reconstruction moved to psl-parser's block-reconstruction.ts in D1) and test/enum-block.test.ts (10 tests; reconstruction coverage relocated to psl-parser's D1 block-resolution tests). Test-fixtures fix (the load-bearing prerequisite): buildSymbolTableInput / symbolTableInputFromParseArgs now (a) thread pslBlockDescriptors into buildSymbolTable so BlockSymbol.block is descriptor-classified (the enum descriptor's discriminator + params), and (b) return buildSymbolTable's diagnostics as seedDiagnostics (mapped ParseDiagnostic -> ContractSourceDiagnostic via rangeToPslSpan, mirroring the provider) so the interpreter-driven tests see the same diagnostic set the real provider produces. Without this, deleting enum-block.ts would have dropped the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER diagnostic. Corrected one stale test (operator-approved): interpreter.enum.test.ts "duplicate enum block names" asserted silent last-writer-wins (ok:true) - deleted-parser behaviour that contradicts the shipped provider path (provider.test.ts already asserts duplicate top-level declarations -> PSL_DUPLICATE_DECLARATION + ok:false) and operator decisions #2/#4 (duplicate names collide first-wins AND are flagged). Now asserts ok:false + PSL_DUPLICATE_DECLARATION, title/comment rewritten to the symbol-table first-wins-and-flag behaviour. No other assertion touched. PARITY: every diagnostic code + the emitted enum contract preserved (the block.block the factory gets is byte-identical to enum-block.ts's output, given the now-threaded enum descriptor); the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER test passes via seedDiagnostics. SQL suite green (251, = 261 - 10 deleted enum-block.test.ts); psl-printer policy_select round-trip green unchanged. Slice DoD: pnpm build (66/66) + pnpm typecheck (138/138) clean; lint:deps green (1085 modules); rg 'reconstructExtensionBlock|enum-block' packages/2-sql packages/2-mongo-family empty. The four slice packages green in isolation: psl-parser 368, sql-contract-psl 251, mongo-contract-psl 137, psl-printer 46. The 43 test:packages failures are all environmental (mongodb-memory-server mongod-binary unavailable on NixOS; CLI spawnSync subprocess timeouts) - no new regression. Closes slice 5. Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf
added a commit
that referenced
this pull request
Jun 19, 2026
Slice 5 dispatch 2 (consume-resolved-block-delete-enum-block), the final dispatch of the slice. The SQL enum factory path now reads the resolved PslExtensionBlock that buildSymbolTable produces (BlockSymbol.block, slice 5 D1) instead of reconstructing it locally. - interpreter.ts: the topLevelEnums walk maps each enum BlockSymbol to block.block (the descriptor-classified PslExtensionBlock) rather than calling SQL's reconstructExtensionBlock; ProcessEnumDeclarationsInput.enumBlocks is now readonly PslExtensionBlock[]. The enum factory consumes the same shape. - Deleted src/enum-block.ts (its reconstruction moved to psl-parser's block-reconstruction.ts in D1) and test/enum-block.test.ts (10 tests; reconstruction coverage relocated to psl-parser's D1 block-resolution tests). Test-fixtures fix (the load-bearing prerequisite): buildSymbolTableInput / symbolTableInputFromParseArgs now (a) thread pslBlockDescriptors into buildSymbolTable so BlockSymbol.block is descriptor-classified (the enum descriptor's discriminator + params), and (b) return buildSymbolTable's diagnostics as seedDiagnostics (mapped ParseDiagnostic -> ContractSourceDiagnostic via rangeToPslSpan, mirroring the provider) so the interpreter-driven tests see the same diagnostic set the real provider produces. Without this, deleting enum-block.ts would have dropped the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER diagnostic. Corrected one stale test (operator-approved): interpreter.enum.test.ts "duplicate enum block names" asserted silent last-writer-wins (ok:true) - deleted-parser behaviour that contradicts the shipped provider path (provider.test.ts already asserts duplicate top-level declarations -> PSL_DUPLICATE_DECLARATION + ok:false) and operator decisions #2/#4 (duplicate names collide first-wins AND are flagged). Now asserts ok:false + PSL_DUPLICATE_DECLARATION, title/comment rewritten to the symbol-table first-wins-and-flag behaviour. No other assertion touched. PARITY: every diagnostic code + the emitted enum contract preserved (the block.block the factory gets is byte-identical to enum-block.ts's output, given the now-threaded enum descriptor); the duplicate-member PSL_EXTENSION_DUPLICATE_PARAMETER test passes via seedDiagnostics. SQL suite green (251, = 261 - 10 deleted enum-block.test.ts); psl-printer policy_select round-trip green unchanged. Slice DoD: pnpm build (66/66) + pnpm typecheck (138/138) clean; lint:deps green (1085 modules); rg 'reconstructExtensionBlock|enum-block' packages/2-sql packages/2-mongo-family empty. The four slice packages green in isolation: psl-parser 368, sql-contract-psl 251, mongo-contract-psl 137, psl-printer 46. The 43 test:packages failures are all environmental (mongodb-memory-server mongod-binary unavailable on NixOS; CLI spawnSync subprocess timeouts) - no new regression. Closes slice 5. Signed-off-by: Serhii Tatarintsev <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Jun 26, 2026
… caller-side whitelist Policies now nest under a PostgresTableNode (database root → table → policy), so a policy’s id() is just its wire name — unique among its table’s policies — instead of folding namespace/table into the key. Same-wire-name policies on different tables stay distinct via their table nodes. The framework differ becomes total: an unmatched non-leaf node emits its own issue and descends, emitting one per node in the missing/extra subtree. So an initial migration (every table missing) still surfaces the policies beneath the missing tables. Coalescing a parent change over its children is the planner’s job. Ownership and node-type selection leave the differ. diffPostgresSchema(expected, actual) takes two built IRs, runs the total diff, whitelists policy-subject issues (isPostgresRlsPolicy), and drops extra policies in namespaces expected does not own. filterSchemaIssuesByOwnership is removed from framework schema-diff.ts — the differ is pure. namespaceId is resolved to its DDL schema name once, at derivation (collectContractRlsPolicies), via the existing resolveDdlSchemaForNamespaceStorage, so expected and actual table nodes pair by id(). The degraded resolveNamespaceId duplicate is deleted. Also completes the coordinate→path migration missed in 6bd0f25: the family-sql filterSchemaDiffIssues test and the supabase skeleton test referenced the removed .coordinate field (CI Test + Type Check were red on that tip). Addresses review comments #2, #5, #6; #3 (id()) landed separately; #4 (rename the root off "IR") deferred as its own leveling change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.