Document migration authoring strategy and emit/runner ADRs#352
Document migration authoring strategy and emit/runner ADRs#352
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughAdds nine ADRs and multiple subsystem updates to make Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (plan/emit/apply)
participant Planner as Planner (OpFactoryCall[] IR)
participant RendererOps as Renderer (renderOps)
participant RendererTS as Renderer (renderTypeScript)
participant Artifacts as Artifacts (`ops.json` + `migration.json` + `migration.ts`)
participant Runner as Runner
participant DB as Database
CLI->>Planner: run "migration plan"/"emit"
Planner->>Planner: produce OpFactoryCall[] IR
Planner->>RendererOps: renderOps(IR)
RendererOps->>Artifacts: write `ops.json` + attest `migration.json`
Planner->>RendererTS: renderTypeScript(IR)
RendererTS->>Artifacts: write `migration.ts` (authoring surface)
CLI->>Runner: "migration apply"
Runner->>Artifacts: read `ops.json` + `migration.json`
Runner->>Runner: verify migrationId attestation
Runner->>DB: execute precheck → execute → postcheck per operation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/middleware-telemetry
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/runtime-executor
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-pipeline-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (3)
docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md (1)
17-35: Move implementation algorithm details out of the ADR body.This block is effectively production-level implementation logic. For ADRs in this repo, please keep the decision and constraints, and move exact algorithm/code mechanics to subsystem docs or implementation docs.
Based on learnings: "ADRs in prisma/prisma-next should document architectural design decisions and the key constraints/assumptions only. Do not include implementation algorithms, emitter derivation logic, or step-by-step derivation/migration rules."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 199 - Storage-only migration identity.md around lines 17 - 35, This ADR currently contains production-level algorithm code (computeMigrationId, canonicalizeJson, sha256Hex, MigrationManifest, MigrationOps) that should be removed from the ADR body and moved to implementation/subsystem docs; replace the code block with a short, high-level description of the migration identity decision (e.g., "migration identity is computed deterministically from a manifest and ops using a canonicalized SHA-256 hash") plus any constraints/assumptions, and create a separate implementation doc that contains the exact algorithm, function signature (computeMigrationId), and details about canonicalization and hashing.docs/architecture docs/subsystems/7. Migration System.md (2)
77-84: Use ASCII in Mermaid node labels.The empty set symbol
∅in the node label violates the coding guideline to prefer ASCII.As per coding guidelines: "Prefer ASCII in Mermaid node labels (avoid curly quotes, arrows like
→, ellipses like…, and emoji prefixes)."♻️ Proposed fix for ASCII compliance
```mermaid flowchart LR - Empty["∅"] -- e1 --> H1 + Empty[Empty] -- e1 --> H1 H1 -- e2 --> H2🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 77 - 84, The Mermaid diagram uses a non-ASCII empty-set symbol in the node label Empty["∅"]; update the node label to use ASCII (e.g., Empty[Empty] or Empty["Empty"]) so it follows the guideline. Edit the flowchart block containing nodes Empty, H1, H2, H2a, H3 and replace the label "∅" with an ASCII word; keep the node identifier (Empty) and the edge tokens (-- e1 --> etc.) unchanged.
16-19: Use ASCII in Mermaid node labels.The empty set symbol
∅in Mermaid node labels violates the coding guideline to prefer ASCII. Replace with "Empty" or just use the node ID without a label override.As per coding guidelines: "Prefer ASCII in Mermaid node labels (avoid curly quotes, arrows like
→, ellipses like…, and emoji prefixes)."♻️ Proposed fix for ASCII compliance
```mermaid flowchart LR - E["∅"] -- "e1:createCollection(users)" --> H1[H1] + E[Empty] -- "e1:createCollection(users)" --> H1[H1]</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@docs/architecturedocs/subsystems/7. Migration System.md around lines 16 -
19, Replace the non-ASCII empty set symbol in the Mermaid node label for node E
with an ASCII alternative; locate the flowchart line containing node identifier
E and the edge labeled "e1:createCollection(users)" and change the node label
from "∅" to an ASCII label such as Empty (or remove the quoted label override to
use the node ID E) so the Mermaid diagram complies with the ASCII-label
guideline.</details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Inline comments:
In@docs/architecturedocs/adrs/ADR 027 - Error Envelope Stable Codes.md:
- Around line 128-130: The ADR text and the implementation disagree: update
either the ADR or the code so the contract is unambiguous—either change ADR 027
entries for PN-MIG-2003 and PN-MIG-2004 to state that evaluateMigrationTs
expects the default export to be a function and that invoking it returns an
array (matching evaluateMigrationTs in migration-ts.ts), or change
evaluateMigrationTs to implement ADR 194’s contract (require the default export
be a Migration subclass and that Migration.operations getter returns an array);
reference evaluateMigrationTs, PN-MIG-2003, PN-MIG-2004 and ADR 194 when making
the change so the wording and validation align.In
@docs/architecturedocs/adrs/ADR 192 - ops.json is the migration contract.md:
- Around line 23-24: The wording for migrationId is ambiguous; update the
sentence that currently says "computed over the manifest andops.json" to
explicitly state it is computed over the "stripped manifest metadata +
ops.json" per ADR 199 (so readers know fields likefromContract,
toContract, andhintsare not included), and add a short parenthetical or
clause referencing ADR 199 and the stripped-manifest rule; ensure this
clarification appears near the mention ofmigrationId/migration.jsonand
note that edits tomigration.tsthat don't change emitted ops won't affect the
id.In
@docs/architecturedocs/adrs/ADR 197 - Migration packages snapshot their own
contract.md:
- Around line 7-14: Add the missing fence language specifier "text" to the two
Markdown fenced code blocks that show directory trees so they no longer trigger
MD040: update the block beginning with the
migrations/20250612T0930_backfill-status/ tree to start withtext and likewise update the block beginning with the migrations/20250613T1100_split-name/ tree to start withtext; ensure both
opening fences include the language identifier and leave the tree contents
unchanged.In
@docs/architecturedocs/adrs/ADR 199 - Storage-only migration identity.md:
- Line 74: The plain text reference "ADR 192 — ops.json is the migration
contract (concurrent)" should be converted to the same clickable link format
used elsewhere; replace that exact string with a Markdown link pointing to ADR
192 (e.g., ADR 192 — ops.json is the migration contract (concurrent)) so
cross-reference checks resolve and the reference style matches adjacent ADR
links.In
@docs/architecturedocs/adrs/ADR 200 - Placeholder utility for scaffolded
migration slots.md:
- Around line 21-25: The fenced code block containing the PN-MIG-2001
placeholder message is missing a language tag (MD040); update the opening fence
in "ADR 200 - Placeholder utility for scaffolded migration slots.md" for that
block (the block that starts with "PN-MIG-2001 Unfilled migration placeholder")
by adding a language identifier such as text (e.g., changetotext) so
the linter no longer flags the missing fence language.
Nitpick comments:
In@docs/architecturedocs/adrs/ADR 199 - Storage-only migration identity.md:
- Around line 17-35: This ADR currently contains production-level algorithm code
(computeMigrationId, canonicalizeJson, sha256Hex, MigrationManifest,
MigrationOps) that should be removed from the ADR body and moved to
implementation/subsystem docs; replace the code block with a short, high-level
description of the migration identity decision (e.g., "migration identity is
computed deterministically from a manifest and ops using a canonicalized SHA-256
hash") plus any constraints/assumptions, and create a separate implementation
doc that contains the exact algorithm, function signature (computeMigrationId),
and details about canonicalization and hashing.In
@docs/architecturedocs/subsystems/7. Migration System.md:
- Around line 77-84: The Mermaid diagram uses a non-ASCII empty-set symbol in
the node label Empty["∅"]; update the node label to use ASCII (e.g.,
Empty[Empty] or Empty["Empty"]) so it follows the guideline. Edit the flowchart
block containing nodes Empty, H1, H2, H2a, H3 and replace the label "∅" with an
ASCII word; keep the node identifier (Empty) and the edge tokens (-- e1 -->
etc.) unchanged.- Around line 16-19: Replace the non-ASCII empty set symbol in the Mermaid node
label for node E with an ASCII alternative; locate the flowchart line containing
node identifier E and the edge labeled "e1:createCollection(users)" and change
the node label from "∅" to an ASCII label such as Empty (or remove the quoted
label override to use the node ID E) so the Mermaid diagram complies with the
ASCII-label guideline.</details> <details> <summary>🪄 Autofix (Beta)</summary> Fix all unresolved CodeRabbit comments on this PR: - [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended) - [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Path: .coderabbit.yml **Review profile**: CHILL **Plan**: Pro **Run ID**: `b8329017-c1f9-48a9-ba81-72ae6c336bf0` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9ae33cf4e9d537c1437c5e6621934a6c7f9e4cd3 and 122903f79878894daa2e44371f30ca0f8b509408. </details> <details> <summary>⛔ Files ignored due to path filters (9)</summary> * `projects/mongo-migration-authoring/plans/data-migrations-plan.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/class-flow-scaffolding.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/data-migrations.spec.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/data-transform-check-unification.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/data-transform-placeholder.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/migration-emit-unification.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/migration-package-polish.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/planner-dual-output.spec.md` is excluded by `!projects/**` * `projects/mongo-migration-authoring/specs/target-owned-migration-scaffolding.md` is excluded by `!projects/**` </details> <details> <summary>📒 Files selected for processing (15)</summary> * `.gitattributes` * `docs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.md` * `docs/architecture docs/adrs/ADR 044 - Pre & post check vocabulary v1.md` * `docs/architecture docs/adrs/ADR 188 - MongoDB migration operation model.md` * `docs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.md` * `docs/architecture docs/adrs/ADR 193 - Class-flow as the canonical migration authoring strategy.md` * `docs/architecture docs/adrs/ADR 194 - Plans carry their own authoring surface.md` * `docs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.md` * `docs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.md` * `docs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.md` * `docs/architecture docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.md` * `docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md` * `docs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md` * `docs/architecture docs/subsystems/10. MongoDB Family.md` * `docs/architecture docs/subsystems/7. Migration System.md` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
122903f to
4be4a19
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
docs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md (1)
21-25:⚠️ Potential issue | 🟡 MinorAdd a language tag to the fenced code block.
Line 21 should specify a fence language (e.g.,
text) to satisfy MD040.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md around lines 21 - 25, The fenced code block that shows the migration message (the block starting with "PN-MIG-2001 Unfilled migration placeholder" and the placeholder instruction) is missing a language tag; add a fence language such as ```text (e.g., change ``` to ```text) to satisfy MD040 and ensure the block is treated as plain text by the linter.
🧹 Nitpick comments (3)
docs/architecture docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.md (1)
50-61: Condense execution mechanics to decision-level text.Line 50–61 documents stepwise execution internals (visitor dispatch and adapter/driver flow) at implementation granularity. Recommend keeping only constraints and invariants here, with a link to subsystem docs for execution mechanics.
Based on learnings: "ADRs in prisma/prisma-next should document architectural design decisions and the key constraints/assumptions only. Do not include implementation algorithms, emitter derivation logic, or step-by-step derivation/migration rules."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.md around lines 50 - 61, The ADR currently exposes implementation-level execution steps (visitor dispatch, concrete executors and driver calls like CreateIndexCommand/DropIndexCommand/CreateCollectionCommand using accept(visitor), MongoCommandExecutor, MongoInspectionExecutor, adapter.lower(plan) and driver.execute(wireCommand)), so condense this section to state only the high-level decision, key constraints and invariants (e.g., "DDL uses frozen AST nodes dispatched via a visitor SPI; runner is decoupled from driver; DML uses adapter→driver transport"), remove the step-by-step mechanics and concrete method calls, and replace them with a short pointer sentence linking to the subsystem implementation/design docs that contain the detailed execution mechanics and examples (retain the command/type names as keywords for cross-reference).docs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.md (1)
75-122: Move renderer algorithm walkthroughs out of the ADR.Line 75–122 goes deep into implementation mechanics (
renderVisitor, file composition details). For ADRs, keep the decision/constraints and move algorithm-level guidance to subsystem docs to reduce ADR churn.Based on learnings: "ADRs in prisma/prisma-next should document architectural design decisions and the key constraints/assumptions only. Do not include implementation algorithms, emitter derivation logic, or step-by-step derivation/migration rules."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 195 - Planner IR with two renderers.md around lines 75 - 122, The ADR includes algorithm-level implementation details (examples and walkthroughs for renderVisitor, renderCallVisitor, renderOps, renderCallsToTypeScript and file-composition mechanics) that should be removed from the ADR body; replace that section with a brief decision summary stating that rendering is external to IR nodes and reference the subsystem docs for implementation (e.g., a note to see the renderer docs for visitor examples and the TypeScript emitter), and move the detailed examples and step‑by‑step algorithms (including the sketch of PlannerProducedMongoMigration wiring and Migration file composition) into the renderer/subsystem documentation.docs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.md (1)
25-25: Consider more concise phrasing (optional).For brevity, "at the moment the migration was scaffolded" could be shortened to "when the migration was scaffolded."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 197 - Migration packages snapshot their own contract.md at line 25, Replace the phrase "at the moment the migration was scaffolded" with the more concise "when the migration was scaffolded" in the sentence describing `contract.json` and `contract.d.ts` snapshots so the line reads: "`contract.json` and `contract.d.ts` are copies — snapshots of the project's emitted contract when the migration was scaffolded. The migration never reaches outside its own directory for type information."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/architecture` docs/subsystems/7. Migration System.md:
- Around line 232-235: Update the docs to match the implemented migrationId
formula: state that canonicalized fromContract and toContract are included in
the hash (they appear in partHashes in
packages/1-framework/3-tooling/migration/src/attestation.ts) rather than
excluded; describe that migrationId is computed from strippedManifest + ops plus
the canonicalized fromContract/toContract (and hints if present) as represented
by partHashes so the doc's description of strippedManifest and the inputs to the
hash align with the attestation implementation.
- Around line 307-321: The CLI command list in "7. Migration System.md" is out
of sync: add an entry for the existing migration verify command or mark it as
deprecated/transitioning; locate the command implementation in
packages/1-framework/3-tooling/cli/src/commands/migration-verify.ts and either
(A) add a line to the Helpful Commands block like "`prisma-next migration verify
[--db <url>] [--ref <name>]` — <short description>`" describing its behavior,
options and status, or (B) add a short parenthetical after the list noting that
`migration verify` is deprecated/transitionary and link to the canonical docs;
ensure the README follows the doc-maintenance.mdc guideline by preferring a link
to the canonical CLI docs if the command surface changes frequently.
- Line 18: Replace the non-ASCII Mermaid node labels `∅` used in the diagram
(e.g., the node declaration E["∅"] and the other occurrence at line 79) with an
ASCII-only label such as `Empty` (e.g., E["Empty"]) so the Mermaid diagrams
follow repo conventions; update both occurrences (the E node and the matching
node on line 79) ensuring any references like the edge E["∅"] --
"e1:createCollection(users)" are updated to use the new ASCII label.
- Around line 23-31: The markdown fenced code blocks that show the migration
directory listing (the block starting with "migrations/
20260118T1205_add_users/" and the later block around lines 198-213) are missing
language tags; update both opening fences from ``` to ```text so they satisfy
MD040 (e.g., change the block that contains "migration.ts / migration.json /
ops.json / contract.json / contract.d.ts" to start with ```text and do the same
for the other fenced block).
---
Duplicate comments:
In `@docs/architecture` docs/adrs/ADR 200 - Placeholder utility for scaffolded
migration slots.md:
- Around line 21-25: The fenced code block that shows the migration message (the
block starting with "PN-MIG-2001 Unfilled migration placeholder" and the
placeholder instruction) is missing a language tag; add a fence language such as
```text (e.g., change ``` to ```text) to satisfy MD040 and ensure the block is
treated as plain text by the linter.
---
Nitpick comments:
In `@docs/architecture` docs/adrs/ADR 195 - Planner IR with two renderers.md:
- Around line 75-122: The ADR includes algorithm-level implementation details
(examples and walkthroughs for renderVisitor, renderCallVisitor, renderOps,
renderCallsToTypeScript and file-composition mechanics) that should be removed
from the ADR body; replace that section with a brief decision summary stating
that rendering is external to IR nodes and reference the subsystem docs for
implementation (e.g., a note to see the renderer docs for visitor examples and
the TypeScript emitter), and move the detailed examples and step‑by‑step
algorithms (including the sketch of PlannerProducedMongoMigration wiring and
Migration file composition) into the renderer/subsystem documentation.
In `@docs/architecture` docs/adrs/ADR 197 - Migration packages snapshot their own
contract.md:
- Line 25: Replace the phrase "at the moment the migration was scaffolded" with
the more concise "when the migration was scaffolded" in the sentence describing
`contract.json` and `contract.d.ts` snapshots so the line reads:
"`contract.json` and `contract.d.ts` are copies — snapshots of the project's
emitted contract when the migration was scaffolded. The migration never reaches
outside its own directory for type information."
In `@docs/architecture` docs/adrs/ADR 198 - Runner decoupled from driver via
visitor SPIs.md:
- Around line 50-61: The ADR currently exposes implementation-level execution
steps (visitor dispatch, concrete executors and driver calls like
CreateIndexCommand/DropIndexCommand/CreateCollectionCommand using
accept(visitor), MongoCommandExecutor, MongoInspectionExecutor,
adapter.lower(plan) and driver.execute(wireCommand)), so condense this section
to state only the high-level decision, key constraints and invariants (e.g.,
"DDL uses frozen AST nodes dispatched via a visitor SPI; runner is decoupled
from driver; DML uses adapter→driver transport"), remove the step-by-step
mechanics and concrete method calls, and replace them with a short pointer
sentence linking to the subsystem implementation/design docs that contain the
detailed execution mechanics and examples (retain the command/type names as
keywords for cross-reference).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: ea6e9b8d-f160-4eae-a06c-e02877020e8d
⛔ Files ignored due to path filters (9)
projects/mongo-migration-authoring/plans/data-migrations-plan.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/class-flow-scaffolding.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-migrations.spec.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-transform-check-unification.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-transform-placeholder.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/migration-emit-unification.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/migration-package-polish.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/planner-dual-output.spec.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/target-owned-migration-scaffolding.mdis excluded by!projects/**
📒 Files selected for processing (15)
.gitattributesdocs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.mddocs/architecture docs/adrs/ADR 044 - Pre & post check vocabulary v1.mddocs/architecture docs/adrs/ADR 188 - MongoDB migration operation model.mddocs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.mddocs/architecture docs/adrs/ADR 193 - Class-flow as the canonical migration authoring strategy.mddocs/architecture docs/adrs/ADR 194 - Plans carry their own authoring surface.mddocs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.mddocs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.mddocs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.mddocs/architecture docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.mddocs/architecture docs/adrs/ADR 199 - Storage-only migration identity.mddocs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.mddocs/architecture docs/subsystems/10. MongoDB Family.mddocs/architecture docs/subsystems/7. Migration System.md
✅ Files skipped from review due to trivial changes (6)
- .gitattributes
- docs/architecture docs/adrs/ADR 044 - Pre & post check vocabulary v1.md
- docs/architecture docs/subsystems/10. MongoDB Family.md
- docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md
- docs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.md
- docs/architecture docs/adrs/ADR 193 - Class-flow as the canonical migration authoring strategy.md
🚧 Files skipped from review as they are similar to previous changes (4)
- docs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.md
- docs/architecture docs/adrs/ADR 194 - Plans carry their own authoring surface.md
- docs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.md
- docs/architecture docs/adrs/ADR 188 - MongoDB migration operation model.md
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
…er ADRs Adds nine new ADRs and amends three to capture the design behind the mongo migration-authoring work that lands in the following stack: - ADR 192 ops.json is the migration contract - ADR 193 class-flow as the canonical authoring strategy - ADR 194 plans carry their own authoring surface - ADR 195 planner IR with two renderers (OpFactoryCall pattern) - ADR 196 in-process emit for class-flow targets - ADR 197 migration packages snapshot their own contract - ADR 198 runner decoupled from driver via visitor SPIs - ADR 199 storage-only migration identity - ADR 200 placeholder() utility for scaffolded migration slots - ADR 027 amended to register the PN-MIG-2xxx error code range - ADR 044 amended with a supersession note for the unified check shape - ADR 188 amended with a data transform addendum Rewrites the Migration System and MongoDB Family subsystem docs to match. Lands the working specs/plans under projects/mongo-migration-authoring/ and adds .gitattributes so generated migration artefacts are diff-hidden on GitHub. No code changes - purely doc-and-decision context for the implementation PRs that follow. Part 1/4 of tml-2219.
4be4a19 to
7482e70
Compare
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (6)
docs/architecture docs/subsystems/7. Migration System.md (4)
18-18:⚠️ Potential issue | 🟡 MinorUse ASCII Mermaid node labels.
∅in Mermaid labels violates the repo Mermaid guidance; switch to an ASCII label likeEmpty.As per coding guidelines: "
**/*.md: Prefer ASCII in Mermaid node labels (avoid curly quotes, arrows like→, ellipses like…, and emoji prefixes)`."Also applies to: 79-79
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/subsystems/7. Migration System.md at line 18, Replace the non-ASCII Mermaid node label E["∅"] with an ASCII label (e.g., E["Empty"]) to comply with the repo guidance; update any identical occurrences (the other instance noted in the file) so all Mermaid node labels use plain ASCII (use the existing node identifier E and the edge label e1:createCollection(users) to locate the spot to change).
307-321:⚠️ Potential issue | 🟠 MajorCommand synopsis is missing the existing
migration verifycommand.The current command list omits
migration verifyeven though it exists in the CLI command set. Please include it or explicitly mark deprecation/transition status with a canonical reference.As per coding guidelines: "
**/*.{md,ts,tsx}: Keep docs current (READMEs, rules, links) and prefer links to canonical docs over long comments (see doc-maintenance.mdc rule)`."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 307 - 321, Add the missing CLI entry for the existing migration verify command to the command synopsis: insert a line for "prisma-next migration verify [--db <url>] [--ref <name>]" (or the correct flags your CLI supports) into the Helpful Commands list (near other migration subcommands like migration apply/status/show) or else add a short note declaring it deprecated/transitioning with a canonical doc link; ensure the phrasing matches the existing entries and references "migration verify" exactly so readers can find it.
232-235:⚠️ Potential issue | 🟠 MajorMigration ID hash inputs are documented inconsistently with current implementation.
This section says canonicalized
fromContract/toContract/hintsare excluded from hashing; previous implementation references indicate these are included inpartHashes. Please align this text with actual attestation logic (or clearly mark it as future behavior gated on follow-up PRs).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 232 - 235, The documentation for migrationId is inconsistent with the implementation: update the paragraph describing migrationId computation to match the attestation logic by stating whether canonicalized fromContract, toContract, and hints are included via partHashes (i.e., partHashes are part of the input to migrationId) or explicitly mark this behavior as a future gated change; reference the symbols migrationId, strippedManifest, fromContract, toContract, hints, and partHashes and describe that the canonicalized contracts/hints are either included in the hash through partHashes or that the current implementation excludes them and the doc should note that mismatch and the intended follow-up PR.
23-31:⚠️ Potential issue | 🟡 MinorAdd language identifiers to both migration-layout fenced blocks.
Both directory-tree blocks should use an explicit fence language (use
text) to satisfyMD040.Also applies to: 198-213
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 23 - 31, The fenced directory-tree blocks (the ones beginning with "migrations/" and the other similar migration-layout block later) are missing a language identifier and trigger MD040; update both fenced code blocks to use an explicit language tag by changing their opening fences from ``` to ```text so the directory-tree snippets (the block containing "migrations/ 20260118T1205_add_users/ ...") and the duplicate block further down (the other migration-layout block) are fenced as ```text.docs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md (1)
21-25:⚠️ Potential issue | 🟡 MinorAdd a language tag to the PN-MIG error example block.
This fenced block still lacks a language identifier (
MD040). Usetext.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md around lines 21 - 25, The fenced example block showing the PN-MIG-2001 Unfilled migration placeholder needs a language tag to satisfy MD040; edit the markdown file and change the triple-backtick fence that wraps the PN-MIG-2001 example to use the "text" language identifier (i.e., ```text) so the code block is properly annotated; locate the block containing "PN-MIG-2001 Unfilled migration placeholder" and the reference to the `placeholder(...)` call when making the change.docs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.md (1)
7-14:⚠️ Potential issue | 🟡 MinorAdd language identifiers to both directory-tree fenced blocks.
Both tree blocks are still missing a fence language (
MD040). Please usetextfor these two blocks.As per coding guidelines: "
**/*.md: Prefer ASCII in Mermaid node labels ... Keep Mermaid diagram labels short ...`" and markdown hygiene requirements for docs in this repo include proper fenced block annotations.Also applies to: 69-79
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 197 - Migration packages snapshot their own contract.md around lines 7 - 14, The two directory-tree fenced code blocks that show the migration layout (the block containing lines like "migrations/20250612T0930_backfill-status/" and the list including "migration.ts", "migration.json", "ops.json", "contract.json", "contract.d.ts") are missing a fence language and should be annotated with text; update each triple-backtick fence that surrounds those tree blocks to be ```text so the blocks pass MD040 and follow the repo's markdown hygiene rules.
🧹 Nitpick comments (1)
docs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.md (1)
75-122: Trim implementation-level renderer walkthrough from ADR body.This ADR currently reads partly like implementation design notes (visitor bodies, file composition mechanics, reverse-engineering specifics). Consider keeping the decision, invariants, and trade-offs here, and move derivation mechanics to the Migration System subsystem doc.
Based on learnings: "ADRs in prisma/prisma-next should document architectural design decisions and the key constraints/assumptions only. Do not include implementation algorithms, emitter derivation logic, or step-by-step derivation/migration rules."
Also applies to: 137-157
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture` docs/adrs/ADR 195 - Planner IR with two renderers.md around lines 75 - 122, The ADR includes implementation-level renderer walkthroughs that read like design notes; remove or relocate the detailed visitor and file-composition examples (renderVisitor, renderOps, renderCallVisitor, renderCallsToTypeScript, and the wiring notes around PlannerProducedMongoMigration and renderTypeScript) from the ADR body and instead summarize the architectural decision and constraints (what rendering responsibility is, why it is external to IR nodes, and trade-offs), then move the detailed emitter/derivation mechanics and example snippets into the Migration System subsystem doc or an implementation appendix.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/architecture` docs/adrs/ADR 197 - Migration packages snapshot their own
contract.md:
- Around line 31-49: This section currently presents the
copyContractToMigrationDir behavior as if implemented; update the ADR text to
explicitly mark it as target/planned behavior until the implementation PR lands
by adding a clear sentence like "Planned/target-state: the
copyContractToMigrationDir helper (see copyContractToMigrationDir) will perform
a snapshot copy of contract.json and optional contract.d.ts into the migration
package; current scaffolding in migration-ts.ts still derives imports from
contractJsonPath." Also mention that migration-ts.ts
(packages/1-framework/3-tooling/migration/src/migration-ts.ts) remains unchanged
today so readers know this is not yet present in main.
In `@docs/architecture` docs/adrs/ADR 200 - Placeholder utility for scaffolded
migration slots.md:
- Around line 55-70: Update this ADR section to indicate the
sentinel-to-placeholder() change is the intended/target design (not yet live) by
marking the replacement as "planned/target behavior" or "design intent" until
runtime snippets and code paths are migrated; explicitly note that
examples/snippets referencing TODO/TodoMarker/TO DO symbol in runtime (e.g., the
dataTransform runtime handling) are still present in the repo and will be
replaced when implementation lands, and add a short migration status line that
references the placeholder() symbol as the future API and TODO/TodoMarker as the
current temporary runtime artifact.
---
Duplicate comments:
In `@docs/architecture` docs/adrs/ADR 197 - Migration packages snapshot their own
contract.md:
- Around line 7-14: The two directory-tree fenced code blocks that show the
migration layout (the block containing lines like
"migrations/20250612T0930_backfill-status/" and the list including
"migration.ts", "migration.json", "ops.json", "contract.json", "contract.d.ts")
are missing a fence language and should be annotated with text; update each
triple-backtick fence that surrounds those tree blocks to be ```text so the
blocks pass MD040 and follow the repo's markdown hygiene rules.
In `@docs/architecture` docs/adrs/ADR 200 - Placeholder utility for scaffolded
migration slots.md:
- Around line 21-25: The fenced example block showing the PN-MIG-2001 Unfilled
migration placeholder needs a language tag to satisfy MD040; edit the markdown
file and change the triple-backtick fence that wraps the PN-MIG-2001 example to
use the "text" language identifier (i.e., ```text) so the code block is properly
annotated; locate the block containing "PN-MIG-2001 Unfilled migration
placeholder" and the reference to the `placeholder(...)` call when making the
change.
In `@docs/architecture` docs/subsystems/7. Migration System.md:
- Line 18: Replace the non-ASCII Mermaid node label E["∅"] with an ASCII label
(e.g., E["Empty"]) to comply with the repo guidance; update any identical
occurrences (the other instance noted in the file) so all Mermaid node labels
use plain ASCII (use the existing node identifier E and the edge label
e1:createCollection(users) to locate the spot to change).
- Around line 307-321: Add the missing CLI entry for the existing migration
verify command to the command synopsis: insert a line for "prisma-next migration
verify [--db <url>] [--ref <name>]" (or the correct flags your CLI supports)
into the Helpful Commands list (near other migration subcommands like migration
apply/status/show) or else add a short note declaring it
deprecated/transitioning with a canonical doc link; ensure the phrasing matches
the existing entries and references "migration verify" exactly so readers can
find it.
- Around line 232-235: The documentation for migrationId is inconsistent with
the implementation: update the paragraph describing migrationId computation to
match the attestation logic by stating whether canonicalized fromContract,
toContract, and hints are included via partHashes (i.e., partHashes are part of
the input to migrationId) or explicitly mark this behavior as a future gated
change; reference the symbols migrationId, strippedManifest, fromContract,
toContract, hints, and partHashes and describe that the canonicalized
contracts/hints are either included in the hash through partHashes or that the
current implementation excludes them and the doc should note that mismatch and
the intended follow-up PR.
- Around line 23-31: The fenced directory-tree blocks (the ones beginning with
"migrations/" and the other similar migration-layout block later) are missing a
language identifier and trigger MD040; update both fenced code blocks to use an
explicit language tag by changing their opening fences from ``` to ```text so
the directory-tree snippets (the block containing "migrations/
20260118T1205_add_users/ ...") and the duplicate block further down (the other
migration-layout block) are fenced as ```text.
---
Nitpick comments:
In `@docs/architecture` docs/adrs/ADR 195 - Planner IR with two renderers.md:
- Around line 75-122: The ADR includes implementation-level renderer
walkthroughs that read like design notes; remove or relocate the detailed
visitor and file-composition examples (renderVisitor, renderOps,
renderCallVisitor, renderCallsToTypeScript, and the wiring notes around
PlannerProducedMongoMigration and renderTypeScript) from the ADR body and
instead summarize the architectural decision and constraints (what rendering
responsibility is, why it is external to IR nodes, and trade-offs), then move
the detailed emitter/derivation mechanics and example snippets into the
Migration System subsystem doc or an implementation appendix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: d140c0ec-2141-46e8-bc88-1ab0b92acd9e
⛔ Files ignored due to path filters (9)
projects/mongo-migration-authoring/plans/data-migrations-plan.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/class-flow-scaffolding.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-migrations.spec.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-transform-check-unification.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/data-transform-placeholder.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/migration-emit-unification.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/migration-package-polish.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/planner-dual-output.spec.mdis excluded by!projects/**projects/mongo-migration-authoring/specs/target-owned-migration-scaffolding.mdis excluded by!projects/**
📒 Files selected for processing (15)
.gitattributesdocs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.mddocs/architecture docs/adrs/ADR 044 - Pre & post check vocabulary v1.mddocs/architecture docs/adrs/ADR 188 - MongoDB migration operation model.mddocs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.mddocs/architecture docs/adrs/ADR 193 - Class-flow as the canonical migration authoring strategy.mddocs/architecture docs/adrs/ADR 194 - Plans carry their own authoring surface.mddocs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.mddocs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.mddocs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.mddocs/architecture docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.mddocs/architecture docs/adrs/ADR 199 - Storage-only migration identity.mddocs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.mddocs/architecture docs/subsystems/10. MongoDB Family.mddocs/architecture docs/subsystems/7. Migration System.md
✅ Files skipped from review due to trivial changes (6)
- .gitattributes
- docs/architecture docs/subsystems/10. MongoDB Family.md
- docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md
- docs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.md
- docs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.md
- docs/architecture docs/adrs/ADR 193 - Class-flow as the canonical migration authoring strategy.md
🚧 Files skipped from review as they are similar to previous changes (4)
- docs/architecture docs/adrs/ADR 044 - Pre & post check vocabulary v1.md
- docs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.md
- docs/architecture docs/adrs/ADR 194 - Plans carry their own authoring surface.md
- docs/architecture docs/adrs/ADR 188 - MongoDB migration operation model.md
Align ADR 196 imports with canonical MongoMigration / target-mongo/migration (F02), replace inline marker collection name in ADR 198 with ADR 190 cross-ref (F01), rewrite subsystem doc 7 hash-verification to mirror ADR 192 two-step structure (F03), fix authoring-pipeline mermaid with three emit paths (F05), add missing MIGRATION.NON_TRANSACTIONAL_STEP error (F06), update data-migrations.spec.md example to MongoMigration + get operations() (F07), standardize References heading in ADR 195 (F09), restyle ADR 027 PN-MIG entries with back-references (F08/F10), acknowledge transitional migration emit in ADR 199 (F11). F04 Option A: replace ADR 028 stale pre/post example with real SQL ops shape, mark ADR 044 as Superseded in ADR-INDEX, and update all 11 inbound ADR-044 references across ADRs 026/028/029/038/040/041/116/166/169 and subsystem docs 5 & 6 to point at the per-family check vocabularies (ADR 028 for SQL, ADR 188 for Mongo).
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/architecture` docs/adrs/ADR 041 - Custom operation loading via local
packages + preflight bundles.md:
- Around line 146-147: Duplicate ADR entries appear in the References section:
remove the repeated ADR 028 and the redundant ADR 188 so each ADR is listed only
once; specifically, edit the References block that contains "ADR 028 — Migration
structure & operations" and "ADR 188 — MongoDB migration operation model" to
keep a single occurrence of ADR 028 and a single occurrence of ADR 188 (remove
the extra lines shown in the diff).
In `@docs/architecture` docs/subsystems/7. Migration System.md:
- Around line 237-241: The docs claim migrationId is computed from
(strippedManifest, ops) only, but the implementation in migration attestation
includes canonicalFromContract and canonicalToContract in the hashed parts;
update the text to state that migrationId is computed from (strippedManifest,
ops, canonicalFromContract, canonicalToContract) so storage-contract changes
affect the hash, and reference the attestation implementation (function/logic
that builds partHashes in
packages/1-framework/3-tooling/migration/src/attestation.ts) to ensure the doc
matches the code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 0f6472e6-c4a7-45ed-8ff7-2fc4f07b6aac
⛔ Files ignored due to path filters (1)
projects/mongo-migration-authoring/specs/data-migrations.spec.mdis excluded by!projects/**
📒 Files selected for processing (18)
docs/architecture docs/ADR-INDEX.mddocs/architecture docs/adrs/ADR 026 - Conformance Kit Certification.mddocs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.mddocs/architecture docs/adrs/ADR 028 - Migration Structure & Operations.mddocs/architecture docs/adrs/ADR 029 - Shadow DB preflight semantics.mddocs/architecture docs/adrs/ADR 038 - Operation idempotency classification & enforcement.mddocs/architecture docs/adrs/ADR 040 - Node task execution environment & sandboxing.mddocs/architecture docs/adrs/ADR 041 - Custom operation loading via local packages + preflight bundles.mddocs/architecture docs/adrs/ADR 116 - Extension-aware migration ops.mddocs/architecture docs/adrs/ADR 166 - Referential actions for foreign keys.mddocs/architecture docs/adrs/ADR 169 - On-disk migration persistence.mddocs/architecture docs/adrs/ADR 195 - Planner IR with two renderers.mddocs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.mddocs/architecture docs/adrs/ADR 198 - Runner decoupled from driver via visitor SPIs.mddocs/architecture docs/adrs/ADR 199 - Storage-only migration identity.mddocs/architecture docs/subsystems/5. Adapters & Targets.mddocs/architecture docs/subsystems/6. Ecosystem Extensions & Packs.mddocs/architecture docs/subsystems/7. Migration System.md
✅ Files skipped from review due to trivial changes (11)
- docs/architecture docs/adrs/ADR 038 - Operation idempotency classification & enforcement.md
- docs/architecture docs/subsystems/6. Ecosystem Extensions & Packs.md
- docs/architecture docs/adrs/ADR 169 - On-disk migration persistence.md
- docs/architecture docs/adrs/ADR 166 - Referential actions for foreign keys.md
- docs/architecture docs/adrs/ADR 040 - Node task execution environment & sandboxing.md
- docs/architecture docs/adrs/ADR 116 - Extension-aware migration ops.md
- docs/architecture docs/subsystems/5. Adapters & Targets.md
- docs/architecture docs/ADR-INDEX.md
- docs/architecture docs/adrs/ADR 196 - In-process emit for class-flow targets.md
- docs/architecture docs/adrs/ADR 027 - Error Envelope Stable Codes.md
- docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md
|
Triage summary for this review (CodeRabbit) — see Inline findings — all have dedicated threads, addressed there:
Nitpicks — Mermaid ASCII (lines 16–19, 77–84): covered by A08 (single thread on line 18 with "also applies to 79–79"). Nitpick — ADR 199 §17–35 ("move |
|
Triage summary for this review (CodeRabbit): Duplicates and inline findings (already covered):
Nitpicks (decomposed into sub-actions in
|
|
Triage summary for this review (CodeRabbit) — every finding here is already covered by a dedicated thread or a now-resolved one:
No new sub-actions for this review. |
|
Triage summary for this review (CodeRabbit) — both inline findings are already covered:
No new sub-actions for this review. |
…041 references The References section in ADR 041 listed ADR 028 twice and a standalone ADR 188 line that is already covered by inline links elsewhere. Collapse to a single ADR 028 entry and remove the redundant ADR 188 line so the section matches the actual cited set.
The Decision section now states explicitly that the migrationId hash covers the *stripped* manifest metadata plus ops.json (excluding fromContract, toContract, and hints) per ADR 199 - storage-only migration identity. Adds a direct cross-reference to ADR 199 so readers following ops.json contract semantics land on the identity decision.
…ce languages Three small fixes to ADR 197 grouped because they touch the same file and read as a single intent (lining the ADR up with the upcoming implementation PR): - Open the Decision section with an explicit Planned/target-state note that copyContractToMigrationDir does not yet exist in main and that current scaffolding in packages/1-framework/3-tooling/migration/src/ migration-ts.ts still derives imports differently. The code snippet remains as the target API. - Add `text` fence-language tags to both directory-tree code blocks so markdownlint MD040 stops firing on them. - Reword line 25 to "snapshots of the project's emitted contract when the migration was scaffolded" (was: "at the moment the migration was scaffolded").
The ADR 192 reference was a plain-text bullet while every other entry in the section is a markdown link. Convert it to the same link form so the References section is consistent and the (concurrent) annotation stays attached.
…g fence ADR 200 describes the design intent for the upcoming class-flow rollout where the TodoMarker sentinel is replaced by placeholder(). Two fixes: - Open §"What this replaces" with an explicit Planned/target-state note clarifying that runtime data-transform paths still ship the sentinel today and that the snippets show the target API and the deletion catalog the implementation PR will execute against. - Tag the PN-MIG-2001 example block with `text` so markdownlint MD040 stops firing.
Mermaid renderers in our docs pipeline drop the U+2205 EMPTY SET glyph inconsistently. Replace the two ∅ Mermaid node labels (lines 18 and 81) with ASCII "Empty" so both flowcharts render reliably and follow the existing repo Mermaid convention. The H∅ used in surrounding prose is unchanged because it is regular markdown, not a Mermaid label.
|
Done on A12c (tracked in this triage summary) in 112bbc9 — ADR 197 line 25 now reads "snapshots of the project's emitted contract when the migration was scaffolded." A12a and A12b remain wont_address as previously triaged. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/architecture` docs/adrs/ADR 192 - ops.json is the migration contract.md:
- Around line 7-15: The fenced directory-tree block that begins with
"migrations/" is missing a language tag; change the opening fence from ``` to
```text so the block becomes a "text" fenced code block (this will fix MD040).
Locate the directory-tree block in the ADR 192 document (the one showing
migrations/ → 2025-06-12T0930_backfill-status/) and update only the opening
fence to include the text language identifier.
In `@docs/architecture` docs/subsystems/7. Migration System.md:
- Around line 23-31: The fenced directory-tree block in the Migration System doc
is missing a language tag (causing MD040); update the code fence that starts
with the migrations/ listing to include the language identifier "text" (i.e.,
change ``` to ```text) so the directory-tree is treated as plain text; locate
the block in the Migration System content (the three-backtick fenced block
containing "migrations/" and its nested files) and add "text" immediately after
the opening backticks.
- Around line 203-218: Update the second fenced code block that contains the
migrations directory tree in "7. Migration System.md" to include a language
identifier (e.g., add "text" after the opening backticks) so the block becomes
```text; this addresses the missing language tag for the directory-tree code
block that starts with the "migrations/" listing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 9a6ac5cd-fadc-4c0d-8b6f-2d1c76307099
📒 Files selected for processing (6)
docs/architecture docs/adrs/ADR 041 - Custom operation loading via local packages + preflight bundles.mddocs/architecture docs/adrs/ADR 192 - ops.json is the migration contract.mddocs/architecture docs/adrs/ADR 197 - Migration packages snapshot their own contract.mddocs/architecture docs/adrs/ADR 199 - Storage-only migration identity.mddocs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.mddocs/architecture docs/subsystems/7. Migration System.md
✅ Files skipped from review due to trivial changes (2)
- docs/architecture docs/adrs/ADR 041 - Custom operation loading via local packages + preflight bundles.md
- docs/architecture docs/adrs/ADR 199 - Storage-only migration identity.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/architecture docs/adrs/ADR 200 - Placeholder utility for scaffolded migration slots.md
| ``` | ||
| migrations/ | ||
| 2025-06-12T0930_backfill-status/ | ||
| migration.json # manifest: from/to hashes, migrationId | ||
| ops.json # the operations — precheck, execute, postcheck as JSON | ||
| migration.ts # authoring surface — TypeScript the developer edits | ||
| contract.json # destination contract snapshot | ||
| contract.d.ts | ||
| ``` |
There was a problem hiding this comment.
Add language identifier to directory-tree fence.
The fenced code block is missing a language tag, triggering MD040. Use text for consistency with other directory trees in this PR.
📝 Proposed fix
-```
+```text
migrations/
2025-06-12T0930_backfill-status/
migration.json # manifest: from/to hashes, migrationId🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 7-7: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/architecture` docs/adrs/ADR 192 - ops.json is the migration contract.md
around lines 7 - 15, The fenced directory-tree block that begins with
"migrations/" is missing a language tag; change the opening fence from ``` to
```text so the block becomes a "text" fenced code block (this will fix MD040).
Locate the directory-tree block in the ADR 192 document (the one showing
migrations/ → 2025-06-12T0930_backfill-status/) and update only the opening
fence to include the text language identifier.
| ``` | ||
| migrations/ | ||
| 20260118T1205_add_users/ | ||
| migration.ts # authoring surface — the developer edits this | ||
| migration.json # manifest: from/to hashes, migrationId | ||
| ops.json # the actual operations as JSON | ||
| contract.json # destination contract snapshot | ||
| contract.d.ts # TypeScript types for the contract | ||
| ``` |
There was a problem hiding this comment.
Add language identifier to directory-tree fence.
The fenced code block is missing a language tag. Use text for directory-tree output to satisfy MD040.
📝 Proposed fix
-```
+```text
migrations/
20260118T1205_add_users/
migration.ts # authoring surface — the developer edits this🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 23-23: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 23 -
31, The fenced directory-tree block in the Migration System doc is missing a
language tag (causing MD040); update the code fence that starts with the
migrations/ listing to include the language identifier "text" (i.e., change ```
to ```text) so the directory-tree is treated as plain text; locate the block in
the Migration System content (the three-backtick fenced block containing
"migrations/" and its nested files) and add "text" immediately after the opening
backticks.
| ``` | ||
| migrations/ | ||
| 20260118T1205_add_users/ | ||
| migration.json # from/to hashes, migrationId, embedded contracts | ||
| ops.json # SQL operations (target-specific DDL) | ||
| migration.ts # authoring surface — TypeScript the developer edits | ||
| migration.json # from/to hashes, migrationId, embedded contracts | ||
| ops.json # serialized operations (the contract) | ||
| contract.json # destination contract snapshot | ||
| contract.d.ts # TypeScript types for the contract | ||
| 20260119T0830_add_email_index/ | ||
| migration.ts | ||
| migration.json | ||
| ops.json | ||
| refs.json # named environment targets (e.g., staging, production) | ||
| contract.json | ||
| contract.d.ts | ||
| refs.json # named environment targets (e.g., staging, production) | ||
| ``` |
There was a problem hiding this comment.
Add language identifier to second directory-tree fence.
This fenced code block also needs a language tag for consistency and to clear MD040.
📝 Proposed fix
-```
+```text
migrations/
20260118T1205_add_users/
migration.ts # authoring surface — TypeScript the developer edits🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 203-203: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/architecture` docs/subsystems/7. Migration System.md around lines 203 -
218, Update the second fenced code block that contains the migrations directory
tree in "7. Migration System.md" to include a language identifier (e.g., add
"text" after the opening backticks) so the block becomes ```text; this addresses
the missing language tag for the directory-tree code block that starts with the
"migrations/" listing.
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
…R 196 Step (2) now describes the actual mechanism — dynamic-import without triggering the run guard, instantiate the class, serialize operations — instead of the misleading "let Migration.run produce a fresh attested manifest" framing that implied verification would clobber on-disk artifacts.
… ADR 027 Add the six missing runner error codes (FILE_MISSING, INVALID_JSON, INVALID_MANIFEST, INVALID_NAME, SAME_SOURCE_AND_TARGET, AMBIGUOUS_TARGET) so the subsystem doc enumerates all 12 codes without requiring a cross-reference to ADR 027.
…name codes in ADR 196 guards ADR 027 now links PN-MIG-2002 and PN-MIG-2011 to ADR 196. ADR 196 names the four error codes its emit pseudocode and capability-dispatch guards produce (2002, 2003, 2004, 2011), closing the back-reference gap.
Replace the framing that treated `migration emit` as the canonical path with the same three-path model used in subsystem 7 (inline, self-emit, transitional CLI emit). Also aligns the class name with the actual @prisma-next/family-mongo/migration export (Migration, not MongoMigration).
Name the class (BackfillStatus) and pass it directly to Migration.run() instead of the invalid CommonJS exports.default. Also aligns with the actual @prisma-next/family-mongo/migration export name (Migration).
…gainst ADR 193 The rejected alternative now explains the actual reason — the emit capability seam exists as a descriptor-flow bridge artifact that disappears with ADR 193, not as a future-extensibility hook. This resolves the tension with the pseudocode above it.
…/migration "Migration" export PR B re-exports the internal MongoMigration class as Migration from @prisma-next/family-mongo/migration. Update all import/extends/.run() examples in ADRs 193, 194, 196 and subsystem 7 to match the actual public surface. Type-name identifiers (MongoMigrationCheck, MongoMigrationPlanOperation, PlannerProducedMongoMigration, etc.) are unchanged — they refer to type-system names, not the runtime class.
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
…ame verify->emit migration verify becomes migration emit and now does the actual work (in-process dynamic-import the migration.ts file, run the emit helper, write attested ops.json) rather than just validating an external emit step. migration plan always runs emit inline as part of plan, dropping the needsDataMigration branch that the descriptor planner used to expose. Adds the emit capability to TargetMigrationsCapability and extracts an emitMigration helper that centrally owns attestation. The mongo family plugs in via mongoEmit, which dynamic-imports the class-flow migration.ts and writes ops.json. Structured error codes for emit-path validation: - PN-MIG-2002 errorMigrationFileMissing - PN-MIG-2003 errorMigrationInvalidDefaultExport - PN-MIG-2004 errorMigrationPlanNotArray Migration identity is now storage-only (migrationId derived from a content hash of the operations); the framework attestMigration helper extracts that single owner. This PR is structural cleanup that unblocks the class-flow scaffolding work in PR B and the data transforms work in PR C. No new authoring strategies or new operation kinds. Part 2/4 of tml-2219; depends on #352.
Stack
Summary
Pure docs. Lands the design context for the migration-authoring redesign:
nine new ADRs, three amended, two subsystem doc rewrites, and the working
specs/plans under
projects/mongo-migration-authoring/. No code changes.This PR is intentionally first in the stack so reviewers of A/B/C can link
to ADRs at their merged path on
main.ADRs
New:
Amended:
Subsystem docs
docs/architecture docs/subsystems/7. Migration System.md- adds an Authoring strategies section and generalises the contract-to-schema discussiondocs/architecture docs/subsystems/10. MongoDB Family.md- corrects stale "no migrations" claimsProject workspace
projects/mongo-migration-authoring/specs/*.mdandplans/*.md- the working specs/plans the implementation PRs referenceTest plan
Summary by CodeRabbit
New Features
Documentation