Skip to docs content
Commands/layoutd diff

Commands

layoutd diff

See what changed and what's risky — every field, classified.

Purpose

layoutd diff answers one question: what changed, and what’s risky? It matches fields between the two account versions, classifies each change, and prints a table you can read at a glance. It does not modify files or fail your build — for the CI gate, use layoutd check.

Invocation

terminal
layoutd diff v1.json v2.json --account UserState

Output

The output is a bordered table with four columns — FIELD, CHANGE, SAFETY, and REASON — followed by a summary line.

layoutd diff · UserState
layoutd diff  —  account: UserState  [borsh]──────────────────────────────────────────────────────────────FIELD        CHANGE              SAFETY   REASON──────────────────────────────────────────────────────────────authority    unchanged           SAFE     field unchangedis_active    added at index 1    DANGER   field inserted before existing fields — shifts all following offsets, old accounts misreadbalance      offset 32 → 33      DANGER   offset shifted by preceding insert — existing accounts require migration before usebump         offset 40 → 41      SAFE     offset shifted but trails the insert — re-serialized correctly under borsh by name──────────────────────────────────────────────────────────────  2 safe   0 review   2 danger

Reading the SAFETY column

  • SAFE — a provably-correct transformation exists; no action needed.
  • REVIEW — probably safe, but correctness depends on context the tool can’t see.
  • DANGER — no provable path; existing accounts would be misread without a migration.

The summary line — 2 safe 0 review 2 danger — counts each verdict. Any non-zero danger count means the upgrade needs a migration before it is safe to ship.

Verify against your binary

The output above reproduces the on-screen example and follows the spec’s classifier rules. Your installed binary is the ground truth — re-run it on your own account versions to confirm the exact verdicts.