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

Refactor the emit command to load contract from config - #5

Merged
wmadden merged 4 commits into
mainfrom
emit-from-config
Nov 12, 2025
Merged

wmadden merged 4 commits into
mainfrom
emit-from-config

Conversation

@wmadden

@wmadden wmadden commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@wmadden
wmadden force-pushed the emit-from-config branch 2 times, most recently from f301e45 to 04a5b19 Compare November 12, 2025 09:08
@wmadden
wmadden merged commit 2aaa6ec into main Nov 12, 2025
@wmadden
wmadden deleted the emit-from-config branch November 12, 2025 09:37
jkomyno added a commit that referenced this pull request Feb 25, 2026
… actions

Address wmadden's PR #168 review feedback (blocking issue #2):

- Add DDL generation test: verifies the planner outputs ON DELETE CASCADE
  and ON UPDATE RESTRICT clauses when planning from a contract with
  referential actions against an empty database.
- Add runtime behavior tests for all five ON DELETE actions:
  CASCADE (removes children), RESTRICT (blocks delete), SET NULL
  (nullifies FK), SET DEFAULT (applies default), NO ACTION (blocks).
- Add ON UPDATE CASCADE test: propagates PK changes to children.

These tests close the spec-mandated E2E coverage gap for the referential
action matrix (spec lines 158-203, acceptance criteria #5-#6).
wmadden added a commit that referenced this pull request Mar 30, 2026
Implements M1 contract restructure per ADRs 1-3 and Decision #5:
- model.fields carries codecId+nullable at the domain level
- model.storage simplifies to optional collection name (Mongo)
- add roots, discriminator/variants (polymorphism), typed relations
- remove top-level relations and mappings from contract
- add ORM test schema fixtures (Task/Bug/Feature/User/Address/Comment)
- add type-level tests verifying ORM contract structure and InferModelRow
wmadden added a commit that referenced this pull request Mar 30, 2026
Implements M1 contract restructure per ADRs 1-3 and Decision #5:
- model.fields carries codecId+nullable at the domain level
- model.storage simplifies to optional collection name (Mongo)
- add roots, discriminator/variants (polymorphism), typed relations
- remove top-level relations and mappings from contract
- add ORM test schema fixtures (Task/Bug/Feature/User/Address/Comment)
- add type-level tests verifying ORM contract structure and InferModelRow
wmadden added a commit that referenced this pull request Mar 31, 2026
Document the six design principles that shape contract and ORM decisions
across families, with MongoDB as the forcing function that made each
explicit. Key addition: principle #5 states each model has one canonical
storage location (consistency boundary), and the embedded documents
section now explains how denormalized snapshots are value types, not the
model itself.

Update the doc-writing skill to recommend articulating design principles
early in architecture docs.
wmadden added a commit that referenced this pull request Mar 31, 2026
Implements M1 contract restructure per ADRs 1-3 and Decision #5:
- model.fields carries codecId+nullable at the domain level
- model.storage simplifies to optional collection name (Mongo)
- add roots, discriminator/variants (polymorphism), typed relations
- remove top-level relations and mappings from contract
- add ORM test schema fixtures (Task/Bug/Feature/User/Address/Comment)
- add type-level tests verifying ORM contract structure and InferModelRow
wmadden added a commit that referenced this pull request Mar 31, 2026
Document the six design principles that shape contract and ORM decisions
across families, with MongoDB as the forcing function that made each
explicit. Key addition: principle #5 states each model has one canonical
storage location (consistency boundary), and the embedded documents
section now explains how denormalized snapshots are value types, not the
model itself.

Update the doc-writing skill to recommend articulating design principles
early in architecture docs.
jkomyno pushed a commit that referenced this pull request Apr 1, 2026
Implements M1 contract restructure per ADRs 1-3 and Decision #5:
- model.fields carries codecId+nullable at the domain level
- model.storage simplifies to optional collection name (Mongo)
- add roots, discriminator/variants (polymorphism), typed relations
- remove top-level relations and mappings from contract
- add ORM test schema fixtures (Task/Bug/Feature/User/Address/Comment)
- add type-level tests verifying ORM contract structure and InferModelRow
jkomyno pushed a commit that referenced this pull request Apr 1, 2026
Document the six design principles that shape contract and ORM decisions
across families, with MongoDB as the forcing function that made each
explicit. Key addition: principle #5 states each model has one canonical
storage location (consistency boundary), and the embedded documents
section now explains how denormalized snapshots are value types, not the
model itself.

Update the doc-writing skill to recommend articulating design principles
early in architecture docs.
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 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
Anchors the additional work cut from the contract-ir-planes (TML-2584)
discussion that made the scope cut for PR #534:

* Item 1 — schema verifier issues carry namespace coordinates; delete
  effectiveSchemaForTable / locateTable / findSqlTable. The structural
  fix for F01: the SQL family verifier already knows the coordinate
  when it constructs an issue but the framework-shaped BaseSchemaIssue
  shape only carries a bare table-name string, forcing the planner to
  re-derive the coordinate via locateTable. Also surfaces a layering
  insight: BaseSchemaIssue.table is SQL-specific vocabulary at the
  framework layer; the type needs to split between framework-shared
  base and family-specific extensions (SqlSchemaIssue, MongoSchemaIssue).
* Item 2 — TML-2583 reference comments above the snapshot-read-shapes
  test exclusions (F05).
* Item 3 — generic deserializeContract<T>(json): T at the family
  interface; drop the as-unknown-as cast in the demo (PR thread #5).

Records the items deferred to TML-2584 (plane reshape, cross-reference
encoding, Namespace narrowing, constructor discipline, serializer kind
removal) so the boundary stays explicit and the next contributor can
read the slice without paging through chat history.
wmadden added a commit that referenced this pull request May 21, 2026
…/spec/plan edits, deferred-to-tickets)

Lands the substrate-altitude outputs of the artefact-review architect +
principal-engineer passes (under projects/contract-ir-planes/reviews/
artifacts-pre-d3/):

- ADR Decision 1 (A05): frame symmetric extensibility - both domain and
  storage planes are pack-extensible through the same descriptor
  surface; the current asymmetry is content, not mechanism.
- ADR Decision 3 (A03): extend EntityCoordinate with a plane axis
  (domain | storage); honest about what the coordinate addresses;
  domain -> storage directional invariant lives in a separate validator,
  not the coord shape.
- ADR Decision 5 (A07 + A08): record the rejected storageSlotKey?
  alternative + slot-key naming convention (essence + singular: enum,
  policy, role, ...). Future pack contributions follow the convention
  from S1.B onward.
- Project plan (F09): add Risk #5 (inherited "decided" fields propagate
  without challenge); name brief-assembly pre-flight questions for S1.B+.
- Project spec OQ1 (A08): lock to essence + singular.
- All references to postgresEnums in the project + slice spec/plan
  flipped to enum (the slot S1.B introduces from the start).
- Slice spec/plan: add D4 dispatch (coord plane axis code change + 1
  test); explicitly deferred A01 (slot rename) and A02b (.entries lift)
  to standalone tickets.
- D4 brief at slices/substrate/dispatches/04-coord-plane-axis.md.

Standalone tickets filed for the deferred cleanup work:
- TML-2634 (A01 substrate rename: tables -> table, etc.)
- TML-2636 (A02b namespace concretion .entries lift)

Both relatedTo TML-2584; both in the "Target-Extensible IR + Namespaces"
project per the no-sub-issues rule.

Refs: TML-2584
Related: TML-2634, TML-2636
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 21, 2026
…/spec/plan edits, deferred-to-tickets)

Lands the substrate-altitude outputs of the artefact-review architect +
principal-engineer passes (under projects/contract-ir-planes/reviews/
artifacts-pre-d3/):

- ADR Decision 1 (A05): frame symmetric extensibility - both domain and
  storage planes are pack-extensible through the same descriptor
  surface; the current asymmetry is content, not mechanism.
- ADR Decision 3 (A03): extend EntityCoordinate with a plane axis
  (domain | storage); honest about what the coordinate addresses;
  domain -> storage directional invariant lives in a separate validator,
  not the coord shape.
- ADR Decision 5 (A07 + A08): record the rejected storageSlotKey?
  alternative + slot-key naming convention (essence + singular: enum,
  policy, role, ...). Future pack contributions follow the convention
  from S1.B onward.
- Project plan (F09): add Risk #5 (inherited "decided" fields propagate
  without challenge); name brief-assembly pre-flight questions for S1.B+.
- Project spec OQ1 (A08): lock to essence + singular.
- All references to postgresEnums in the project + slice spec/plan
  flipped to enum (the slot S1.B introduces from the start).
- Slice spec/plan: add D4 dispatch (coord plane axis code change + 1
  test); explicitly deferred A01 (slot rename) and A02b (.entries lift)
  to standalone tickets.
- D4 brief at slices/substrate/dispatches/04-coord-plane-axis.md.

Standalone tickets filed for the deferred cleanup work:
- TML-2634 (A01 substrate rename: tables -> table, etc.)
- TML-2636 (A02b namespace concretion .entries lift)

Both relatedTo TML-2584; both in the "Target-Extensible IR + Namespaces"
project per the no-sub-issues rule.

Refs: TML-2584
Related: TML-2634, TML-2636
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 21, 2026
…/spec/plan edits, deferred-to-tickets)

Lands the substrate-altitude outputs of the artefact-review architect +
principal-engineer passes (under projects/contract-ir-planes/reviews/
artifacts-pre-d3/):

- ADR Decision 1 (A05): frame symmetric extensibility - both domain and
  storage planes are pack-extensible through the same descriptor
  surface; the current asymmetry is content, not mechanism.
- ADR Decision 3 (A03): extend EntityCoordinate with a plane axis
  (domain | storage); honest about what the coordinate addresses;
  domain -> storage directional invariant lives in a separate validator,
  not the coord shape.
- ADR Decision 5 (A07 + A08): record the rejected storageSlotKey?
  alternative + slot-key naming convention (essence + singular: enum,
  policy, role, ...). Future pack contributions follow the convention
  from S1.B onward.
- Project plan (F09): add Risk #5 (inherited "decided" fields propagate
  without challenge); name brief-assembly pre-flight questions for S1.B+.
- Project spec OQ1 (A08): lock to essence + singular.
- All references to postgresEnums in the project + slice spec/plan
  flipped to enum (the slot S1.B introduces from the start).
- Slice spec/plan: add D4 dispatch (coord plane axis code change + 1
  test); explicitly deferred A01 (slot rename) and A02b (.entries lift)
  to standalone tickets.
- D4 brief at slices/substrate/dispatches/04-coord-plane-axis.md.

Standalone tickets filed for the deferred cleanup work:
- TML-2634 (A01 substrate rename: tables -> table, etc.)
- TML-2636 (A02b namespace concretion .entries lift)

Both relatedTo TML-2584; both in the "Target-Extensible IR + Namespaces"
project per the no-sub-issues rule.

Refs: TML-2584
Related: TML-2634, TML-2636
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 21, 2026
…/spec/plan edits, deferred-to-tickets)

Lands the substrate-altitude outputs of the artefact-review architect +
principal-engineer passes (under projects/contract-ir-planes/reviews/
artifacts-pre-d3/):

- ADR Decision 1 (A05): frame symmetric extensibility - both domain and
  storage planes are pack-extensible through the same descriptor
  surface; the current asymmetry is content, not mechanism.
- ADR Decision 3 (A03): extend EntityCoordinate with a plane axis
  (domain | storage); honest about what the coordinate addresses;
  domain -> storage directional invariant lives in a separate validator,
  not the coord shape.
- ADR Decision 5 (A07 + A08): record the rejected storageSlotKey?
  alternative + slot-key naming convention (essence + singular: enum,
  policy, role, ...). Future pack contributions follow the convention
  from S1.B onward.
- Project plan (F09): add Risk #5 (inherited "decided" fields propagate
  without challenge); name brief-assembly pre-flight questions for S1.B+.
- Project spec OQ1 (A08): lock to essence + singular.
- All references to postgresEnums in the project + slice spec/plan
  flipped to enum (the slot S1.B introduces from the start).
- Slice spec/plan: add D4 dispatch (coord plane axis code change + 1
  test); explicitly deferred A01 (slot rename) and A02b (.entries lift)
  to standalone tickets.
- D4 brief at slices/substrate/dispatches/04-coord-plane-axis.md.

Standalone tickets filed for the deferred cleanup work:
- TML-2634 (A01 substrate rename: tables -> table, etc.)
- TML-2636 (A02b namespace concretion .entries lift)

Both relatedTo TML-2584; both in the "Target-Extensible IR + Namespaces"
project per the no-sub-issues rule.

Refs: TML-2584
Related: TML-2634, TML-2636
Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 22, 2026
D1 walks Risk #5 (a)+(b) per surface (all eight subtractive); enumerates
the 4-package source migration; pins the descriptor surface as unchanged;
makes pnpm fixtures:check an explicit non-gate for D1 (D2 regenerates).
Composer-2.5; ~15-22 files; >25-file or >30-cascade trigger splits D1 → D1a+D1b.

TML-2623

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

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

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

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

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

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

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

Refs TML-2623.

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

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

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

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

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

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

Refs TML-2623.

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

TML-2623

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

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

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

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

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

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

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

Refs TML-2623.

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

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

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

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

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

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

Refs TML-2623.

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

TML-2623

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

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

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

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

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

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

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

Refs TML-2623.

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

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

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

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

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

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

Refs TML-2623.

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

TML-2623

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 27, 2026
…rs + serializer hydration

D1 dispatch brief for S1.C — framework substrate move from
string-keyed to object-pair-keyed cross-references. Lands the
framework cross-ref type (CrossReference { namespace, model }),
the NamespaceId structural string brand, SQL + Mongo validators
for the new shape, and family serializer hydration round-trip.

Four design decisions pre-locked with rationale and rejected
alternatives:
- A: NamespaceId is a structural string brand (not arktype-tagged).
- B: single shared CrossReference type for relation.to / model.base /
  roots[*]; storage-plane FK keeps a distinct shape per ADR D4.
- C: namespace is required on every cross-reference (no implicit-
  same-namespace fallback).
- D: cross-references are properties of relations/models/roots; no
  cross-cutting registry.

Scope explicitly bounds out authoring lowering (D2), emitter typegen
(D2), codec-alias relocation (D2), planner / schema-IR consumers (D2),
fixture regen (D3), and Contract.models/valueObjects flat-field removal
(D2/D3 once domain plane is populated). File count forecast ~15 with
explicit re-decomposition trigger at >18 files / >25 typecheck cascade.

Refusal triggers (S1.B retro inheritance): lockfile-cruft halt;
stale-dist hygiene pre-flight mandatory; scope guardrails.

Risk #5 (a)+(b) walked across 11 surfaces; every row satisfies
(a) tighten-existing-shape + (b) structural-validation-already-enforces.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 27, 2026
Two compounding failures named on the S1.C D2 brief-assembly
cycle:

1. Brief composition was outsourced to a subagent via a ~250-line
   dictation prompt. The subagent transcribed pre-formed decisions.
   Subagents are for discovery, implementation, or review — not
   composition the orchestrator can do.

2. Briefs themselves were too big. Pre-enumerating every file, line
   number, consumer site, and Risk #5 row in the brief duplicates
   work the implementer's first grep step produces. The brief is a
   settled-decisions + boundary + gates document, not a pre-decomposed
   work plan.

Target brief length: ≤120 lines. S1.B D1 (135) is the upper bound;
aim 80–100. If brief authoring takes >15 min, the orchestrator is
doing the implementer's work.

Process changes locked in: briefs are written by the orchestrator
full stop; design-decision settlement is a separable task that can
warrant a subagent dispatch; spec + plan + reviewer output are the
orchestrator's loaded context.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 27, 2026
…rs + serializer hydration

D1 dispatch brief for S1.C — framework substrate move from
string-keyed to object-pair-keyed cross-references. Lands the
framework cross-ref type (CrossReference { namespace, model }),
the NamespaceId structural string brand, SQL + Mongo validators
for the new shape, and family serializer hydration round-trip.

Four design decisions pre-locked with rationale and rejected
alternatives:
- A: NamespaceId is a structural string brand (not arktype-tagged).
- B: single shared CrossReference type for relation.to / model.base /
  roots[*]; storage-plane FK keeps a distinct shape per ADR D4.
- C: namespace is required on every cross-reference (no implicit-
  same-namespace fallback).
- D: cross-references are properties of relations/models/roots; no
  cross-cutting registry.

Scope explicitly bounds out authoring lowering (D2), emitter typegen
(D2), codec-alias relocation (D2), planner / schema-IR consumers (D2),
fixture regen (D3), and Contract.models/valueObjects flat-field removal
(D2/D3 once domain plane is populated). File count forecast ~15 with
explicit re-decomposition trigger at >18 files / >25 typecheck cascade.

Refusal triggers (S1.B retro inheritance): lockfile-cruft halt;
stale-dist hygiene pre-flight mandatory; scope guardrails.

Risk #5 (a)+(b) walked across 11 surfaces; every row satisfies
(a) tighten-existing-shape + (b) structural-validation-already-enforces.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 27, 2026
Two compounding failures named on the S1.C D2 brief-assembly
cycle:

1. Brief composition was outsourced to a subagent via a ~250-line
   dictation prompt. The subagent transcribed pre-formed decisions.
   Subagents are for discovery, implementation, or review — not
   composition the orchestrator can do.

2. Briefs themselves were too big. Pre-enumerating every file, line
   number, consumer site, and Risk #5 row in the brief duplicates
   work the implementer's first grep step produces. The brief is a
   settled-decisions + boundary + gates document, not a pre-decomposed
   work plan.

Target brief length: ≤120 lines. S1.B D1 (135) is the upper bound;
aim 80–100. If brief authoring takes >15 min, the orchestrator is
doing the implementer's work.

Process changes locked in: briefs are written by the orchestrator
full stop; design-decision settlement is a separable task that can
warrant a subagent dispatch; spec + plan + reviewer output are the
orchestrator's loaded context.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 28, 2026
…rs + serializer hydration

D1 dispatch brief for S1.C — framework substrate move from
string-keyed to object-pair-keyed cross-references. Lands the
framework cross-ref type (CrossReference { namespace, model }),
the NamespaceId structural string brand, SQL + Mongo validators
for the new shape, and family serializer hydration round-trip.

Four design decisions pre-locked with rationale and rejected
alternatives:
- A: NamespaceId is a structural string brand (not arktype-tagged).
- B: single shared CrossReference type for relation.to / model.base /
  roots[*]; storage-plane FK keeps a distinct shape per ADR D4.
- C: namespace is required on every cross-reference (no implicit-
  same-namespace fallback).
- D: cross-references are properties of relations/models/roots; no
  cross-cutting registry.

Scope explicitly bounds out authoring lowering (D2), emitter typegen
(D2), codec-alias relocation (D2), planner / schema-IR consumers (D2),
fixture regen (D3), and Contract.models/valueObjects flat-field removal
(D2/D3 once domain plane is populated). File count forecast ~15 with
explicit re-decomposition trigger at >18 files / >25 typecheck cascade.

Refusal triggers (S1.B retro inheritance): lockfile-cruft halt;
stale-dist hygiene pre-flight mandatory; scope guardrails.

Risk #5 (a)+(b) walked across 11 surfaces; every row satisfies
(a) tighten-existing-shape + (b) structural-validation-already-enforces.

Signed-off-by: Will Madden <[email protected]>
wmadden added a commit that referenced this pull request May 28, 2026
Two compounding failures named on the S1.C D2 brief-assembly
cycle:

1. Brief composition was outsourced to a subagent via a ~250-line
   dictation prompt. The subagent transcribed pre-formed decisions.
   Subagents are for discovery, implementation, or review — not
   composition the orchestrator can do.

2. Briefs themselves were too big. Pre-enumerating every file, line
   number, consumer site, and Risk #5 row in the brief duplicates
   work the implementer's first grep step produces. The brief is a
   settled-decisions + boundary + gates document, not a pre-decomposed
   work plan.

Target brief length: ≤120 lines. S1.B D1 (135) is the upper bound;
aim 80–100. If brief authoring takes >15 min, the orchestrator is
doing the implementer's work.

Process changes locked in: briefs are written by the orchestrator
full stop; design-decision settlement is a separable task that can
warrant a subagent dispatch; spec + plan + reviewer output are the
orchestrator's loaded context.

Signed-off-by: Will Madden <[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]>
wmadden-electric added a commit that referenced this pull request Jun 30, 2026
Correct the inverted thesis. A native Postgres enum is a distinct database
type (persistence plane), not a domain enum. Two directions:

- externally-managed / adopted (primary): the type is the source; PN derives
  the value-set (typing) and a db.enums accessor (members where name=value)
  from it. No authored domain enum.
- authored (phase 2): a user may realize a domain enum as a native type
  (domain -> storage); only here is native a persistence strategy for a
  domain enum.

Ripples fixed: db.enums derived from the type (external) / domain enum
(authored); the #5 spine and R2/R4 no longer assume a domain enum always
exists. Technical model unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Jul 2, 2026
Correct the inverted thesis. A native Postgres enum is a distinct database
type (persistence plane), not a domain enum. Two directions:

- externally-managed / adopted (primary): the type is the source; PN derives
  the value-set (typing) and a db.enums accessor (members where name=value)
  from it. No authored domain enum.
- authored (phase 2): a user may realize a domain enum as a native type
  (domain -> storage); only here is native a persistence strategy for a
  domain enum.

Ripples fixed: db.enums derived from the type (external) / domain enum
(authored); the #5 spine and R2/R4 no longer assume a domain enum always
exists. Technical model unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
SevInf added a commit that referenced this pull request Jul 23, 2026
…ns, spec/brief reconciliation

Clears the remaining faithfulness-audit findings not already handled by the
prior audit-driven pass:

- legacy-optional-relation-filters: add the 6th upstream test (`filter empty
  optional relation`, the tests.ts:117 `bio:null` duplicate) so the 6 ledger
  lines map 1:1 to 6 `it()` blocks (accounting-break fix).
- composites-object-create: tighten `set null shorthand` from the disjoint
  `null || undefined` to strict `content: null` (the sibling `set null` test
  proves the read-back is null).
- multiple-types: correct the stale header that falsely listed test #5 as
  non-portable; it is ported via findMany.
- spec.md: reconcile §"Type-level assertions" with the mandatory briefs —
  assertions go INLINE in the same it(), NOT in sibling .test-d.ts files.

Verified: touched SQL suites 11 passed; composites mongo 8 passed + 2
expected-fail; pnpm typecheck exit 0; pnpm lint exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 23, 2026
…ns, spec/brief reconciliation

Clears the remaining faithfulness-audit findings not already handled by the
prior audit-driven pass:

- legacy-optional-relation-filters: add the 6th upstream test (`filter empty
  optional relation`, the tests.ts:117 `bio:null` duplicate) so the 6 ledger
  lines map 1:1 to 6 `it()` blocks (accounting-break fix).
- composites-object-create: tighten `set null shorthand` from the disjoint
  `null || undefined` to strict `content: null` (the sibling `set null` test
  proves the read-back is null).
- multiple-types: correct the stale header that falsely listed test #5 as
  non-portable; it is ported via findMany.
- spec.md: reconcile §"Type-level assertions" with the mandatory briefs —
  assertions go INLINE in the same it(), NOT in sibling .test-d.ts files.

Verified: touched SQL suites 11 passed; composites mongo 8 passed + 2
expected-fail; pnpm typecheck exit 0; pnpm lint exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Serhii Tatarintsev <[email protected]>
SevInf added a commit that referenced this pull request Jul 23, 2026
…ns, spec/brief reconciliation

Clears the remaining faithfulness-audit findings not already handled by the
prior audit-driven pass:

- legacy-optional-relation-filters: add the 6th upstream test (`filter empty
  optional relation`, the tests.ts:117 `bio:null` duplicate) so the 6 ledger
  lines map 1:1 to 6 `it()` blocks (accounting-break fix).
- composites-object-create: tighten `set null shorthand` from the disjoint
  `null || undefined` to strict `content: null` (the sibling `set null` test
  proves the read-back is null).
- multiple-types: correct the stale header that falsely listed test #5 as
  non-portable; it is ported via findMany.
- spec.md: reconcile §"Type-level assertions" with the mandatory briefs —
  assertions go INLINE in the same it(), NOT in sibling .test-d.ts files.

Verified: touched SQL suites 11 passed; composites mongo 8 passed + 2
expected-fail; pnpm typecheck exit 0; pnpm lint exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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