check
Runs compatibility checks against the current project. This is the command everything else in this documentation builds toward.
Run compatibility checks against the current project
Usage: stellar-canary check [OPTIONS]
Options:
--protocol <PROTOCOL> Target protocol version (overrides configuration)
--network <NETWORK> Network to run live checks against [default: testnet]
--rpc-url <RPC_URL> RPC endpoint to use for live checks
--network-passphrase <PASSPHRASE> Network passphrase used to verify the endpoint's identity and to sign transactions for this run (empty values are rejected)
--project-root <PATH> Directory to treat as the project root (default: the current directory)
--config <CONFIG> Path to a configuration file (default: .stellar-canary.toml in the project root)
--rpc-timeout <RPC_TIMEOUT> Request timeout for the RPC client in seconds [default: 10]
--rpc-max-retries <RPC_MAX_RETRIES> Maximum number of retries after a failed RPC attempt; 0 disables retries (attempts = n + 1) [default: 3]
--rpc-retry-delay-ms <RPC_RETRY_DELAY_MS> Base delay between RPC retry attempts in milliseconds, exponential backoff capped at 30s [default: 500]
--fixtures-dir <FIXTURES_DIR> Directory containing fixture files [default: fixtures]
--fixture <ID> Run only the fixture with this exact ID
--surface <SURFACE> Run fixtures from only this surface [possible values: xdr, rpc, soroban]
--cache-dir <PATH> Directory for cached fixture execution results [default: .stellar-canary-cache in the project root; created if missing]
--format <FORMAT> Output format [default: terminal] [possible values: terminal, json, markdown]
--json Shorthand for --format json
--output <PATH> Write the rendered report to this path, in addition to stdout.
--allow-empty Allow a run in which no fixture applies. Without it such a run fails with exit code 2.
--verbose Include skip reasons in Markdown/terminal output and populate the JSON report's verbose field.
--quiet Shorten terminal-format output to a single status line.
--max-concurrency <MAX_CONCURRENCY> Maximum number of concurrent network requests for RPC/Soroban fixtures [default: 4]
--no-cache Do not read or write the local result cache. Every fixture runs fresh.
--live-cache-ttl <SECONDS> Allow RPC and Soroban results from the local cache to be replayed for up to this many seconds. Off by default.
--locked Require .stellar-canary.lock to exist and its pinned fixtures.packDigest to match the current fixture pack (exit code 2 otherwise)
-h, --help Print help
Protocol selection
Precedence, highest first: --protocol flag, then .stellar-canary.toml’s
protocol field, then the built-in default of 28.
Fixture directory
--fixtures-dir defaults to fixtures relative to the project root: the
current directory, or the directory named by --project-root.
It accepts any local path — including a checkout of
ProtocolCanary-Fixtures
— and is loaded recursively. A directory that does not exist is loaded as
zero fixtures. In releases after 0.1.1 a run that then has nothing to execute
fails with exit code 2 (see No applicable fixtures);
0.1.1 and earlier reported a 0/0 pass. See Fixtures.
Targeting fixtures
Use --fixture <ID> to run one fixture by its exact ID, or --surface to run
only xdr, rpc or soroban fixtures. Combine the flags to select one
fixture on a specific surface. A filter with no matches exits 2 and reports
no matching fixtures found.
stellar-canary check --fixture p28-xdr-1
stellar-canary check --surface xdr
stellar-canary check --fixture p28-xdr-1 --surface xdr
Output formats
terminal(default) — human-readable, colorized when the output is a TTY.--format json(or the--jsonshorthand) — machine-readable, the contractProtocolCanary-Actionconsumes. See JSON Report.--format markdown— a Markdown table, suitable for a PR comment or job summary.
Note on verbosity: The
--quietflag only affects theterminaloutput format, condensing the output to a singleStatus:line instead of a full report. The--verboseflag affects the detail included: it adds skip reasons to bothmarkdownandterminaloutputs, and is passed through into thejsonreport’sverbosefield.--verbosealso logs every RPC attempt to stderr as one line — e.g.[RPC attempt 1/3: 124ms] getNetwork <url>— with basic-auth userinfo masked as***:***@and query values masked as***before printing (CF-08), so endpoint credentials never reach a CI log. Without--verboseno attempt lines are emitted at all.
The report is printed to stdout regardless of exit code, including on a compatibility failure — a caller does not need to inspect stderr to get the report.
Writing the report to a file
--output <PATH> writes the rendered report to PATH in addition to
printing it to stdout. Stdout behavior is unchanged, so an existing shell
redirection (stellar-canary check --json > result.json) still works, and
a caller that cannot capture stdout — for example one wrapped by a tool
that does not pass stdout through cleanly — has a direct way to get the
report into a file.
The file receives exactly the bytes stdout receives, in the format
selected by --format/--json, and including the trailing newline
println! adds. That also means --quiet writes its single Status:
line rather than a full report. The file is created if PATH does not
exist and truncated if it does, and it is written before anything is
printed, so an unusable path fails before a report reaches stdout.
stellar-canary check --json --output result.json
stellar-canary report result.json --format markdown
The exit code for the run itself is unchanged by --output: it never
turns a 0 into a 1 or the other way around. The one failure mode the
flag adds is PATH itself — a directory that does not exist, or one the
process cannot write — which is reported as a configuration error
(exit code 2) and prints nothing to stdout, since the report could not
be produced where it was asked for. See Exit Codes.
Network behavior
Not every check requires the network:
- XDR checks are offline. They decode/encode against the official
stellar-xdrcrate with no network call. - RPC and Soroban checks require a live, reachable
--rpc-url.--networkselects which network name is reported (testnetby default);--rpc-urlis the actual endpoint contacted. If RPC/Soroban checks are enabled (the default) and the endpoint is unreachable, that is reported as an execution error, not skipped — see Exit Codes and network troubleshooting. - The endpoint’s identity is validated against the run’s assumptions.
When
getNetworksucceeds, its passphrase is compared to--networkand its protocol version to--protocol: a passphrase mismatch aborts as a configuration error (exit2) before any check runs, since results from the wrong network must not be attributed to the requested one; an observed protocol that differs from the target prints awarning:line on stderr (e.g.warning: the RPC endpoint reports protocol 27, but this run targets protocol 28) and the run continues — observing a not-yet-upgraded network while rehearsing the next protocol is a legitimate use case, but it must be visible rather than only an(observed protocol N)annotation in the report. - Custom networks are verified with
--network-passphrase.testnet,mainnetandfuturenethave published passphrases that are used automatically; a custom--networkname has none, so the passphrase comparison is skipped unless you supply one with--network-passphrase <PASSPHRASE>. The flag also overrides the well-known default — for example when you deliberately point--network testnetat a private node that uses a different passphrase. An empty value is rejected as an argument validation error (exit2), because an empty passphrase would silently disable the very comparison the flag exists to enable. The same value is the one a signing consumer would use for this run.
Disable a surface in .stellar-canary.toml ([tests] rpc = false /
soroban = false) to run fully offline.
Example: PASS
stellar-canary check --fixtures-dir ProtocolCanary-Fixtures/protocol-28 --protocol 28
Stellar Protocol Canary
────────────────────────────────────────
Project: Protocol-Canary (unknown)
Target protocol: 28
Network: testnet (observed protocol 28)
XDR
3/3 PASS
RPC
1/1 PASS
Soroban
1/1 PASS
────────────────────────────────────────
5/5 applicable checks passed.
Status: PASS
Exit code 0.
Example: JSON
stellar-canary check --fixtures-dir ProtocolCanary-Fixtures/protocol-28 --protocol 28 --json
See the full real example in Your First Check and the field-by-field reference in JSON Report.
Example: FAIL
A real fixture deliberately given a wrong expected value:
Stellar Protocol Canary
────────────────────────────────────────
Project: Protocol-Canary (unknown)
Target protocol: 28
Network: testnet (observed protocol 28)
XDR
demo-xdr-fail ❌ FAIL
────────────────────────────────────────
0/1 applicable checks passed.
Status: NOT READY
Failure:
demo-xdr-fail
failed to decode StellarValue input
failed to fill whole buffer
Exit code 1. Note that the terminal reporter’s headline for a failing
run reads Status: NOT READY — the machine-readable status field in
--json output is "fail"; see JSON Report for the
exact string values a script should key off of instead of terminal text.
Result cache
check keeps a small file-backed cache in .stellar-canary-cache in the
project root (add it to .gitignore).
-
--cache-dir <PATH>stores the cache somewhere else — a CI runner’s persistent cache, a tmpfs mount, anywhere a pipeline can keep a directory between runs. The directory is created if it does not exist; a path that cannot be created exits2before any fixture runs, with an error naming the flag and the path. A relative path resolves against--project-rootwhen that flag is given. Without--cache-dirnothing changes. -
XDR results are cached. They depend only on the fixture bytes, so an entry stays valid until the fixture, a payload it references, the protocol or the tool version changes. Any of those changes is a cache miss.
-
RPC and Soroban results are not cached by default. A recorded answer from a network says nothing about what the network does now. Pass
--live-cache-ttl <SECONDS>to accept a replay no older than that, for example to stay under a provider’s rate limit. -
--no-cacheskips the cache entirely, for reading and for writing. -
A replayed result is marked
"source": "cache"in the JSON report, and the terminal and Markdown reports say how many results were replayed. -
A damaged, unreadable or old-layout entry is ignored and the fixture runs.
Strict pinning with –locked
--locked turns check into a CI gate over the fixture-pack pin
(.stellar-canary.lock, written by lock):
stellar-canary lock
stellar-canary check --locked
With the flag, the run first loads the lockfile from the project root and
compares its pinned [fixtures].packDigest against the canary-pack-v1
digest of the resolved fixture directory. If the lockfile is missing, unreadable,
or the pack has drifted — an edited or added fixture file changes the
digest — the run fails with exit code 2 before any fixture executes,
and the message names stellar-canary lock as the command that repairs the
pin. A fresh, matching lockfile lets the run proceed exactly as usual.
Without the flag the lockfile is not consulted at all, so --locked is
strictly opt-in. This is deliberately stricter than lock verify, which
reports the same conditions as a verification failure with exit code 1:
--locked fails with 2 so a CI pipeline can tell “the pin does not hold”
apart from “a fixture genuinely broke”.
No applicable fixtures
A run that executes zero fixtures proves nothing about compatibility, so after
0.1.1 it fails instead of passing:
error: configuration error: no checks ran: all 7 loaded fixtures were skipped. 7 target another protocol (this run targets protocol 29; the fixtures target protocol 28). Executing nothing is not evidence of compatibility; pass --allow-empty if an empty run is intended.
The exit code is 2 and no report is printed. The message says which case
applies: the fixtures directory is missing, it holds no *.toml files, or
every loaded fixture was skipped because of its protocol, a disabled surface
or a capability the project does not declare. --allow-empty makes the run
proceed, prints a warning, and reports counts.total: 0; it never hides a
failure in a run that does execute fixtures.
stellar-canary 0.1.1 and earlier exited 0 with Status: PASS in these
cases.