Check charts in CI

Four commands fail a pull request with exit status 1. The last, diff, compares the change with the version your actors run now.

Copy the workflowLearn the commands

1. Add the command to mise.toml

mise installs the release on each runner and checks it against the release's checksums. Name a version in place of latest to pin it.

mise.tomltoml
[tools]
"github:tinyactors-dev/tinyactors-core" = "latest"

2. Keep the image you deploy

Compile the chart when you deploy it and store deployed.tai where the next build can fetch it. The deployed chart here is the tutorial's order.

shell
tinyactors compile order.scxml -o deployed.tai
output
# Compile

- **Compiled**: yes
- **Output**: deployed.tai
- **Emit**: image
- **Bytes**: 2720
- **Hash**: 5e66ab57693504aa
- **Charts**: 1
- **Boot actors**: 1

## Diagnostics

_none_

3. Check, lint and format the change

The pull request renames paying to charging. check -W treats a warning as an error, and the renamed chart compiles with neither.

order.scxml
  <transition event="checkout" cond="total &gt; 0" target="charging"/>
  <transition event="cancel" target="cancelled"/>
</state>
<state id="charging">
shell
tinyactors check -W order.scxml
output
# Check

## Inputs

- order.scxml

- **Valid**: yes
- **Bytes**: 2720
- **Hash**: 20a8e7019c80b057
- **Charts**: 1
- **Boot actors**: 1

## Diagnostics

_none_

With --deny all, any finding of lint exits with 1, such as an unreachable state. The renamed chart has none.

shell
tinyactors lint --deny all order.scxml
output
# Lint

- **Warnings**: 0
- **Notes**: 0
- **Denied**: 0

## Findings

_none_

Charts in one layout keep a pull request's diff to its real edits. fmt --check fails on a file out of layout and changes nothing; fmt -w rewrites it.

shell
tinyactors fmt --check order.scxml
output
# Fmt

- **Mode**: check
- **Files**: 1
- **Changed**: 0
- **Refused**: 0

## Results

| File | Changed | Refused | Image |
| --- | --- | --- | --- |
| order.scxml | no | no | same |

## Diagnostics

_none_

4. Compare the change with the deployed image

The change passes every check, yet orders waiting in paying would lose their state. diff --breaking --exit-code lists the changes that break them and exits with 1.

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

## Old

- **Path**: deployed.tai
- **Hash**: 5e66ab57693504aa
- **Charts**: 1

## New

- **Path**: order.scxml
- **Hash**: 20a8e7019c80b057
- **Charts**: 1

- **Identical**: no

## Summary

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

## Charts

### Chart 1: order

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

#### States

| State | Change | Breaking | Before | After |
| --- | --- | --- | --- | --- |
| paying | removed | yes | atomic in /scxml |  |

#### Transitions

_none_

#### Data

_none_

#### Actions

_none_

#### Invokes

_none_

#### Events

_none_

## Events added

_none_

## Events removed

_none_

- **Migration**: Chart order: Actors in removed states are completed to a legal configuration of the new version, the nearest kept ancestor entering its initial state, and no onentry runs: paying → open.

It exits with status 1: a migration would put each order waiting in paying back in open, its charge already sent.

A removed state sends actors to an ancestor

An actor in a removed state enters its nearest kept ancestor's initial state, and no entry action runs.

Source:tinyactors-core, docs/cli.md

Keep the state's id, or deploy the new version without migrating, so running orders finish on the old one.

5. Run the checks on every pull request

This GitHub Actions job installs mise's tools with mise-action and runs the four commands. Fetch deployed.tai from wherever your deploy stores it.

.github/workflows/charts.ymlyaml
name: charts
on: pull_request
jobs:
  charts:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: jdx/mise-action@v2
      - run: tinyactors check -W order.scxml
      - run: tinyactors lint --deny all order.scxml
      - run: tinyactors fmt --check order.scxml
      - run: tinyactors diff --breaking --exit-code deployed.tai order.scxml

Exit status 1 means a check failed

Status 2 is a command line not understood, and 3 a file that could not be read.

Source:tinyactors-core, docs/cli.md