tinyactors diff

Compare two versions and show what changes for running actors.

Usage

shell
tinyactors diff [options] OLD NEW

Compares two images chart by chart, matching charts by name. Each version is an image, a system manifest or one chart. Compares data by id, states by id and transitions by source and events. Compares invokes, executable content as decoded instructions and the events each state handles. Marks each change as breaking for actors running the old version, or as a change of behaviour. A state removed, moved or of another kind is breaking. So are data removed, another datamodel and an event a state no longer handles. The answer says what a migration does to running actors.

Options

  • -W, --warnings-as-errorsRefuse a chart that compiles with a warning.
  • -I, --include DIRSearch DIR for a src that is not beside the file naming it, in the order given. Repeatable.
  • -c, --chart NAMELook at the chart named NAME only. Repeatable.
  • -s, --segment NRead the image that segment N of a snapshot runs. Default: the newest live segment.
  • --exit-codeExit with 1 when the two differ, as git diff --exit-code does; with --breaking, when a change breaks running actors.
  • --breakingList only the changes that break actors running the old version.
  • --allList the charts that did not change too.

Configure output formats like -f json using the shared options on the command reference.

Examples

shell
tinyactors diff order-v1.tai order-v2.scxml
output
# Diff

## Old

- **Path**: order-v1.tai
- **Hash**: 7264231f9a5f18b3
- **Charts**: 1

## New

- **Path**: order-v2.scxml
- **Hash**: fbce6399f9cf5b5b
- **Charts**: 1

- **Identical**: no

## Summary

- **Charts added**: 0
- **Charts removed**: 0
- **Charts changed**: 1
- **Charts unchanged**: 0
- **Differences**: 17
- **Breaking**: 0

## Charts

### Chart 1: order

- **Name**: order
- **Change**: changed
- **Datamodel**: ecmascript
- **Binding**: early

#### States

| State | Change | Breaking | Before | After |
| --- | --- | --- | --- | --- |
| paying | onentry changed, onexit changed | no | atomic in /scxml | atomic in /scxml |
| refunded | added | no |  | final in /scxml |
| cancelled | added | no |  | final in /scxml |

#### Transitions

| Source | Events | Change | Breaking | Before | After |
| --- | --- | --- | --- | --- | --- |
| open | checkout | condition changed | no | → paying (external) | cond `total > 0` → paying (external) |
| paying | charge.declined | removed | no | → open (external) |  |
| open | cancel | added | no |  | → cancelled (external) |
| paying | charge.declined error.communication payment.timeout | added | no |  | cond `attempts < 3` → paying (external) |
| paying | charge.declined error.communication payment.timeout | added | no |  | → cancelled (external) |
| paid | refund | added | no |  | → refunded (external) |

#### Data

| ID | Change | Breaking | Before | After |
| --- | --- | --- | --- | --- |
| attempts | added | no |  | `0` in /scxml |
| refund | added | no |  | `null` in /scxml |

#### Actions

| Where | Change | Before | After |
| --- | --- | --- | --- |
| onentry paying | changed | send event charge to charges type payments id pay with amount=`total` | assign `attempts` = `attempts + 1`; send event charge to charges type payments id pay with amount=`total`; send event payment.timeout to itself id deadline after 30s |
| onexit paying | added |  | cancel deadline |

#### Invokes

_none_

#### Events

| State | Event | Change |
| --- | --- | --- |
| open | cancel | newly handled |
| paying | error.communication | newly handled |
| paying | payment.timeout | newly handled |
| paid | refund | newly handled |

## Events added

- cancel
- error.communication
- payment.timeout
- refund

## Events removed

_none_

Compare an image with a newer version of its chart.

shell
tinyactors diff --breaking --exit-code deployed.tai order.scxml
output
# Diff

## Old

- **Path**: deployed.tai
- **Hash**: 7264231f9a5f18b3
- **Charts**: 1

## New

- **Path**: order.scxml
- **Hash**: 5e66ab57693504aa
- **Charts**: 1

- **Identical**: no

## Summary

- **Charts added**: 0
- **Charts removed**: 0
- **Charts changed**: 1
- **Charts unchanged**: 0
- **Differences**: 13
- **Breaking**: 0

## Charts

_none_

## Events added

- cancel
- error.communication
- payment.timeout

## Events removed

_none_

Fail if a change breaks running actors.

shell
tinyactors diff -f json --chart order old.tai new.tai
output
{
  "old": {
    "path": "old.tai",
    "hash": "7264231f9a5f18b3",
    "charts": 1
  },
  "new": {
    "path": "new.tai",
    "hash": "5e66ab57693504aa",
    "charts": 1
  },
  "identical": false,
  "summary": {
    "chartsAdded": 0,
    "chartsRemoved": 0,
    "chartsChanged": 1,
    "chartsUnchanged": 0,
    "differences": 13,
    "breaking": 0
  },
  "charts": [
    {
      "name": "order",
      "change": "changed",
      "datamodel": "ecmascript",
      "binding": "early",
      "states": [
        {
          "state": "paying",
          "change": "onentry changed, onexit changed",
          "breaking": false,
          "before": "atomic in /scxml",
          "after": "atomic in /scxml"
        },
        {
          "state": "cancelled",
          "change": "added",
          "breaking": false,
          "before": "",
          "after": "final in /scxml"
        }
      ],
      "transitions": [
        {
          "source": "open",
          "events": "checkout",
          "change": "condition changed",
          "breaking": false,
          "before": "→ paying (external)",
          "after": "cond `total > 0` → paying (external)"
        },
        {
          "source": "paying",
          "events": "charge.declined",
          "change": "removed",
          "breaking": false,
          "before": "→ open (external)",
          "after": ""
        },
        {
          "source": "open",
          "events": "cancel",
          "change": "added",
          "breaking": false,
          "before": "",
          "after": "→ cancelled (external)"
        },
        {
          "source": "paying",
          "events": "charge.declined error.communication payment.timeout",
          "change": "added",
          "breaking": false,
          "before": "",
          "after": "cond `attempts < 3` → paying (external)"
        },
        {
          "source": "paying",
          "events": "charge.declined error.communication payment.timeout",
          "change": "added",
          "breaking": false,
          "before": "",
          "after": "→ cancelled (external)"
        }
      ],
      "data": [
        {
          "id": "attempts",
          "change": "added",
          "breaking": false,
          "before": "",
          "after": "`0` in /scxml"
        }
      ],
      "actions": [
        {
          "where": "onentry paying",
          "change": "changed",
          "before": "send event charge to charges type payments id pay with amount=`total`",
          "after": "assign `attempts` = `attempts + 1`; send event charge to charges type payments id pay with amount=`total`; send event payment.timeout to itself id deadline after 30s"
        },
        {
          "where": "onexit paying",
          "change": "added",
          "before": "",
          "after": "cancel deadline"
        }
      ],
      "invokes": [],
      "events": [
        {
          "state": "open",
          "event": "cancel",
          "change": "newly handled"
        },
        {
          "state": "paying",
          "event": "error.communication",
          "change": "newly handled"
        },
        {
          "state": "paying",
          "event": "payment.timeout",
          "change": "newly handled"
        }
      ]
    }
  ],
  "eventsAdded": [
    "cancel",
    "error.communication",
    "payment.timeout"
  ],
  "eventsRemoved": []
}

Compare one chart of two images as JSON.

Exit status

  • 1An input is refused: it does not compile or verify, or it is damaged or of an unknown format.
  • 1With --exit-code, the two versions differ; with --breaking too, a change breaks running actors.
  • 3A file cannot be read or written, or memory runs out.