Skip to content

refactor(framework): collapse the single/multi-space runner split into one MigrationRunner (TML-2464, TML-2476, TML-2478)#655

Merged
wmadden merged 8 commits into
mainfrom
tml-2476-add-strictverification-and-context-to
May 31, 2026
Merged

refactor(framework): collapse the single/multi-space runner split into one MigrationRunner (TML-2464, TML-2476, TML-2478)#655
wmadden merged 8 commits into
mainfrom
tml-2476-add-strictverification-and-context-to

Conversation

@wmadden-electric
Copy link
Copy Markdown
Contributor

@wmadden-electric wmadden-electric commented May 31, 2026

The decision: there is now exactly one migration runner. The transitional split between a "single-space" runner and a "multi-space" runner — selected at the call site by a capability guard — is gone. Applying a migration is one method, MigrationRunner.execute, and the app-only case is just a one-member list.

Here is the entire change, at the call site that applies a migration across contract spaces:

// before — a capability guard picks the "multi-space" path, then two casts
// bridge the narrow per-space option type and the runner's wider interface:
if (!hasMultiSpaceRunner(runner)) {
  throw errorRunnerFailed(/* … this runner can't apply across spaces … */);
}

const perSpaceOptions: MultiSpaceRunnerPerSpaceOptions<TFamilyId, TTargetId>[] =
  orderedResolutions.map((r) => ({ /* …, */ strictVerification: false }))
    as MultiSpaceRunnerPerSpaceOptions<TFamilyId, TTargetId>[];

const runnerResult = await (
  runner as MultiSpaceCapableRunner<TFamilyId, TTargetId>
).executeAcrossSpaces({ driver, perSpaceOptions });
// after — one runner, one option type. No guard, no casts:
const perSpaceOptions = orderedResolutions.map((r) => ({
  /* …, */ strictVerification: false,
}));

const runnerResult = await runner.execute({ driver, perSpaceOptions });

Why this is safe now

The two-runner split was never a design we wanted — it was scaffolding for a migration in progress. When contract spaces landed, only some targets understood the "apply across many spaces" shape; the rest still spoke the old single-space shape. The hasMultiSpaceRunner guard let the framework tolerate both at once: route to the new path when the target supported it, fall back otherwise.

That migration is now complete. Every target speaks the aggregate shape — Postgres, SQLite (TML-2463), and Mongo (TML-2408). With no target left on the old path, the guard, the fallback, and the separate "multi-space" interface no longer distinguish anything. They just leave a phantom "other runner" in every reader's mental model. This PR deletes that phantom.

What collapses

  • One runner interface. MultiSpaceCapableRunner, MultiSpaceRunnerResult, and MultiSpaceRunnerPerSpaceOptions fold directly into MigrationRunner, MigrationRunnerResult, and MigrationRunnerPerSpaceOptions — not preserved as aliases. executeAcrossSpaces becomes the one MigrationRunner.execute({ driver, perSpaceOptions }); the former single-space callers pass a one-member list. (executeOnConnection stays — it is the intra-transaction fan-out primitive, not a second public entry point.)
  • One set of names. Once there is no non-aggregate path, the Aggregate… qualifier on the public surface describes nothing, so it drops: planAggregateplan, executeAggregateApplyexecuteApply, AggregatePerSpacePlanPerSpacePlan, AggregatePlannerErrorPlannerError, apply-aggregate.tsapply.ts. ContractSpaceAggregate and ContractSpaceMember are kept — they name a data shape, not a code path, so the qualifier still carries information.
  • One framing. Active docstrings, comments, and test names stop treating "single-space" / "multi-space-capable" as a meaningful distinction, and the *.multi-space.test.ts files merge into their canonical counterparts. ADRs that document the transition are left untouched, as an immutable record.

The two fold-ins

The before/after above also resolves TML-2476: those two as-casts existed because MultiSpaceRunnerPerSpaceOptions was a strict subset that omitted strictVerification and context. Unifying the option type — it now declares strictVerification?: boolean and context?: OperationContext — removes the reason for the casts, so they go too. Shipping 2476 on its own would have meant editing a type this PR then deletes.

TML-2478 asked for structured CLI error envelopes on migrate pre-flight filesystem failures. Re-checking the code showed the M6 restructure already routes those failures through errorUnexpected + notOk rather than throwing past handleResult — the gap the ticket described is already closed. So this PR adds regression tests that pin that behaviour, and 2478 closes as fixed-by-restructure.

Scope

Pure refactor plus test hardening. Migration execution behaviour is unchanged: the app-only case runs through exactly the same code as the multi-member case (extensions = []). verifySchema, the canonical family schema-verification primitive, predates this PR and is untouched.

Test plan

  • pnpm typecheck (clean locally)
  • pnpm test:packages
  • pnpm test:integration
  • pnpm test:e2e
  • pnpm lint:deps

CI is the gate. Locally, test:packages showed intermittent infra flakiness (Postgres connection churn under parallel vitest; a cli-telemetry PATH issue in recursive exec) unrelated to these changes; targeted reruns of the migration / apply / framework / cli suites passed.

Alternatives considered

  • Keep MultiSpaceCapableRunner as a deprecated alias. Rejected: an alias preserves the phantom "other runner" the PR exists to remove. The value is in there being one shape, not in a soft landing.
  • Keep the Aggregate… qualifier. Rejected: with no non-aggregate counterpart, it distinguishes nothing on the public surface. (Kept on ContractSpaceAggregate / ContractSpaceMember, where it names data rather than a path.)
  • Ship TML-2476 as its own PR. Rejected: its casts hang off the very type this PR dissolves; a standalone PR would touch a type that disappears here days later.
  • Write a production fix for TML-2478. Rejected: the restructure already fixed the throw-past-handleResult gap; a "fix" would be a no-op, so the honest deliverable is a regression test.
  • Three separate PRs. Rejected: all three touch the same runner / CLI file-set. Splitting buys three context reloads for the reviewer with no isolation benefit.

Closes TML-2464
Closes TML-2476
Closes TML-2478

Summary by CodeRabbit

Release Notes

  • Refactoring
    • Unified migration runner architecture across spaces into single, consistent execution interface
    • Consolidated migration planning and verification workflows for simplified orchestration
    • Harmonized per-space execution paths to reduce code duplication
    • Enhanced internal result structure and error reporting for improved diagnostics
    • Improved type consistency across migration subsystems

@wmadden-electric wmadden-electric requested a review from a team as a code owner May 31, 2026 10:47
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 0fbc5711-746b-40f0-a048-ce2c2be2b6c1

📥 Commits

Reviewing files that changed from the base of the PR and between 70bd5ed and e1310ae.

📒 Files selected for processing (78)
  • docs/architecture docs/subsystems/10. MongoDB Family.md
  • docs/architecture docs/subsystems/5. Adapters & Targets.md
  • docs/architecture docs/subsystems/7. Migration System.md
  • examples/multi-extension-monorepo/README.md
  • examples/multi-extension-monorepo/test/e2e.integration.test.ts
  • packages/1-framework/1-core/framework-components/src/control/control-capabilities.ts
  • packages/1-framework/1-core/framework-components/src/control/control-instances.ts
  • packages/1-framework/1-core/framework-components/src/control/control-migration-types.ts
  • packages/1-framework/1-core/framework-components/src/exports/control.ts
  • packages/1-framework/3-tooling/cli/src/commands/migrate.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-plan.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-status.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/apply.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/db-apply.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/db-init.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/db-update.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/db-verify.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/migration-apply.ts
  • packages/1-framework/3-tooling/cli/src/control-api/types.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migrations.ts
  • packages/1-framework/3-tooling/cli/test/commands/migrate-to-contract.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-invariants.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-list.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/apply.progress.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/apply.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/client.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-init.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-update.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/progress.test.ts
  • packages/1-framework/3-tooling/cli/test/output.db-update.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/aggregate-loader-preflight.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/contract-space-seed-phase.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/formatters/migration-list-render.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/formatters/migration-list-styler.test.ts
  • packages/1-framework/3-tooling/migration/src/aggregate/planner-types.ts
  • packages/1-framework/3-tooling/migration/src/aggregate/planner.ts
  • packages/1-framework/3-tooling/migration/src/aggregate/strategies/graph-walk.ts
  • packages/1-framework/3-tooling/migration/src/aggregate/strategies/synth.ts
  • packages/1-framework/3-tooling/migration/src/aggregate/verifier.ts
  • packages/1-framework/3-tooling/migration/src/exports/aggregate.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/planner.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/verifier.test.ts
  • packages/1-framework/3-tooling/migration/test/deletable-node-modules.test.ts
  • packages/2-sql/5-runtime/src/sql-marker.ts
  • packages/2-sql/9-family/src/core/migrations/types.ts
  • packages/2-sql/9-family/src/exports/control.ts
  • packages/2-sql/9-family/test/migrations.types.test-d.ts
  • packages/3-mongo-target/1-mongo-target/src/core/control-target.ts
  • packages/3-mongo-target/1-mongo-target/src/core/mongo-runner.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/runner.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/statement-builders.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/runner.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/statement-builders.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/db-init-update.cli.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.storage-types.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.across-spaces.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.basic.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.errors.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.execution-checks.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.idempotency.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.policy.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/schema-verify.after-runner.integration.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/db-init-update.cli.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/runner.across-spaces.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/runner.basic.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/runner.errors.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/runner.idempotency.test.ts
  • test/e2e/framework/test/sqlite/migrations/harness.ts
  • test/integration/test/cli.db-init.e2e.test.ts
  • test/integration/test/cli.db-update.e2e.test.ts
  • test/integration/test/extension-pgvector-scenario-a.e2e.integration.test.ts
  • test/integration/test/mongo/aggregate-e2e.test.ts
  • test/integration/test/mongo/codec-rehydration-guardrail.test.ts
  • test/integration/test/mongo/runner.test.ts

📝 Walkthrough

Walkthrough

Refactors migration execution to a unified per-space execute({ driver, perSpaceOptions }) API. Updates core runner types/results, SQL/Postgres/SQLite/Mongo runners, CLI operations/output types, docs, and tests. Renames aggregate/multi-space terminology to per-space across the codebase.

Changes

Per-space Execution Protocol

Layer / File(s) Summary
Core runner contract and types
packages/.../control-migration-types.ts, .../exports/control.ts
Defines MigrationRunner.execute with perSpaceOptions, per-space success/failure shapes (failingSpace), removes MultiSpace* types.
Target runners (SQL/Mongo/Postgres/SQLite)
packages/2-sql/..., packages/3-targets/..., packages/3-mongo-target/...
Adopt execute entrypoint, wrap multi-space in one call, adapt result typing, keep per-space projection/verification.
CLI control pipeline
packages/1-framework/3-tooling/cli/src/control-api/*
Switch to planMigration/applyMigration and per-space execution entries, update result surfaces and progress labels.
Planner/Verifier rename
packages/1-framework/3-tooling/migration/src/aggregate/*
Rename planAggregate→planMigration, verifyAggregate→verifyMigration; update exported types.
Docs and tests
docs/architecture/*, examples/*, tests/*
Align terminology and invocations to per-space execute; update expectations and types accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Planner as planMigration
  participant Apply as applyMigration
  participant Runner as MigrationRunner.execute
  participant DB

  CLI->>Planner: compute PerSpacePlan map
  Planner-->>CLI: PlannerOutput (applyOrder, plans)
  CLI->>Apply: { plans, order, driver, capability }
  Apply->>Runner: execute({ driver, perSpaceOptions[] })
  loop each space (ordered)
    Runner->>DB: apply plan, verify, write marker
    DB-->>Runner: per-space outcome
  end
  Runner-->>Apply: { perSpaceResults }
  Apply-->>CLI: formatted per-space summary
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • prisma/prisma-next#494: Similar per-space execute refactor for Mongo runners and marker handling.
  • prisma/prisma-next#474: Core migration runner/control and CLI model shift to execute({ perSpaceOptions }) and PerSpaceExecutionEntry.
  • prisma/prisma-next#438: Mongo migration docs updated to the same per-space execute and failingSpace semantics.

Suggested reviewers

  • aqrln

Poem

A rabbit taps the spacebar twice,
One hop per-space, precise and nice.
No more “across,” one “execute”—
Plans in a row, results to boot.
Markers advance, we roll or stay;
Verify, commit—then bound away! 🐇✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2476-add-strictverification-and-context-to

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 31, 2026

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: 81f546f

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 31, 2026

size-limit report 📦

Path Size
postgres / no-emit 135.37 KB (0%)
postgres / emit 125.16 KB (0%)
mongo / no-emit 73.9 KB (0%)
mongo / emit 68.89 KB (0%)

@wmadden-electric wmadden-electric changed the title refactor(framework): make aggregate-native the only migration mode (TML-2464, TML-2476, TML-2478) refactor(framework): collapse the single/multi-space runner split into one MigrationRunner (TML-2464, TML-2476, TML-2478) May 31, 2026
wmadden added 8 commits May 31, 2026 13:20
Unify per-space execution on MigrationRunner.execute with
MigrationRunnerPerSpaceOptions (including strictVerification and
context), fold aggregate success/failure types into the framework
runner result shapes, and remove the hasMultiSpaceRunner guard plus
MultiSpaceCapableRunner. Sql, Postgres, SQLite, and Mongo runners
now implement the single execute entry point; apply-aggregate calls it
directly without casts.

Signed-off-by: Will Madden <madden@prisma.io>
Wrap single-space SqlMigrationRunner integration tests in a
one-element perSpaceOptions list, rename multi-space tests to execute,
and align CLI mocks with MigrationRunnerResult.

Signed-off-by: Will Madden <madden@prisma.io>
…ecute

The package-test run did not cover test/integration or the sqlite e2e
harness, so they still referenced the deleted hasMultiSpaceRunner guard,
MultiSpaceRunnerPerSpaceOptions, and runner.executeAcrossSpaces after the
MigrationRunner collapse. Migrate them to the unified runner.execute
per-space API, read results via perSpaceResults, and tidy the stray blank
lines and stale executeAcrossSpaces comments left by the rewrap.

Signed-off-by: Will Madden <madden@prisma.io>
…ly surfaces

TML-2464 AC8. The Aggregate qualifier named the migration planner/apply
path, which no longer has a non-aggregate counterpart, so it carries no
information on the public surface. Drop it from the planner and apply
families while keeping the ContractSpaceAggregate / ContractSpaceMember
data shapes (and the AggregateCurrentDBState / AggregateMigrationEdgeRef
value types) that describe what a value is.

Renames: planAggregate -> planMigration; executeAggregateApply ->
executeApply (+ ExecuteApplyOptions); applyAggregate -> applyMigration
(+ ApplyMigrationInputs/Value/Result, ApplyAction, ApplyRunnerFailure);
AggregatePerSpacePlan -> PerSpacePlan; AggregatePerSpaceExecutionEntry ->
PerSpaceExecutionEntry; AggregatePlannerInput/Output/Success/Error ->
Planner*; files db-apply-aggregate.ts -> db-apply.ts and apply-aggregate.ts
-> apply.ts (+ their test files). Hard rename, no compat aliases.

The aggregate verifier surface (verifyAggregate / AggregateVerifier*) is
left as-is: no verifier symbol is in the AC8 rename set, so it stays out
of this pass to avoid unsanctioned scope.

Signed-off-by: Will Madden <madden@prisma.io>
TML-2464 AC8 follow-up. D2 dropped the Aggregate path-qualifier from the
planner and apply surfaces but left the verifier surface qualified, an
incoherent half-renamed public API. Every verifier symbol names the verify
path (no non-aggregate counterpart), so drop the qualifier consistently
with the renamed planMigration / applyMigration siblings:

  verifyAggregate -> verifyMigration; runVerifyAggregate -> runVerifyMigration;
  AggregateVerifierInput/Output/Success/Error -> Verifier*.

The ContractSpaceAggregate / ContractSpaceMember data shapes the verifier
operates over keep their names. Also fix the stale "Aggregate planner output"
throw string in the renamed apply primitive. Hard rename, no compat aliases.

Signed-off-by: Will Madden <madden@prisma.io>
The runner API was unified onto a single per-space `execute` entry
point, so the single-space vs multi-space distinction no longer exists.
Sweep active docstrings, comments, and test descriptions to treat
aggregate / per-space as the only mode: drop "single-space" / "multi-space"
mode framing, rephrase descriptive uses to "across spaces" / "per-space",
and the n=1 case to "one space" / "app-only".

Rename the runner test files that carried the now-redundant qualifier:
- test/integration/test/mongo/multi-space-runner.test.ts -> runner.test.ts
- examples/multi-extension-monorepo/test/multi-space.e2e.integration.test.ts -> e2e.integration.test.ts
- adapters/postgres .../runner.multi-space.integration.test.ts -> runner.across-spaces.integration.test.ts
- adapters/sqlite .../runner.multi-space.test.ts -> runner.across-spaces.test.ts

Update the three active subsystem docs (Migration System, Adapters &
Targets, MongoDB Family) to the unified `execute` surface and aggregate-only
framing; ADR 212 is left untouched as historical record.

Prose / comments / test descriptions / file renames only; no behaviour change.

Signed-off-by: Will Madden <madden@prisma.io>
…ion ID

Four review follow-ups, prose/comments only:
- drop the stray AM4 acceptance-criterion prefix on the pg db-init-update
  docblock bullet (describe the rollback property directly).
- mongo-runner projectSchema docblock: drop single-space/pre-aggregate
  framing, matching its sibling docblock.
- example e2e overview: drop redundant "Multi-space " ("across three
  spaces" already carries it).
- cli migrations formatter: reword the two "Single-space fallback"
  comments to "app-only / no-aggregate-breakdown fallback" (branch kept).

Signed-off-by: Will Madden <madden@prisma.io>
…s (TML-2478)

Lock the M6 restructure that routes pre-flight loading failures through
structured-error paths instead of throwing past handleResult:

- buildReadAggregate terminal catch: a non-MigrationToolsError raised during
  pre-flight assembly returns errorUnexpected (notOk), and a MigrationToolsError
  maps via mapMigrationToolsError — neither propagates.
- migrate command contract read: a missing top-level contract.json yields
  errorFileNotFound (PN-CLI-4004) and an unparseable one yields
  errorContractValidationFailed (PN-CLI-4003), distinct from the corrupt
  target-bundle end-contract.json case already covered.

Test-only; no production code changed.

Signed-off-by: Will Madden <madden@prisma.io>
@wmadden wmadden force-pushed the tml-2476-add-strictverification-and-context-to branch from 81f546f to e1310ae Compare May 31, 2026 11:20
@wmadden wmadden merged commit c53e906 into main May 31, 2026
9 of 10 checks passed
@wmadden wmadden deleted the tml-2476-add-strictverification-and-context-to branch May 31, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants