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

Add PGVector extension - #4

Merged
wmadden merged 8 commits into
mainfrom
pgvector
Nov 12, 2025
Merged

wmadden merged 8 commits into
mainfrom
pgvector

Conversation

@wmadden

@wmadden wmadden commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@wmadden
wmadden merged commit 631cd0b into main Nov 12, 2025
@aqrln
aqrln deleted the pgvector branch December 15, 2025 13:54
wmadden added a commit that referenced this pull request Apr 21, 2026
…er deletion

F6.3 pre-work. The source-code JSDoc in mongo-query-builder and
mongo-query-ast had five references to the mongo-pipeline-builder
project folders spec file — which F6.4 deletes. Each reference is
rerouted to a long-lived home:

- builder.ts, markers.ts: the marker table reference now points at
  ADR 201 (State-machine pattern for typed DSL builders), which now
  holds the canonical table with a per-row "why" column.
- commands.ts: Open Item #1 (upsert AST shape: extend existing vs.
  introduce sibling commands) was resolved in favor of "extend
  existing". The JSDoc on UpdateOneCommand.upsert kept only the
  self-contained rationale ("preserve pre-upsert constructor
  signature for existing call sites"); the dangling spec pointer
  is dropped.
- state-classes.ts: Open Item #2 (canonical match-all filter
  representation) is still open — rewritten inline so the JSDoc
  describes the two candidate representations and the current
  interim encoding without depending on the spec.
- field-accessor.ts: Open Item #4 (trait-gating of update operators)
  is tracked on Linear as TML-2259; reference updated to point at
  the ticket instead of the spec.

No behavioural changes — JSDoc/comment only.
wmadden added a commit that referenced this pull request Apr 21, 2026
…er deletion

F6.3 pre-work. The source-code JSDoc in mongo-query-builder and
mongo-query-ast had five references to the mongo-pipeline-builder
project folders spec file — which F6.4 deletes. Each reference is
rerouted to a long-lived home:

- builder.ts, markers.ts: the marker table reference now points at
  ADR 201 (State-machine pattern for typed DSL builders), which now
  holds the canonical table with a per-row "why" column.
- commands.ts: Open Item #1 (upsert AST shape: extend existing vs.
  introduce sibling commands) was resolved in favor of "extend
  existing". The JSDoc on UpdateOneCommand.upsert kept only the
  self-contained rationale ("preserve pre-upsert constructor
  signature for existing call sites"); the dangling spec pointer
  is dropped.
- state-classes.ts: Open Item #2 (canonical match-all filter
  representation) is still open — rewritten inline so the JSDoc
  describes the two candidate representations and the current
  interim encoding without depending on the spec.
- field-accessor.ts: Open Item #4 (trait-gating of update operators)
  is tracked on Linear as TML-2259; reference updated to point at
  the ticket instead of the spec.

No behavioural changes — JSDoc/comment only.
jkomyno added a commit that referenced this pull request May 4, 2026
…-implemented

ADR 208 § "No-emit type resolution" and the No-Emit Workflow subsystem
described `FieldOutputType` as following `typeRef` and applying the
column's authoring-time `type` slot to produce `Vector<1536>` and arktype-
schema-shaped types in no-emit mode. The resolver isn't wired up:
`@prisma-next/sql-contract-ts`'s `FieldOutputType` resolves through
`CodecTypesFromDefinition[codecId]['output']` only, and the arktype-json
codec-types map declares the `arktype/json@1` `output` as `unknown`. So
authors who skip `pnpm emit` get codec-base types, not the parameterized
refinements that emit produces.

Mark the resolver as not-yet-implemented in the ADR, the no-emit
subsystem, and the arktype-json README. Reference TML-2357 for tracked
follow-up. The eventual target shape stays in the docs as the design
intent — what changed is the status, not the design.

Refs #402 review (P2 #4).
wmadden added a commit that referenced this pull request May 8, 2026
Introduce `buildCodec({id, encode, decode, encodeJson?, decodeJson?})`
in `framework-components/codec` so descriptor `factory` bodies and
ad-hoc test fixtures can construct narrow `Codec` instances without
reaching for the legacy `mkCodec(...)` / family-side codec factory.

The helper accepts strictly the runtime instance shape — `id` and the
four conversion methods — and refuses `targetTypes` / `traits` / `meta`
/ `paramsSchema` / `init` / `renderOutputType` at the type level so it
cannot serve as a back-door for the retired contributor surface (the
`@ts-expect-error` block in `test/build-codec.test.ts` pins this).
Sync `encode` / `decode` are auto promise-lifted (per ADR 204);
`encodeJson` / `decodeJson` default to identity when omitted so codecs
whose `TInput` is JSON-safe stay concise.

This unblocks the next M2 R4 commits, which retire `mkCodec`,
`defineCodecGroup`, and `defineCodecBundle` from `relational-core`
(decisions #4 / #9 / #10 in the unattended-decisions log).
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 9, 2026
Introduce `buildCodec({id, encode, decode, encodeJson?, decodeJson?})`
in `framework-components/codec` so descriptor `factory` bodies and
ad-hoc test fixtures can construct narrow `Codec` instances without
reaching for the legacy `mkCodec(...)` / family-side codec factory.

The helper accepts strictly the runtime instance shape — `id` and the
four conversion methods — and refuses `targetTypes` / `traits` / `meta`
/ `paramsSchema` / `init` / `renderOutputType` at the type level so it
cannot serve as a back-door for the retired contributor surface (the
`@ts-expect-error` block in `test/build-codec.test.ts` pins this).
Sync `encode` / `decode` are auto promise-lifted (per ADR 204);
`encodeJson` / `decodeJson` default to identity when omitted so codecs
whose `TInput` is JSON-safe stay concise.

This unblocks the next M2 R4 commits, which retire `mkCodec`,
`defineCodecGroup`, and `defineCodecBundle` from `relational-core`
(decisions #4 / #9 / #10 in the unattended-decisions log).
wmadden added a commit that referenced this pull request May 9, 2026
…1.4)

Two pairs of fresh sub-subagent runs producing system-design-reviews of
commit 68ebbeb (the M1-cleanup F4 hoist that landed the Authored*
typology the original reviewer signed off before F6 surfaced). Same
ask both sides; only the persona-load instruction differs.

Initial pair (run-a-framed / run-b-unframed) was contaminated: both
runs read the spec at HEAD, which post-F6 explicitly retracts the
Authored* rename and narrates the F4 -> F6 history. Both reviewers
picked up the answer from the spec and surfaced the typology concern.
Test-design flaw, not refutation of the persona effect — preserved
in this directory for the audit trail.

Clean-baseline pair (run-a2-framed / run-b2-unframed) reads spec
content only via 'git show 68ebbeb:<path>' so the reviewers see the
spec as it stood when the original reviewer signed off (defending the
rename). This is the load-bearing comparison.

Clean-baseline result:

  * Different top-line verdicts on the same evidence:
      - A2 (framed): CONCERNS (5 raised)
      - B2 (unframed): SATISFIED (3 raised + 3 dismissed)
  * Most informative single difference: the MigrationPlanOperation
    vs MigrationOps typing of 'ops'. Same evidence in both. A2 flags
    as a typology defect ("the choice reads as accidental"). B2
    dismisses ("type-d test caught any divergence ... nothing to do
    here"). Structurally equivalent to the F4/F6 class of concern
    the original reviewer missed: a silent typology equivocation on
    a load-bearing field that the type system happens to accept.
  * Two further typology concerns only A2 raises: doc-clarification
    at the declaration site (load-bearing-name cue), migration-tools
    role recharacterisation (ubiquitous-language cue).
  * Vocabulary shift consistent with persona docs Vocabulary cues
    section: A2 reaches for "conceptual integrity recovered",
    "earns its keep", "category error", "synonym-for-the-same-thing";
    B2 uses generalist framings ("structural refactor in service of",
    "watch the seams").

Caveats documented in the score artefact:

  * Neither run catches F6 in its strongest form (that no structural
    distinction exists between authored and on-disk packages). Both
    engage with the commit's own defense and accept the partition.
    Implication: personas raise the floor; they do not eliminate the
    post-implementation interactive review pass.
  * Single trial per pair. Subagent runs are not deterministic. The
    verdict difference (CONCERNS vs SATISFIED) and the most
    informative single concern survive trial noise; if the
    orchestrator wants a second trial, score artefact says it is
    cheap to run.
  * Persona-shift mechanism not separable in this test (doc prose
    vs priming effect vs vocabulary cues). M2 onwards bets on all
    three together.

Verdict: PASS. The persona-load mechanism shifts behaviour measurably
on the case the project exists to address. Recommendation: proceed
to M2.

Refs: TML-2397, projects/agent-personas/spec.md AC5; plan.md Task 1.4
and Open Items #4 (re-run on borderline result documented).
wmadden added a commit that referenced this pull request May 9, 2026
…1.4)

Two pairs of fresh sub-subagent runs producing system-design-reviews of
commit 68ebbeb (the M1-cleanup F4 hoist that landed the Authored*
typology the original reviewer signed off before F6 surfaced). Same
ask both sides; only the persona-load instruction differs.

Initial pair (run-a-framed / run-b-unframed) was contaminated: both
runs read the spec at HEAD, which post-F6 explicitly retracts the
Authored* rename and narrates the F4 -> F6 history. Both reviewers
picked up the answer from the spec and surfaced the typology concern.
Test-design flaw, not refutation of the persona effect — preserved
in this directory for the audit trail.

Clean-baseline pair (run-a2-framed / run-b2-unframed) reads spec
content only via 'git show 68ebbeb:<path>' so the reviewers see the
spec as it stood when the original reviewer signed off (defending the
rename). This is the load-bearing comparison.

Clean-baseline result:

  * Different top-line verdicts on the same evidence:
      - A2 (framed): CONCERNS (5 raised)
      - B2 (unframed): SATISFIED (3 raised + 3 dismissed)
  * Most informative single difference: the MigrationPlanOperation
    vs MigrationOps typing of 'ops'. Same evidence in both. A2 flags
    as a typology defect ("the choice reads as accidental"). B2
    dismisses ("type-d test caught any divergence ... nothing to do
    here"). Structurally equivalent to the F4/F6 class of concern
    the original reviewer missed: a silent typology equivocation on
    a load-bearing field that the type system happens to accept.
  * Two further typology concerns only A2 raises: doc-clarification
    at the declaration site (load-bearing-name cue), migration-tools
    role recharacterisation (ubiquitous-language cue).
  * Vocabulary shift consistent with persona docs Vocabulary cues
    section: A2 reaches for "conceptual integrity recovered",
    "earns its keep", "category error", "synonym-for-the-same-thing";
    B2 uses generalist framings ("structural refactor in service of",
    "watch the seams").

Caveats documented in the score artefact:

  * Neither run catches F6 in its strongest form (that no structural
    distinction exists between authored and on-disk packages). Both
    engage with the commit's own defense and accept the partition.
    Implication: personas raise the floor; they do not eliminate the
    post-implementation interactive review pass.
  * Single trial per pair. Subagent runs are not deterministic. The
    verdict difference (CONCERNS vs SATISFIED) and the most
    informative single concern survive trial noise; if the
    orchestrator wants a second trial, score artefact says it is
    cheap to run.
  * Persona-shift mechanism not separable in this test (doc prose
    vs priming effect vs vocabulary cues). M2 onwards bets on all
    three together.

Verdict: PASS. The persona-load mechanism shifts behaviour measurably
on the case the project exists to address. Recommendation: proceed
to M2.

Refs: TML-2397, projects/agent-personas/spec.md AC5; plan.md Task 1.4
and Open Items #4 (re-run on borderline result documented).
wmadden added a commit that referenced this pull request May 9, 2026
Introduce `buildCodec({id, encode, decode, encodeJson?, decodeJson?})`
in `framework-components/codec` so descriptor `factory` bodies and
ad-hoc test fixtures can construct narrow `Codec` instances without
reaching for the legacy `mkCodec(...)` / family-side codec factory.

The helper accepts strictly the runtime instance shape — `id` and the
four conversion methods — and refuses `targetTypes` / `traits` / `meta`
/ `paramsSchema` / `init` / `renderOutputType` at the type level so it
cannot serve as a back-door for the retired contributor surface (the
`@ts-expect-error` block in `test/build-codec.test.ts` pins this).
Sync `encode` / `decode` are auto promise-lifted (per ADR 204);
`encodeJson` / `decodeJson` default to identity when omitted so codecs
whose `TInput` is JSON-safe stay concise.

This unblocks the next M2 R4 commits, which retire `mkCodec`,
`defineCodecGroup`, and `defineCodecBundle` from `relational-core`
(decisions #4 / #9 / #10 in the unattended-decisions log).
wmadden added a commit that referenced this pull request May 9, 2026
Introduce `buildCodec({id, encode, decode, encodeJson?, decodeJson?})`
in `framework-components/codec` so descriptor `factory` bodies and
ad-hoc test fixtures can construct narrow `Codec` instances without
reaching for the legacy `mkCodec(...)` / family-side codec factory.

The helper accepts strictly the runtime instance shape — `id` and the
four conversion methods — and refuses `targetTypes` / `traits` / `meta`
/ `paramsSchema` / `init` / `renderOutputType` at the type level so it
cannot serve as a back-door for the retired contributor surface (the
`@ts-expect-error` block in `test/build-codec.test.ts` pins this).
Sync `encode` / `decode` are auto promise-lifted (per ADR 204);
`encodeJson` / `decodeJson` default to identity when omitted so codecs
whose `TInput` is JSON-safe stay concise.

This unblocks the next M2 R4 commits, which retire `mkCodec`,
`defineCodecGroup`, and `defineCodecBundle` from `relational-core`
(decisions #4 / #9 / #10 in the unattended-decisions log).
wmadden added a commit that referenced this pull request May 9, 2026
Introduce `buildCodec({id, encode, decode, encodeJson?, decodeJson?})`
in `framework-components/codec` so descriptor `factory` bodies and
ad-hoc test fixtures can construct narrow `Codec` instances without
reaching for the legacy `mkCodec(...)` / family-side codec factory.

The helper accepts strictly the runtime instance shape — `id` and the
four conversion methods — and refuses `targetTypes` / `traits` / `meta`
/ `paramsSchema` / `init` / `renderOutputType` at the type level so it
cannot serve as a back-door for the retired contributor surface (the
`@ts-expect-error` block in `test/build-codec.test.ts` pins this).
Sync `encode` / `decode` are auto promise-lifted (per ADR 204);
`encodeJson` / `decodeJson` default to identity when omitted so codecs
whose `TInput` is JSON-safe stay concise.

This unblocks the next M2 R4 commits, which retire `mkCodec`,
`defineCodecGroup`, and `defineCodecBundle` from `relational-core`
(decisions #4 / #9 / #10 in the unattended-decisions log).
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 15, 2026
Apply the binding façade principle to the prisma-next-contract skill:
user-authored code (`prisma-next.config.ts`, `contract.ts`, control
clients, `db.ts`) imports only from `@prisma-next/<target>/<subpath>`
and `@prisma-next/extension-<name>/<subpath>`. The first-pass audit
(c20c5b1) violated this on every config / contract-builder example
by reaching into `@prisma-next/cli/*`, `@prisma-next/family-*`,
`@prisma-next/target-*`, `@prisma-next/adapter-*`,
`@prisma-next/driver-*`, and `@prisma-next/sql-contract-*`.

The façade form is the same one the example apps now ship under
bf74222 — `defineConfig` from `@prisma-next/postgres/config` plus
extension control descriptors imported from
`@prisma-next/extension-<name>/control`. The façade auto-derives the
emit output path and routes `.prisma` / `.ts` contract paths to the
matching provider, so users no longer hand-wrap with `prismaContract`
or `typescriptContract`.

Defects fixed:

- Config example collapsed from seven internal imports to two façade
  imports.
- TS builder example switched to `@prisma-next/postgres/contract-builder`
  + `@prisma-next/postgres/family` + `@prisma-next/postgres/target` and
  the callback overload (drops the column-types adapter import).
- `prismaContract` / `typescriptContract` references replaced with the
  façade's path-string `contract:` field across Key Concepts and the
  PN-CLI-4002 row.
- `defineConfig` from `@prisma-next/cli/config-types` replaced with
  `@prisma-next/postgres/config` (or `@prisma-next/mongo/config`).
- Mongo polymorphism callout points at `@prisma-next/mongo/contract-builder`
  rather than `@prisma-next/mongo-contract-ts/contract-builder`.
- Description-as-matcher gains façade keywords (`@prisma-next/postgres/config`,
  `@prisma-next/postgres/contract-builder`, façade vocabulary).
- New Common Pitfall #4 calls out internal-package imports explicitly
  and points at the canonical worked examples in `examples/`.
- New Common Pitfall #5 separates `extensions` (config façade, control
  descriptors) from `extensionPacks` (TS builder, pack descriptors) and
  notes that the PN-CLI-4011 envelope's `fix` text now matches the
  façade.
- Mongo's narrower façade and SQLite's missing `/config` and
  `/contract-builder` subpaths added to *What Prisma Next doesn't do
  yet* with a route to `prisma-next-feedback`. Both follow-ups tracked
  under TML-2526.

Refs: TML-2526
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 15, 2026
Apply the binding façade principle to the prisma-next-contract skill:
user-authored code (`prisma-next.config.ts`, `contract.ts`, control
clients, `db.ts`) imports only from `@prisma-next/<target>/<subpath>`
and `@prisma-next/extension-<name>/<subpath>`. The first-pass audit
(c20c5b1) violated this on every config / contract-builder example
by reaching into `@prisma-next/cli/*`, `@prisma-next/family-*`,
`@prisma-next/target-*`, `@prisma-next/adapter-*`,
`@prisma-next/driver-*`, and `@prisma-next/sql-contract-*`.

The façade form is the same one the example apps now ship under
bf74222 — `defineConfig` from `@prisma-next/postgres/config` plus
extension control descriptors imported from
`@prisma-next/extension-<name>/control`. The façade auto-derives the
emit output path and routes `.prisma` / `.ts` contract paths to the
matching provider, so users no longer hand-wrap with `prismaContract`
or `typescriptContract`.

Defects fixed:

- Config example collapsed from seven internal imports to two façade
  imports.
- TS builder example switched to `@prisma-next/postgres/contract-builder`
  + `@prisma-next/postgres/family` + `@prisma-next/postgres/target` and
  the callback overload (drops the column-types adapter import).
- `prismaContract` / `typescriptContract` references replaced with the
  façade's path-string `contract:` field across Key Concepts and the
  PN-CLI-4002 row.
- `defineConfig` from `@prisma-next/cli/config-types` replaced with
  `@prisma-next/postgres/config` (or `@prisma-next/mongo/config`).
- Mongo polymorphism callout points at `@prisma-next/mongo/contract-builder`
  rather than `@prisma-next/mongo-contract-ts/contract-builder`.
- Description-as-matcher gains façade keywords (`@prisma-next/postgres/config`,
  `@prisma-next/postgres/contract-builder`, façade vocabulary).
- New Common Pitfall #4 calls out internal-package imports explicitly
  and points at the canonical worked examples in `examples/`.
- New Common Pitfall #5 separates `extensions` (config façade, control
  descriptors) from `extensionPacks` (TS builder, pack descriptors) and
  notes that the PN-CLI-4011 envelope's `fix` text now matches the
  façade.
- Mongo's narrower façade and SQLite's missing `/config` and
  `/contract-builder` subpaths added to *What Prisma Next doesn't do
  yet* with a route to `prisma-next-feedback`. Both follow-ups tracked
  under TML-2526.

Refs: TML-2526
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 16, 2026
Apply the binding façade principle to the prisma-next-contract skill:
user-authored code (`prisma-next.config.ts`, `contract.ts`, control
clients, `db.ts`) imports only from `@prisma-next/<target>/<subpath>`
and `@prisma-next/extension-<name>/<subpath>`. The first-pass audit
(c20c5b1) violated this on every config / contract-builder example
by reaching into `@prisma-next/cli/*`, `@prisma-next/family-*`,
`@prisma-next/target-*`, `@prisma-next/adapter-*`,
`@prisma-next/driver-*`, and `@prisma-next/sql-contract-*`.

The façade form is the same one the example apps now ship under
bf74222 — `defineConfig` from `@prisma-next/postgres/config` plus
extension control descriptors imported from
`@prisma-next/extension-<name>/control`. The façade auto-derives the
emit output path and routes `.prisma` / `.ts` contract paths to the
matching provider, so users no longer hand-wrap with `prismaContract`
or `typescriptContract`.

Defects fixed:

- Config example collapsed from seven internal imports to two façade
  imports.
- TS builder example switched to `@prisma-next/postgres/contract-builder`
  + `@prisma-next/postgres/family` + `@prisma-next/postgres/target` and
  the callback overload (drops the column-types adapter import).
- `prismaContract` / `typescriptContract` references replaced with the
  façade's path-string `contract:` field across Key Concepts and the
  PN-CLI-4002 row.
- `defineConfig` from `@prisma-next/cli/config-types` replaced with
  `@prisma-next/postgres/config` (or `@prisma-next/mongo/config`).
- Mongo polymorphism callout points at `@prisma-next/mongo/contract-builder`
  rather than `@prisma-next/mongo-contract-ts/contract-builder`.
- Description-as-matcher gains façade keywords (`@prisma-next/postgres/config`,
  `@prisma-next/postgres/contract-builder`, façade vocabulary).
- New Common Pitfall #4 calls out internal-package imports explicitly
  and points at the canonical worked examples in `examples/`.
- New Common Pitfall #5 separates `extensions` (config façade, control
  descriptors) from `extensionPacks` (TS builder, pack descriptors) and
  notes that the PN-CLI-4011 envelope's `fix` text now matches the
  façade.
- Mongo's narrower façade and SQLite's missing `/config` and
  `/contract-builder` subpaths added to *What Prisma Next doesn't do
  yet* with a route to `prisma-next-feedback`. Both follow-ups tracked
  under TML-2526.

Refs: TML-2526
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 16, 2026
Apply the binding façade principle to the prisma-next-contract skill:
user-authored code (`prisma-next.config.ts`, `contract.ts`, control
clients, `db.ts`) imports only from `@prisma-next/<target>/<subpath>`
and `@prisma-next/extension-<name>/<subpath>`. The first-pass audit
(c20c5b1) violated this on every config / contract-builder example
by reaching into `@prisma-next/cli/*`, `@prisma-next/family-*`,
`@prisma-next/target-*`, `@prisma-next/adapter-*`,
`@prisma-next/driver-*`, and `@prisma-next/sql-contract-*`.

The façade form is the same one the example apps now ship under
bf74222 — `defineConfig` from `@prisma-next/postgres/config` plus
extension control descriptors imported from
`@prisma-next/extension-<name>/control`. The façade auto-derives the
emit output path and routes `.prisma` / `.ts` contract paths to the
matching provider, so users no longer hand-wrap with `prismaContract`
or `typescriptContract`.

Defects fixed:

- Config example collapsed from seven internal imports to two façade
  imports.
- TS builder example switched to `@prisma-next/postgres/contract-builder`
  + `@prisma-next/postgres/family` + `@prisma-next/postgres/target` and
  the callback overload (drops the column-types adapter import).
- `prismaContract` / `typescriptContract` references replaced with the
  façade's path-string `contract:` field across Key Concepts and the
  PN-CLI-4002 row.
- `defineConfig` from `@prisma-next/cli/config-types` replaced with
  `@prisma-next/postgres/config` (or `@prisma-next/mongo/config`).
- Mongo polymorphism callout points at `@prisma-next/mongo/contract-builder`
  rather than `@prisma-next/mongo-contract-ts/contract-builder`.
- Description-as-matcher gains façade keywords (`@prisma-next/postgres/config`,
  `@prisma-next/postgres/contract-builder`, façade vocabulary).
- New Common Pitfall #4 calls out internal-package imports explicitly
  and points at the canonical worked examples in `examples/`.
- New Common Pitfall #5 separates `extensions` (config façade, control
  descriptors) from `extensionPacks` (TS builder, pack descriptors) and
  notes that the PN-CLI-4011 envelope's `fix` text now matches the
  façade.
- Mongo's narrower façade and SQLite's missing `/config` and
  `/contract-builder` subpaths added to *What Prisma Next doesn't do
  yet* with a route to `prisma-next-feedback`. Both follow-ups tracked
  under TML-2526.

Refs: TML-2526
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 16, 2026
Apply the binding façade principle to the prisma-next-contract skill:
user-authored code (`prisma-next.config.ts`, `contract.ts`, control
clients, `db.ts`) imports only from `@prisma-next/<target>/<subpath>`
and `@prisma-next/extension-<name>/<subpath>`. The first-pass audit
(c20c5b1) violated this on every config / contract-builder example
by reaching into `@prisma-next/cli/*`, `@prisma-next/family-*`,
`@prisma-next/target-*`, `@prisma-next/adapter-*`,
`@prisma-next/driver-*`, and `@prisma-next/sql-contract-*`.

The façade form is the same one the example apps now ship under
bf74222 — `defineConfig` from `@prisma-next/postgres/config` plus
extension control descriptors imported from
`@prisma-next/extension-<name>/control`. The façade auto-derives the
emit output path and routes `.prisma` / `.ts` contract paths to the
matching provider, so users no longer hand-wrap with `prismaContract`
or `typescriptContract`.

Defects fixed:

- Config example collapsed from seven internal imports to two façade
  imports.
- TS builder example switched to `@prisma-next/postgres/contract-builder`
  + `@prisma-next/postgres/family` + `@prisma-next/postgres/target` and
  the callback overload (drops the column-types adapter import).
- `prismaContract` / `typescriptContract` references replaced with the
  façade's path-string `contract:` field across Key Concepts and the
  PN-CLI-4002 row.
- `defineConfig` from `@prisma-next/cli/config-types` replaced with
  `@prisma-next/postgres/config` (or `@prisma-next/mongo/config`).
- Mongo polymorphism callout points at `@prisma-next/mongo/contract-builder`
  rather than `@prisma-next/mongo-contract-ts/contract-builder`.
- Description-as-matcher gains façade keywords (`@prisma-next/postgres/config`,
  `@prisma-next/postgres/contract-builder`, façade vocabulary).
- New Common Pitfall #4 calls out internal-package imports explicitly
  and points at the canonical worked examples in `examples/`.
- New Common Pitfall #5 separates `extensions` (config façade, control
  descriptors) from `extensionPacks` (TS builder, pack descriptors) and
  notes that the PN-CLI-4011 envelope's `fix` text now matches the
  façade.
- Mongo's narrower façade and SQLite's missing `/config` and
  `/contract-builder` subpaths added to *What Prisma Next doesn't do
  yet* with a route to `prisma-next-feedback`. Both follow-ups tracked
  under TML-2526.

Refs: TML-2526
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 19, 2026
…rios

Forks the manual-QA script from the predecessor branch onto v2 and
extends it for the re-cut + the new upgrade-instructions scope:

- Migration directory references updated for the v2 demo layout
  (`20260422T0720_initial` ×3 packages, not the old predecessor
  branch's `20260516T1816_initial`).
- Branch / PR pre-flight updated to point at the re-cut branch and
  flag PR #520's closure.
- "What this script is testing" block now covers four changes (not
  three), naming the upgrade-instructions skill entries as fix #4.
- "Why manual QA matters here" extended to add the
  upgrade-instructions intent as a sixth gap the scripted gates
  don't close.

Adds two new upgrade-journey scenarios per the slice plan's D4 +
calibration § 9.1 ("the script must name both prisma-next QA
audiences when shipping a breaking change"):

- Scenario 10 — End-user upgrade journey via the `prisma-next-upgrade`
  0.9→0.10 entry. Steps: stash the codemod-applied state to reproduce
  the pre-codemod TML-2536 deserializer crash; read the user-skill
  prose cold; run the codemod in `--check` mode; apply; confirm
  substrate equals PR-branch state (validation-by-execution proof);
  idempotency re-run; confirm the deserializer crash is gone. Failure
  modes severity-classified per scenario step.
- Scenario 11 — Extension-author upgrade journey via the
  `prisma-next-extension-upgrade` 0.9→0.10 entry. Uses pgvector as the
  representative third-party extension substrate. Steps: enumerate
  the extension's `SqlStorage`-touching source; read the extension-
  skill prose cold; confirm baseline tests pass; codemod against
  any seed snapshots; optional structural-falsifier plant to verify
  the `SqlStorage` constructor diagnostic fires cleanly.

Sign-off coverage map appended with two non-numbered rows for the
upgrade-instructions intent (one per audience), with a note that the
calibration document explicitly requires naming both audiences for a
breaking change.

The script is the planner artefact for `drive-qa-run`; the runner
produces the report with severity-classified findings. This commit
ships the plan; running it + producing the report is the slice DoD's
manual-QA bullet, satisfied at D7.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 19, 2026
…rios

Forks the manual-QA script from the predecessor branch onto v2 and
extends it for the re-cut + the new upgrade-instructions scope:

- Migration directory references updated for the v2 demo layout
  (`20260422T0720_initial` ×3 packages, not the old predecessor
  branch's `20260516T1816_initial`).
- Branch / PR pre-flight updated to point at the re-cut branch and
  flag PR #520's closure.
- "What this script is testing" block now covers four changes (not
  three), naming the upgrade-instructions skill entries as fix #4.
- "Why manual QA matters here" extended to add the
  upgrade-instructions intent as a sixth gap the scripted gates
  don't close.

Adds two new upgrade-journey scenarios per the slice plan's D4 +
calibration § 9.1 ("the script must name both prisma-next QA
audiences when shipping a breaking change"):

- Scenario 10 — End-user upgrade journey via the `prisma-next-upgrade`
  0.9→0.10 entry. Steps: stash the codemod-applied state to reproduce
  the pre-codemod TML-2536 deserializer crash; read the user-skill
  prose cold; run the codemod in `--check` mode; apply; confirm
  substrate equals PR-branch state (validation-by-execution proof);
  idempotency re-run; confirm the deserializer crash is gone. Failure
  modes severity-classified per scenario step.
- Scenario 11 — Extension-author upgrade journey via the
  `prisma-next-extension-upgrade` 0.9→0.10 entry. Uses pgvector as the
  representative third-party extension substrate. Steps: enumerate
  the extension's `SqlStorage`-touching source; read the extension-
  skill prose cold; confirm baseline tests pass; codemod against
  any seed snapshots; optional structural-falsifier plant to verify
  the `SqlStorage` constructor diagnostic fires cleanly.

Sign-off coverage map appended with two non-numbered rows for the
upgrade-instructions intent (one per audience), with a note that the
calibration document explicitly requires naming both audiences for a
breaking change.

The script is the planner artefact for `drive-qa-run`; the runner
produces the report with severity-classified findings. This commit
ships the plan; running it + producing the report is the slice DoD's
manual-QA bullet, satisfied at D7.

Signed-off-by: Will Madden <[email protected]>
SevInf added a commit that referenced this pull request Jun 18, 2026
…e follow-up

Post-delivery review surfaced that the per-package view layer (CstFieldView et
al.) rebuilds the resolved read-set the legacy parsePslDocument already produced
on PslField. Decision #4 (resolution stays in interpreters) de-centralized a
once-shared resolution pass into two copies + a view layer. Reframe the open
follow-up from "extract shared adapters" to "move resolution into the symbol
table, delete the views", flag decision #4 for the retro, and mark the
descriptor-typed-params item resolved (dispatch 5d). No code change.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jun 18, 2026
Slice 4 (resolve-in-symbol-table) dispatch 1 \u2014 reverse project decision #4:
centralize the resolution the SQL + Mongo packages each re-derive into views.

New src/resolve.ts (the shared home, Open Question #1 working position) holds
the proven resolution ported faithfully from the SQL cst-read.ts/symbol-views.ts:
- resolveFieldTypeAnnotation: QualifiedNameAst split (typeName/typeNamespaceId/
  typeContractSpaceId) + optional/list/isConstructor, with the over-qualified
  malformed signal.
- readResolvedAttribute(s) + readResolvedConstructorCall: verbatim-source arg
  value rendering (printSyntax(...).trim()), dotted attribute names.
- nodePslSpan/rangeToPslSpan: the Range -> PslSpan map.
- ResolvedAttribute / ResolvedAttributeArg / ResolvedTypeConstructorCall.

buildSymbolTable now resolves once:
- FieldSymbol gains typeName/typeNamespaceId?/typeContractSpaceId?/optional/list/
  typeConstructor?/attributes/malformedType?. Over-qualified field types emit
  PSL_INVALID_QUALIFIED_TYPE into the symbol-table diagnostics (a ParseDiagnostic,
  same code as before) and set malformedType (replacing the per-package
  typeAlreadyReported view flag).
- ScalarSymbol/TypeAliasSymbol gain the resolved binding shape (baseType?/
  typeConstructor?/isConstructor/attributes) via ResolvedNamedTypeBinding.
- ModelSymbol/CompositeTypeSymbol gain their model/composite-level attributes.

Faithful port: same diagnostic code, same span derivation, same verbatim arg
rendering, same isConstructor gating \u2014 so D2/D3 are pure deletions + field-access
rewires. The Resolved* types are exported from the package index.

Tests: 11 new symbol-table resolution tests (qualified split bare/dot/colon/
over-qualified, optional/list, constructor, field+model+composite attributes,
scalar-vs-alias resolved binding). psl-parser 361/361 green; typecheck clean;
lint:deps green. Interpreter view layers untouched (deleted in D2/D3).

Note for D2: CstFieldView declared a typeRef? field that symbol-views.ts never
populated (always undefined from the view path); FieldSymbol omits it. The SQL
helpers that read field.typeRef sourced it from a non-view path \u2014 D2 handles
that sourcing.

Signed-off-by: Serhii Tatarintsev <[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
…e follow-up

Post-delivery review surfaced that the per-package view layer (CstFieldView et
al.) rebuilds the resolved read-set the legacy parsePslDocument already produced
on PslField. Decision #4 (resolution stays in interpreters) de-centralized a
once-shared resolution pass into two copies + a view layer. Reframe the open
follow-up from "extract shared adapters" to "move resolution into the symbol
table, delete the views", flag decision #4 for the retro, and mark the
descriptor-typed-params item resolved (dispatch 5d). No code change.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jun 19, 2026
Slice 4 (resolve-in-symbol-table) dispatch 1 \u2014 reverse project decision #4:
centralize the resolution the SQL + Mongo packages each re-derive into views.

New src/resolve.ts (the shared home, Open Question #1 working position) holds
the proven resolution ported faithfully from the SQL cst-read.ts/symbol-views.ts:
- resolveFieldTypeAnnotation: QualifiedNameAst split (typeName/typeNamespaceId/
  typeContractSpaceId) + optional/list/isConstructor, with the over-qualified
  malformed signal.
- readResolvedAttribute(s) + readResolvedConstructorCall: verbatim-source arg
  value rendering (printSyntax(...).trim()), dotted attribute names.
- nodePslSpan/rangeToPslSpan: the Range -> PslSpan map.
- ResolvedAttribute / ResolvedAttributeArg / ResolvedTypeConstructorCall.

buildSymbolTable now resolves once:
- FieldSymbol gains typeName/typeNamespaceId?/typeContractSpaceId?/optional/list/
  typeConstructor?/attributes/malformedType?. Over-qualified field types emit
  PSL_INVALID_QUALIFIED_TYPE into the symbol-table diagnostics (a ParseDiagnostic,
  same code as before) and set malformedType (replacing the per-package
  typeAlreadyReported view flag).
- ScalarSymbol/TypeAliasSymbol gain the resolved binding shape (baseType?/
  typeConstructor?/isConstructor/attributes) via ResolvedNamedTypeBinding.
- ModelSymbol/CompositeTypeSymbol gain their model/composite-level attributes.

Faithful port: same diagnostic code, same span derivation, same verbatim arg
rendering, same isConstructor gating \u2014 so D2/D3 are pure deletions + field-access
rewires. The Resolved* types are exported from the package index.

Tests: 11 new symbol-table resolution tests (qualified split bare/dot/colon/
over-qualified, optional/list, constructor, field+model+composite attributes,
scalar-vs-alias resolved binding). psl-parser 361/361 green; typecheck clean;
lint:deps green. Interpreter view layers untouched (deleted in D2/D3).

Note for D2: CstFieldView declared a typeRef? field that symbol-views.ts never
populated (always undefined from the view path); FieldSymbol omits it. The SQL
helpers that read field.typeRef sourced it from a non-view path \u2014 D2 handles
that sourcing.

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
…e follow-up

Post-delivery review surfaced that the per-package view layer (CstFieldView et
al.) rebuilds the resolved read-set the legacy parsePslDocument already produced
on PslField. Decision #4 (resolution stays in interpreters) de-centralized a
once-shared resolution pass into two copies + a view layer. Reframe the open
follow-up from "extract shared adapters" to "move resolution into the symbol
table, delete the views", flag decision #4 for the retro, and mark the
descriptor-typed-params item resolved (dispatch 5d). No code change.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jun 19, 2026
Slice 4 (resolve-in-symbol-table) dispatch 1 \u2014 reverse project decision #4:
centralize the resolution the SQL + Mongo packages each re-derive into views.

New src/resolve.ts (the shared home, Open Question #1 working position) holds
the proven resolution ported faithfully from the SQL cst-read.ts/symbol-views.ts:
- resolveFieldTypeAnnotation: QualifiedNameAst split (typeName/typeNamespaceId/
  typeContractSpaceId) + optional/list/isConstructor, with the over-qualified
  malformed signal.
- readResolvedAttribute(s) + readResolvedConstructorCall: verbatim-source arg
  value rendering (printSyntax(...).trim()), dotted attribute names.
- nodePslSpan/rangeToPslSpan: the Range -> PslSpan map.
- ResolvedAttribute / ResolvedAttributeArg / ResolvedTypeConstructorCall.

buildSymbolTable now resolves once:
- FieldSymbol gains typeName/typeNamespaceId?/typeContractSpaceId?/optional/list/
  typeConstructor?/attributes/malformedType?. Over-qualified field types emit
  PSL_INVALID_QUALIFIED_TYPE into the symbol-table diagnostics (a ParseDiagnostic,
  same code as before) and set malformedType (replacing the per-package
  typeAlreadyReported view flag).
- ScalarSymbol/TypeAliasSymbol gain the resolved binding shape (baseType?/
  typeConstructor?/isConstructor/attributes) via ResolvedNamedTypeBinding.
- ModelSymbol/CompositeTypeSymbol gain their model/composite-level attributes.

Faithful port: same diagnostic code, same span derivation, same verbatim arg
rendering, same isConstructor gating \u2014 so D2/D3 are pure deletions + field-access
rewires. The Resolved* types are exported from the package index.

Tests: 11 new symbol-table resolution tests (qualified split bare/dot/colon/
over-qualified, optional/list, constructor, field+model+composite attributes,
scalar-vs-alias resolved binding). psl-parser 361/361 green; typecheck clean;
lint:deps green. Interpreter view layers untouched (deleted in D2/D3).

Note for D2: CstFieldView declared a typeRef? field that symbol-views.ts never
populated (always undefined from the view path); FieldSymbol omits it. The SQL
helpers that read field.typeRef sourced it from a non-view path \u2014 D2 handles
that sourcing.

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]>
SevInf added a commit that referenced this pull request Jun 30, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jun 30, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 3, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 3, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 7, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 7, 2026
Replace the bespoke enumOf combinator throughout ADR 231 with the
shipped composition: enums are oneOf over per-member matchers --
identifier(name) for bare identifiers, pinned str(value)/num(value)
for quoted-string/number members. Updates the relation code sample,
the at-a-glance and language-server narratives, the scalars kit
description, and the ADR 224 reference line; the rejected-alternative
entry now records the dedicated enum leaf as the rejected option in
favour of oneOf composition (principle #4). InferAttr union types are
unchanged.

Signed-off-by: Serhii Tatarintsev <[email protected]>
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