Page kind: Reference
swarmops check list#
List the checks REV's tree describes, or those of a directory with --dir.
A tree names its checks in .swarmops/checks.toml (version 1): one [check.NAME] table a check, each one command (argv) run with no shell, with a directory (dir), a timeout (timeout_s), the stages its answer is wanted at (stages, default before-land) and the paths it reads (inputs, default the whole tree: path patterns in which * is one whole segment and a last ** every depth below), the checks that run before it (needs, names of checks of the file; a check whose need did not pass is skipped), whether it runs even then (always, default false) and the group it belongs to (group, a table of name, scope host and wait_s: only one check of a group runs on a host at a time); any other key is refused at its line, and checks that need one another in a circle are refused. This reads .swarmops/checks.toml at REV (default main), resolved once; a tree without it lists check.argv of .swarmops/workspaces.json as the one check default, and a tree with neither lists no check. Each check comes with its argv, its directory, its timeout, the digest of its definition, its stages, the inputs, the needs and the group it declares, sorted by name; --stage lists only the checks of one stage. --dir DIR reads the files below DIR on this host instead, and opens no store: the answer says vouched, since only the caller stands behind them. A file that does not read is E_CHECK_FILE, naming its line and key. Reads only: no identity, no lock.
- Group
checks- Since
0.13.0- Mutates
- no
- Identity required
- no
- MCP tool
check_list- Envelope op
check_list- Exit codes
- 01
- Errors
- E_CHECK_FILE
Syntax#
swarmops check list [OPTIONS] [REV]Required arguments#
None.
Optional arguments#
The command also takes the global options.
Syntax: <REV>.
The changeset whose tree's checks to list.
Syntax: --dir <DIR>.
Read the check file below DIR on this host, not from the store.
Syntax: --stage <STAGE>.
List only the checks of this stage. Values: before-land: Before a change lands: the gate; after-land: After a change has landed; scheduled: On a schedule; release: Before a release is cut; manual: Only when someone asks for it; deploy: Before a deployment.
Examples#
swarmops --repo [tmp]/store check listShow 72 more lines
"version":Exit code 0. Recorded by the CLI tests. A name in square brackets, such as [tmp] or [c1], stands for what differs from run to run: the test's temporary directory, an id, a time.
No recorded example yet.
Details#
check list says what a tree names as its checks. It reads one file, writes nothing, takes no
lock and needs no identity. Nothing in SwarmOps runs these checks yet: ws land --check still runs
check.argv of .swarmops/workspaces.json alone.
Two forms#
- From the store,
check list [REV]: the tree ofREV(defaultmain), resolved once and recorded inmeta.resolved; the result names thattreeand saysvouched: false. - From a directory,
check list --dir DIR: the files belowDIRon this host, for a host with no store at hand, such as a CI job on a git checkout. It opens no store, so--repo,SWARMOPS_REPOand--asare not used, and the envelope has nometa.repo. The result, and anE_CHECK_FILErefusal'sdetails, sayvouched: true: only the caller stands behind what the directory holds, so no gate accepts such an answer..swarmopsand the file are never followed if they are symbolic links.REVand--dirtogether are a usage error.
In both forms a .swarmops that is a symbolic link is refused, not_a_file, and the message
names it: the store follows no link either, and such a tree is not listed as one without checks.
The check file, version 1#
.swarmops/checks.toml at the tree's root, in TOML 1.1 (which also reads every TOML 1.0 file):
version = 1
[check.unit]
argv = ["cargo", "test", "--locked"]
[check.lint]
argv = ["cargo", "clippy", "--", "-D", "warnings"]
dir = "crates/app"
timeout_s = 600
stages = ["before-land", "after-land"]
inputs = ["crates/app/**", "Cargo.toml", "Cargo.lock"]
[check.test]
argv = ["cargo", "nextest", "run", "--profile", "ci"]
reports = [{ format = "junit", path = "target/nextest/ci/junit.xml" }]| Key | Required | Default | Rule |
|---|---|---|---|
version | yes | The integer 1. | |
[check.<name>] | no | no checks | One table a check. The name is 1 to 64 bytes of a-z, 0-9, - and _, starting with a letter or a digit. |
argv | yes | The program and its arguments, 1 to 1,024 strings, 64 KiB together, no NUL byte, the program not empty. It runs with no shell: steps and conditions belong in the repository's own scripts. | |
dir | no | "." | The directory of the tree it runs in: . or a repository path (no empty, . or .. part, no leading or trailing /). Whether the tree holds it is not checked. |
timeout_s | no | 900 | The most seconds it may run, 1 to 86,400. |
stages | no | ["before-land"] | When its answer is wanted: 1 to 6 of before-land, after-land, scheduled, release, manual and deploy, none twice. An unknown stage, an empty array, an item that is not a string, or a stage given twice is refused as value, at the line of the item (or the array) at fault. The key is stages, plural: stage is refused as an unknown key. |
reports | no | none | The JUnit and SARIF reports the check leaves in its tree, which check run reads into findings once it has ended (check run): 1 to 16 tables, each of format (junit or sarif) and path (a repository path relative to the check's dir, no path twice in one check), as an inline table or a [[check.<name>.reports]] table. Not an array, an empty one, a 17th report or an item that is not a table is refused as value with details.key check.<name>.reports; a format or path outside its rule, or a table without one of them, as value with details.key check.<name>.reports.format or .path; any other key in a table as unknown_key. Each at the line at fault. |
inputs | no | the whole tree | The paths the check reads: 1 to 256 path patterns of at most 4,096 bytes each, none twice. A pattern is names between /: a name stands for itself, * for any one name, and a last ** for everything below that point, never the directory itself. So crates/app/* meets crates/app/Cargo.toml and not crates/app/src/lib.rs, crates/app/** meets both and not crates/app, and ** meets every path. A pattern is matched against a path from the tree's root, whatever the check's dir. A * beside other bytes (*.rs, server-*), a ** before the last segment and a name no repository path holds (an empty one, ., ..) are refused. A pattern matches files, executables and symbolic links, a link by its own path and never by what it points at; it matches no directory, so web matches nothing in a tree where web is a directory. Whether a pattern matches any path of the tree is not checked. Not an array, an empty one (leave the key out for the whole tree), an item that is not a string, a pattern outside these rules, one given twice or a 257th is refused as value with details.key check.<name>.inputs, at the line of the item (or the array) at fault. |
needs | no | none | The checks that must pass before this one starts: 1 to 32 names of checks of the same file, each of the grammar of a check's name, none twice, none the check itself. check run runs a check after the checks it needs, and skips it when one of them did not pass, unless it says always. Not an array, an empty one (leave the key out), an item that is not a string or not a check's name, the check itself, a name given twice or a 33rd is refused as value with details.key check.<name>.needs, at the line of the item (or the array) at fault. Whether a need names a check of the file is not judged by check list, nor by the reader: check run refuses a run that selects a check whose need is no check of the stage it runs, and check lint names each such fault. Checks that need one another in a circle are refused as cycle (below). |
always | no | false | true to run the check even when a check it needs did not pass, or was skipped. Not a boolean is refused as value with details.key check.<name>.always. |
group | no | none | A table { name, scope, wait_s } naming an exclusive group: check run lets only one check of a group run on a host at a time, the others wait. name is required, of the grammar of a check's name, and names the lock file <name>.lock; scope is required and is host (another word is refused as value); wait_s is a whole number of seconds from 0 to 86,400, 900 when left out: how long check run waits for the group, 0 trying once. A table that is none, lacks name or scope, or holds another key is refused as value (unknown_key for another key), with details.key check.<name>.group or check.<name>.group.<key>, at the line at fault. The directory the locks are in is the operator's setting of check run, not a key of the file. |
The file holds at most 1 MiB and 1,000 checks, and a check at most 16 reports, 256 input
patterns and 32 needs. Any TOML table syntax reads alike: a header, dotted keys (check.unit.argv = [...]) or
an inline table. The
limits page lists each bound with its constant.
Any other key is refused, at its line, as unknown_key. Later releases add keys to version 1
(what a check is run with, say); a build that does not know a key refuses the file instead of
listing, or running, a check without it: a build up to 0.13.0 refuses a file that names inputs,
needs, always or group (as unknown_key, at the key's line). A change to what an
existing key means is a new version.
The answer#
The checks come sorted by name, so moving a table in the file changes nothing but their line. Each
has its argv, its dir, its timeout_s and its stages with the defaults filled in, the line
its table starts on, its reports in declared order, its inputs and its needs sorted
bytewise when it declares any, always when it is true, its group when it names one, and
definition_digest, a digest of argv, dir, timeout_s, reports, inputs, needs and
always (not of the name, nor of the stages, which say when an answer is wanted, nor of the group,
which says when the command may run: not what it computes): two checks that differ only in name,
stages or group, or a check renamed, share a digest, and a default written out gives the
same digest as one left out; a check that declares no report, no input, no need and no always
has the digest it had before those keys existed, and the order inputs or needs are written in
changes none. stages
come in the stages' own order (before-land, after-land, scheduled, release, manual,
deploy), whatever order the file wrote them in. The same tree gives the same result byte for
byte, whichever changeset names it.
The digest is provisional. Its recipe is not part of the hash contract and may change in a later release; compare digests made by one release only.
A tree without the file#
When the tree holds no .swarmops/checks.toml, check.argv of .swarmops/workspaces.json, if it
names a command, is the one check default: that argv, at the root, with check.timeout_s or 900,
the stage before-land (the check ws land --check runs before a land), and no line; file says
.swarmops/workspaces.json. That file is read in the shape and the size a workspace reads it in, at
most 64 KiB of JSON, so check list refuses every file that ws land --check refuses (as
E_CHECK_FILE, where the land says E_INVALID_ARG). It also holds check.argv and
check.timeout_s to version 1's rules, which the land does not: a timeout past 86,400 s, or an argv
whose program is empty, is refused here and accepted by the land. The land never reads
check.timeout_s at all, and takes its own --check-timeout; the timeout_s listed for default
is the one a later runner will use. A tree with neither file, or with an empty or missing
check.argv, lists no check and exits 0.
One stage#
--stage STAGE (the request's stage) lists only the checks whose stages hold STAGE, still
sorted by name, in either form, and the result echoes stage; without it every check is listed
and the result has no stage. A stage no check names lists none and exits 0. --stage before-land lists what check run runs by default.
A tree that holds .swarmops/checks.toml is listed from it alone, whatever workspaces.json
says. ws land --check does not read the check file yet, so in such a tree the two can disagree
until checks run through SwarmOps.
Refusals#
A file that does not read is E_CHECK_FILE, exit 1, and nothing is listed. details.reason is
one of too_large, not_text, not_a_file, syntax, version, unknown_key, name, value,
too_many and cycle; details.line names the line (1 is the first) when the fault has one (keys
dotted past the reader's nesting depth are a syntax fault without one), and
details.key the key at fault as a dotted path. The faults are judged in file order after the
version, and the first one is the refusal, except a cycle, which is found once every key is
read: the checks that need one another in a circle, details.cycle naming them from the smallest
check on the circle round to itself (["a", "b", "a"]), details.key that check's needs, and
details.line its table. Troubleshooting
says what fixes each.
The directory form has two errors of its own. A .swarmops or a file in it that the host will not
let it read (a permission, say) is E_IO, exit 1, with details.path naming it below DIR and
details.vouched: true. A DIR that is not a directory is E_INVALID_ARG, exit 2, with
details.reason: dir and details.dir as given.
Through MCP#
The MCP tool is check_list, with an optional rev. It has the store form alone: the server
always serves the store it was started on, and a directory of the server's host is not something
an agent's request should name.
Return information#
result is a CheckListResp (swarmops schema CheckListResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
checks | array of CheckOut | yes | The checks, sorted by name, bytewise; empty when the tree describes none (or none of stage). |
file | string or null | no | The file the checks came from: .swarmops/checks.toml, or .swarmops/workspaces.json for the one check default. Omitted when the tree holds neither, or a workspaces.json with no check.argv. |
stage | CheckStage or null | no | The stage asked for: checks holds only the checks of it. Omitted when every check is listed. |
tree | string or null | no | The root tree the file was read from: 64 hex digits. Omitted for a directory. |
version | integer or null | no | The check file's version, 1. Omitted unless file is .swarmops/checks.toml. |
vouched | boolean | yes | Whether only the caller stands behind the file: true when it was read from a directory the caller named (check list --dir), which no gate accepts; false when it was read from the store, at tree. |
Envelope op: check_list.
Exit codes:
0: Success.1: The operation failed.
Errors#
- E_CHECK_FILE (exit 1): A check file does not read, or cannot work:
.swarmops/checks.toml(or, in a tree without one,.swarmops/workspaces.json) is too large, not text, not a file, not TOML (JSON), not version 1, holds a key, a name or a value version 1 does not take, has checks that need one another in a circle (details.cycle), or is one whose need a run cannot satisfy (details.check,details.need,details.stage):details.file,details.reason,details.vouched, anddetails.lineanddetails.keywhen known.
Any command that opens a store may also fail with a store error, such as E_NOT_A_REPO, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).