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

TML-2836: one consistent, schema-locked --json shape for the migration read commands - #741

Merged
wmadden merged 11 commits into
mainfrom
tml-2836-read-command-json-redesign
Jun 5, 2026
Merged

wmadden merged 11 commits into
mainfrom
tml-2836-read-command-json-redesign

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

The decision: the six migration read commands — list, graph, status, log, show, check — now emit --json in one shared, self-describing vocabulary, and each command's shape is defined by an arktype schema that its TypeScript type is derived from. Read one command's output and you can read them all; validate any of them at runtime against its exported schema.

At a glance

migration graph --json, before and after:

// before — flat, and you had to already know that "nodes" were contracts and "edges" were migrations
{ "ok": true,
  "nodes": ["sha256:aaa…", "sha256:bbb…"],
  "edges": [ { "dirName": "20260102_add_users", "from": "sha256:aaa…", "to": "sha256:bbb…", "migrationHash": "sha256:9c2…" } ],
  "summary": "2 node(s), 1 edge(s)" }

// after — names say what each thing is, grouped by contract space
{ "ok": true,
  "spaces": [ { "space": "app",
    "contracts":  [ { "hash": "sha256:aaa…", "refs": ["main"] }, { "hash": "sha256:bbb…", "refs": [] } ],
    "migrations": [ { "name": "20260102_add_users", "hash": "sha256:9c2…", "fromContract": "sha256:aaa…", "toContract": "sha256:bbb…" } ] } ],
  "summary": "1 space, 2 contracts, 1 migration" }

The same naming now runs through every command: a migration's name is name (was dirName, and migrationName in log); its own identifier is hash (was migrationHash); the contracts it moves between are fromContract / toContract (was from / to, and null at the first migration in every command); and the contract space is space (was spaceId).

Why

The read commands grew their JSON shapes one at a time, so the same idea ended up with three different names — a migration was dirName in some commands and migrationName in others; a space was spaceId here and space there — and graph leaned on the consumer already knowing the model (that nodes meant contracts and edges meant migrations). Nothing was wrong, but a tool reading the output couldn't reuse a single parser across commands, and the field names taught the reader nothing on their own.

The reader we care about most is an AI agent: it sees --json by default. So the goal here is output an agent can both parse mechanically and understand at a glance — structured fields as the source of truth, a plain-English summary alongside them, and names that describe what they point at without outside knowledge.

What changed, command by command

Each command applies that one decision to its own data:

  • list — migrations grouped under spaces[], each migration carrying the shared fields above.
  • graph — the before/after above: nodes/edges became self-describing contracts + migrations, grouped by space instead of one flat global list.
  • status — per-space currentContract / targetContract (was markerHash / targetHash), and its diagnostics are now structured objects ({ code, …, message }) rather than English sentences a tool would have to scrape.
  • log — returns ledger records (was entries): these are apply events, not migration definitions, so they read as a record stream.
  • show — dropped a leaked filesystem path (dirPath) and a redundant inner summary; one top-level summary now.
  • check — each failure is { space, code, where, why, fix }, the same vocabulary our structured errors already use.

Two rules tie it together. ok always mirrors the exit code, so a consumer branches on it the same way everywhere — including check, which returns ok: false (exit 4) when it finds integrity problems, distinguishable from a usage error by carrying failures instead of a top-level error code. And the shape nests by space only where a command actually holds per-space state (list, graph, status); log and check stay flat with a space tag on each item, because forcing log's time-ordered history into per-space groups would destroy the chronology that is its whole point.

How the shape is held in place

Each command's --json shape lives as an exported arktype schema in src/commands/json/schemas.ts, and the command's result type is derived from that schema — so the shape and the schema cannot drift apart. A cross-command parity test validates every command's real output against its schema and asserts the consistency rules directly: no retired field name reappears, fromContract is null (never a sentinel) at the first migration, ok matches the exit code, and the nest-vs-flat rule holds.

Out of scope

The shared error envelope (we aligned check to it rather than change it), the human-readable (non-JSON) output, and command behaviour/flags are all untouched. No new flags.

Alternatives considered

  • A separate passed field on check instead of overloading ok. Rejected: tying ok to the exit code gives one rule a consumer applies everywhere, and failures-vs-code already disambiguates the two ok: false cases.
  • One identical structure for all six commands (everything flat, or everything nested). Rejected: log is a time-ordered stream and status/graph carry real per-space state — a single structure fights one or the other, so structure follows the data.
  • Dropping summary from the JSON as decoration. Rejected: the JSON's main reader is an agent, and a one-line human summary earns its place next to the structured fields.
  • Bare hash strings for graph contracts. Rejected in favour of { hash, refs }, so a contract carries the names pointing at it and self-describes.
  • A versioning / migration story for the change. Not needed: there are no external consumers and we're in 0.x, so the shapes were rewritten directly.

Note for CI

The full @prisma-next/cli suite passes (1225 tests). There is a pre-existing order-dependent flake in migration-list-json-golden.test.ts (a process.chdir interaction under the package's isolate: false vitest) that also reproduces on the base branch and passes in a clean run — not introduced here.

Closes TML-2836.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changes
    • Standardized JSON output schemas across migration commands for consistent machine-readable results.
    • JSON field renames: space (was spaceId), name (was dirName), fromContract/toContract (were from/to), hash (was migrationHash); migration logs use records with name/hash.
    • Migration check failures now surface a code property (instead of pnCode) in JSON and human CLI output.

wmadden and others added 9 commits June 5, 2026 15:10
…/toContract/current+targetContract) (D1)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
- Add src/commands/json/schemas.ts with migrationEntrySchema, contractRefSchema,
  successEnvelopeBaseSchema, migrationSpaceListEntrySchema, migrationListResultSchema
- MigrationListEntry/MigrationSpaceListEntry/MigrationListResult in migration-list-types.ts
  are now re-exported from the arktype schemas (schema is the single source of truth)
- Rename MigrationListEntry.migrationHash → .hash to match the spec JSON target shape;
  update all construction sites and readers (migration-list.ts, migration-list-render.ts,
  migration-list-graph-topology.ts, migration-status.ts) and all affected tests
- Fix output.json-shapes.test.ts broken by D1 rename (currentContract/space/targetContract)
- migration-list-json-golden.test.ts now validates real list --json output against the
  exported migrationListResultSchema (schema parse must not return ArkErrors)

Co-Authored-By: Will Madden <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
- Rename SerializedLedgerEntryRecord.migrationName → name, migrationHash → hash
- Rename MigrationLogResult.entries → records, add summary field
- Add ledgerRecordSchema and migrationLogResultSchema to json/schemas.ts
- Derive MigrationLogResult from the schema (single source of truth)
- serializeLedgerEntriesForJson emits {name, hash} field names
- Tests validate against migrationLogResultSchema; empty case covered
- Parity test type-shape lock updated for new records/summary shape

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ract fix (D8)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ew + drive trace

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner June 5, 2026 14:35
@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f99fb218-a217-4b16-874b-e3d0b8309953

📥 Commits

Reviewing files that changed from the base of the PR and between 599cff3 and c220709.

📒 Files selected for processing (3)
  • packages/1-framework/3-tooling/cli/test/commands/migration-read-commands-parity.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-status.test.ts
  • test/integration/test/cli-journeys/migration-status-diagnostics.e2e.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/integration/test/cli-journeys/migration-status-diagnostics.e2e.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-status.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-read-commands-parity.test.ts

📝 Walkthrough

Walkthrough

This PR centralizes JSON schema contracts for all CLI migration-command outputs (list, graph, status, log, show, check) by creating a new json/schemas.ts module, then refactors five migration commands and all supporting utilities to re-export types from these schemas and rename fields to more semantic names (space, name, hash, fromContract, toContract, code instead of spaceId, dirName, migrationHash, from/to, pnCode).

Changes

Migration CLI JSON Schema Centralization and Type Refactoring

Layer / File(s) Summary
Centralized JSON schema definitions
packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts
Introduces Arktype schemas and inferred TypeScript types for all migration CLI outputs: migration entries, contracts, success envelopes, lists, graphs, status, ledger records, show operations, and check failures. Serves as the single source of truth for JSON output contracts.
Migration-check failure type and output refactoring
packages/1-framework/3-tooling/cli/src/commands/migration-check.ts, packages/1-framework/3-tooling/cli/src/utils/integrity-violation-to-check-failure.ts
Refactors check failures to use space and code (PN-MIG-CHECK-001…016) instead of pnCode. Updates integrity check helpers to capture and propagate owning space. Re-exports CheckFailure from schemas. Changes human output formatting to print [${f.code}].
Migration-list field name normalization and type consolidation
packages/1-framework/3-tooling/cli/src/commands/migration-list.ts, packages/1-framework/3-tooling/cli/src/utils/formatters/migration-list-*
Renames fields: spaceId→space, dirName→name, migrationHash→hash, from/to→fromContract/toContract. Re-exports types from centralized schemas. Updates all formatters to use new field names in edge construction, annotation keying, and space selection.
Migration-graph per-space output restructuring
packages/1-framework/3-tooling/cli/src/commands/migration-graph.ts
Refactors output from app-graph-centric to per-space model. MigrationGraphResult now includes spaces array. Updates treeSections to use space field. Changes JSON from nodes/edges to per-space spaces structure. Removes local JSON type exports in favor of schema imports.
Migration-status command refactoring to use schemas and new fields
packages/1-framework/3-tooling/cli/src/commands/migration-status.ts
Re-exports status types from schemas. Refactors executeMigrationStatusCommand to export and return MigrationStatusCommandResult with JSON diagnostics. Updates per-space computation to use space identifier. Adds missing-invariants diagnostic handling. Simplifies JSON output to {ok, spaces, summary, diagnostics}.
Migration-show and migration-log command type alignment
packages/1-framework/3-tooling/cli/src/commands/migration-show.ts, packages/1-framework/3-tooling/cli/src/commands/migration-log.ts, packages/1-framework/3-tooling/cli/src/utils/formatters/migration-log-table.ts, packages/1-framework/3-tooling/cli/src/utils/formatters/migrations.ts
Refactors show to use new field names and structured preview.statements. Changes log output to use records instead of entries. Re-exports types from schemas. Updates SerializedLedgerEntryRecord to rename fields (migrationName/migrationHash/from/to → name/hash/fromContract/toContract).
Comprehensive test suite updates for new schemas and field names
packages/1-framework/3-tooling/cli/test/**, test/integration/test/cli-journeys/*
Updates 40+ test files to validate against centralized arktype schemas, replaces pnCode with code, updates field assertions from old names to new names. Adds schema validation using arktype's type.errors. Adds comprehensive consistency lock in migration-read-commands-parity.test.ts to validate retired field absence and cross-command topology consistency.

Sequence Diagram(s)

sequenceDiagram
  participant Cmd as migration_check
  participant Helper as integrity_helpers
  participant Mapper as violation_mapper
  participant Output as cli_output
  Cmd->>Helper: run check helpers with spaceId
  Helper->>Mapper: map IntegrityViolation
  Mapper-->>Helper: CheckFailure(code, space, where, why, fix)
  Helper-->>Cmd: failures[]
  Cmd->>Output: print failure code labels
Loading
sequenceDiagram
  participant List as migration_list
  participant Agg as aggregate
  participant Build as entry_builder
  participant Format as formatter
  List->>Agg: load spaces and migration packages
  Agg-->>Build: packages per space
  Build->>Build: map to name hash fromContract toContract
  Build-->>List: normalized entries
  List->>Format: renderMigrationListWithStyle
  Format->>Format: graphForSpace(space.space)
  Format->>Format: buildEdgeAnnotations(entry.hash)
  Format-->>List: rendered tree output
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • prisma/prisma-next#636: Related changes to migration-list graph/topology field shapes and formatter usage.
  • prisma/prisma-next#705: Overlapping refactor of migration status/graph rendering toward per-space models and shared result typing.
  • prisma/prisma-next#732: Related migration-check failure shaping and single-target/multi-space handling updates.

"I nibble at schemas, neat and small,
Hop through fields and tests — one and all,
Space, name, hash now sing in line,
Code and records tidy, JSON fine.
🥕 — a rabbit's tiny schema call"

✨ 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-2836-read-command-json-redesign

@pkg-pr-new

pkg-pr-new Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: c220709

@github-actions

github-actions Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 145.06 KB (0%)
postgres / emit 117.07 KB (0%)
mongo / no-emit 76.04 KB (0%)
mongo / emit 70.89 KB (0%)
cf-worker / no-emit 174.63 KB (0%)
cf-worker / emit 143.48 KB (0%)

@wmadden-electric wmadden-electric changed the title TML-2836: redesign migration read-command --json output + lock with arktype schemas TML-2836: one consistent, schema-locked --json shape for the migration read commands Jun 5, 2026
@wmadden-electric wmadden-electric changed the title TML-2836: one consistent, schema-locked --json shape for the migration read commands TML-2836: one consistent, schema-locked --json shape for the migration read commands Jun 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts (1)

78-101: ⚡ Quick win

missingInvariantsDiagnosticSchema is inconsistent (no severity) with the other diagnostic variants
packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts defines severity for CONTRACT.UNREADABLE and MIGRATION.MARKER_NOT_IN_HISTORY, but MIGRATION.MISSING_INVARIANTS omits it. No downstream usage of diagnostic.severity was found in packages/1-framework/3-tooling/cli/, so CLI rendering is unaffected; either add severity for a uniform union or document that consumers must narrow by code before reading severity.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts` around lines
78 - 101, The union variant missingInvariantsDiagnosticSchema lacks the severity
property present on contractUnreadableDiagnosticSchema and
markerNotInHistoryDiagnosticSchema; update missingInvariantsDiagnosticSchema to
include a severity: '"warn" | "info"' field (matching the other schemas) so
statusDiagnosticSchema is a consistent discriminated union, or alternatively add
a comment/docstring on missingInvariantsDiagnosticSchema explaining consumers
must narrow by code before accessing severity—preferably add the severity field
to missingInvariantsDiagnosticSchema for uniformity.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/1-framework/3-tooling/cli/test/commands/migration-read-commands-parity.test.ts`:
- Around line 1059-1099: The test builds a failing migration-check result with
runMigrationCheck(...) but never invokes the CLI to assert a non-zero exit;
update the test to actually run the check command via
executeCommand(createMigrationCheckCommand(), ['--json']) (use
setupCommandMocks()/cleanup like the list case), capture and parse the CLI JSON
output (as you do for listOutput) and assert that the parsed ok is false and
that the exit code is non-zero; keep the existing runMigrationCheck usage for
inspecting structure but add the executeCommand call and assertions against its
exit code and JSON output to cover the CLI path.

In `@packages/1-framework/3-tooling/cli/test/commands/migration-status.test.ts`:
- Around line 127-131: The test teardown is only calling vi.clearAllMocks(),
which does not restore spies like vi.spyOn(configLoader, 'loadConfig') to their
original implementations; update the afterEach in migration-status.test.ts (the
teardown block containing afterEach) to call vi.restoreAllMocks() (either
replace or add alongside vi.clearAllMocks()) so any spies are fully restored
between tests and prevent cross-test leakage.

---

Nitpick comments:
In `@packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts`:
- Around line 78-101: The union variant missingInvariantsDiagnosticSchema lacks
the severity property present on contractUnreadableDiagnosticSchema and
markerNotInHistoryDiagnosticSchema; update missingInvariantsDiagnosticSchema to
include a severity: '"warn" | "info"' field (matching the other schemas) so
statusDiagnosticSchema is a consistent discriminated union, or alternatively add
a comment/docstring on missingInvariantsDiagnosticSchema explaining consumers
must narrow by code before accessing severity—preferably add the severity field
to missingInvariantsDiagnosticSchema for uniformity.
🪄 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: 1d3ceec6-ab75-450e-9813-7fb31890cc1c

📥 Commits

Reviewing files that changed from the base of the PR and between ad553a8 and 0a855f7.

⛔ Files ignored due to path filters (4)
  • projects/migration-graph-rendering/slices/read-command-json-redesign/code-review.md is excluded by !projects/**
  • projects/migration-graph-rendering/slices/read-command-json-redesign/plan.md is excluded by !projects/**
  • projects/migration-graph-rendering/slices/read-command-json-redesign/spec.md is excluded by !projects/**
  • projects/migration-graph-rendering/trace.jsonl is excluded by !projects/**
📒 Files selected for processing (32)
  • packages/1-framework/3-tooling/cli/src/commands/json/schemas.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-check.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-graph.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-list.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-log.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-show.ts
  • packages/1-framework/3-tooling/cli/src/commands/migration-status.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migration-list-graph-topology.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migration-list-render.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migration-list-types.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migration-log-table.ts
  • packages/1-framework/3-tooling/cli/src/utils/formatters/migrations.ts
  • packages/1-framework/3-tooling/cli/src/utils/integrity-violation-to-check-failure.ts
  • packages/1-framework/3-tooling/cli/test/commands/cross-consumer-integrity.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/format-status-summary.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-check-multi-space-command.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-check-multi-space.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-check-single-target-multi-space.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-graph.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-list-json-golden.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-list.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-log.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-read-commands-parity.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-show.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-status.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/read-commands-json-golden.test.ts
  • packages/1-framework/3-tooling/cli/test/output.json-shapes.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/formatters/migration-list-graph-topology.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/cli/test/utils/formatters/migration-log-table.test.ts
  • test/integration/test/cli-journeys/migration-check.e2e.test.ts

wmadden and others added 2 commits June 5, 2026 17:02
…shape (CI fix)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…bbit (restore spies, assert real check exit code)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden merged commit d6f3968 into main Jun 5, 2026
20 checks passed
@wmadden
wmadden deleted the tml-2836-read-command-json-redesign branch June 5, 2026 15:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants