Skip to content

TML-2812: file unify-pretty-rendering slice in the migration-graph-rendering project#709

Merged
wmadden merged 2 commits into
mainfrom
tml-2812-unify-pretty-rendering
Jun 3, 2026
Merged

TML-2812: file unify-pretty-rendering slice in the migration-graph-rendering project#709
wmadden merged 2 commits into
mainfrom
tml-2812-unify-pretty-rendering

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

At a glance

After #704 (log), #705 (status), and #706 (list→tree) merged, the migration read-command family was supposed to share one rendering engine (D1). Demoing the result against the demo fixture revealed it doesn't, in three independent ways:

  1. Trunk choice differs. list picks the live-contract chain as the trunk; status and graph pick the historical-ref chain.
  2. Per-row data differs. list shows ops + invariants; status shows applied/pending; graph shows neither.
  3. Spaces shown differs. list and status render every on-disk space; graph silently scopes to one.

This PR is docs-only. It files TML-2812 as a new slice in the migration-graph-rendering project — locking the design before implementation.

What this PR contains

  • New slice spec at projects/migration-graph-rendering/slices/unify-pretty-rendering/spec.md — zero-open-questions, decision-led, with at-a-glance, locked design, acceptance, and out-of-scope.
  • New design decision D14 in decisions.md — pins the trunk-choice rule (the chain containing the live contract is the trunk; historical-ref chains render as side-branches). D1 promised "one shared renderer"; D14 closes the gap that allowed three commands feeding the same renderer to pick different trunks.
  • README slice list gains an entry for TML-2812.

No code changes; the implementation is the next slice's PR.

Locked decisions

  • Trunk: live-contract chain (D14). list already does this; status and graph adopt it.
  • Per-row data: dirName · from → to · N ops · {invariants} everywhere. status appends a single overlay column (✓ applied / ⧗ pending); that's the only command-specific visual difference.
  • Spaces: all on-disk spaces by default in all three commands; --space <id> narrows. graph adopts the policy list and status already use (D4).
  • JSON shapes stay distinct. graph's { nodes, edges } stays; list/status per-space arrays stay. JSON consumers diverge by design (D2/D3).

Out of scope (called out in the spec)

  • JSON unification — divergent by design.
  • Retiring or aliasing migration graph — explicitly deferred per operator ("Let's leave consolidation for a later task"). After TML-2812 lands, graph and list produce identical pretty output but distinct JSON; whether graph should remain a separate top-level command is a future call.
  • Column alignment — separate ticket (TML-2811).
  • Trunk-choice extensibility — locking one rule for now; a future --trunk <ref> flag is conceivable but not asked for here.

Alternatives considered

  • Don't unify; document divergences. Cheap but bad: D1 is the project's thesis. Letting it drift on disk negates the renderer-consolidation work.
  • Merge list and graph now. Tempting, since their pretty output will converge. But their JSON consumers genuinely differ (one wants the flat package list, the other wants { nodes, edges }). Operator deferred this decision; surfacing a separate slice keeps the option open without forcing it now.
  • Different trunk rule (e.g. "longest path" or "graph DAG sink"). Algorithmically tidier, but the live-contract chain is the one the operator's workflow already anchors on (it's migrate's default --to). D14 records the rationale.

Adds the slice spec, decision D14 (trunk-choice rule = live-contract chain),
and a README entry for TML-2812. The slice closes the gap between the project
thesis (D1: one shared graphical renderer) and what the merged slices produce
on disk: same input ⇒ byte-identical pretty output across migration list,
migration status, migration graph, modulo statuss applied/pending overlay
column and per-command footer.

Three locked changes:
- trunk-choice rule (D14): the chain containing the live contract is the
  trunk; historical-ref chains render as indented side-branches. list
  already implements this; status and graph adopt it.
- per-row data: every migration row everywhere renders
  dirName . from -> to . N ops . {invariants}; status appends a single
  overlay column.
- space iteration: graph adopts the all-spaces-by-default policy that list
  and status already use (D4).

JSON shapes stay distinct (D2/D3). The question of whether graph is worth
keeping as a separate top-level command is deferred per operator.

Signed-off-by: Will Madden <madden@prisma.io>
@wmadden-electric wmadden-electric requested a review from a team as a code owner June 3, 2026 12:28
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (3)
  • projects/migration-graph-rendering/README.md is excluded by !projects/**
  • projects/migration-graph-rendering/decisions.md is excluded by !projects/**
  • projects/migration-graph-rendering/slices/unify-pretty-rendering/spec.md is excluded by !projects/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4092ce62-22e4-4954-94c4-7bfc93e97842

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2812-unify-pretty-rendering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Per markdown-no-artificial-line-wraps skill: prose paragraphs are now one
line each. No content changes.

Signed-off-by: Will Madden <madden@prisma.io>
@wmadden wmadden merged commit e4b7a7c into main Jun 3, 2026
20 checks passed
@wmadden wmadden deleted the tml-2812-unify-pretty-rendering branch June 3, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants