SwarmOps
ReferenceCommandsswarmops check lint

Page kind: Reference

swarmops check lint#

Describes stable at 6ff44119, ; latest release v0.13.0what changedLast changed View as Markdown

Report what a tree's check file names that cannot work, without running anything.

Reads .swarmops/checks.toml at REV (default main) as check list reads it, or the files below DIR with --dir, and looks at what each check names: a need that is no check of the file, or is not of every stage the check is of (check run would refuse it); an input pattern that matches no path of the tree (a pattern that names a directory matches nothing); a dir that is no directory of the tree. No fault is exit 0. A fault is E_CHECK_FILE with details.reason lint, the first fault's line and key, and every fault, ordered by check, kind and value, in details.lint (at most 1,000, the rest counted); the message counts them and names the first three. A file that does not read, or whose checks need one another in a circle, is refused as check list refuses it. --dir reads the host's files, follows no link and says vouched. Reads only: no identity, no lock, nothing is run.

Metadata
Group
checks
Since
0.14.0
Mutates
no
Identity required
no
MCP tool
check_lint
Envelope op
check_lint
Exit codes
01

Syntax#

Syntax
swarmops check lint [OPTIONS] [REV]

Required arguments#

None.

Optional arguments#

The command also takes the global options.

Syntax: <REV>.

The changeset whose tree's checks to lint.

Syntax: --dir <DIR>.

Read the check file and the tree below DIR on this host, not from the store.

Examples#

Shell
swarmops --repo [tmp]/store check lint
Output
{ "ok": true, "op": "check_lint", "api": 1, "result": { "vouched": false, "tree": "[tree_c1]", "file": ".swarmops/checks.toml",
Show 14 more lines "version": 1, "checks": 4, "faults": [] }, "meta": { "repo": "[tmp]/store", "elapsed_ms": "[elapsed_ms]", "resolved": { "[c1]": "[c1]", "main": "[c1]" }, "auth": "trust" } }

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 lint says what a tree's check file names that cannot work. It reads the file as check list reads it, then looks at what each check names, and runs nothing: it takes no identity and no lock, and writes nothing. It is the check a gate can make of its own check file with no parsing: no fault is exit 0, any fault is exit 1.

Two forms#

  • From the store, check lint [REV]: the tree of REV (default main), resolved once and recorded in meta.resolved; the answer names that tree and says vouched: false.
  • From a directory, check lint --dir DIR: the check file and the files below DIR on this host. It opens no store, so --repo, SWARMOPS_REPO and --as are not used, and the envelope has no meta.repo. The answer says vouched: true; no entry of the directory is followed if it is a symbolic link, and .git and .swarmws are no part of the tree. REV and --dir together are a usage error.

What it looks at#

KindA fault whenkeyvalue
need_undefinedA need names no check of the file.check.<name>.needsThe need.
need_off_stageA need is a check of the file, but not of every stage the check that names it is of: check run of one of those stages refuses the run.check.<name>.needsThe need.
input_matches_nothingAn input pattern matches no entry of the tree. A pattern that names a directory exactly matches nothing, and a link is matched by its own path.check.<name>.inputsThe pattern.
dir_missingA check's dir is no directory of the tree (a link is none). The root, ., always is.check.<name>.dirThe directory.

Each fault carries the check it is of and the line its table starts on. The faults come ordered by check name, then by kind in the order of the table, then by value, at most 1,000 of them: the rest are counted in faults_omitted. A file that does not read is refused as check list refuses it (E_CHECK_FILE, with the reason it gives), and so are checks that need one another in a circle (cycle); neither is a fault of the kinds above.

The answer#

No fault: the result holds vouched, the tree (the store form), the file and version read, how many checks it looked at and an empty faults; exit 0. A tree with no check file has no check and no fault.

Any fault: E_CHECK_FILE, exit 1, not retryable, details.reason lint. details.file and details.vouched say what was read, details.line and details.key are the first fault's, and details.lint is the whole result, the one the clean answer would have been, with its faults. The message counts the faults and names the first three, so --human prints what to fix; the hint says where the rest are.

In the gate#

just check runs check lint --dir . with the build under test, after check list --dir ., so that a need or a pattern that names nothing fails the gate with its line in the log. The CI job that runs check run uses a pinned released build, which reads the file without the keys that build does not know, so this repository's file declares none of inputs or needs until that build holds them.

Return information#

result is a CheckLintResp (swarmops schema CheckLintResp prints its JSON Schema).

FieldTypeRequiredDescription
checksintegeryesHow many checks the file defines.
faultsarray of CheckLintFaultOutyesWhat cannot work, at most 1,000 of them: ordered by check name, then by kind (need_undefined, need_off_stage, input_matches_nothing, dir_missing), then by value.
faults_omittedintegernoThe faults past the 1,000 returned, counted. Omitted when 0.
filestring or nullnoThe file the checks came from, as check list names it. Omitted when the tree holds no check.
treestring or nullnoThe root tree the file was read from: 64 hex digits. Omitted for a directory.
versioninteger or nullnoThe check file's version, 1. Omitted unless file is .swarmops/checks.toml.
vouchedbooleanyesWhether only the caller stands behind the file: true when it was read from a directory the caller named (check lint --dir); false when it was read from the store, at tree.

Envelope op: check_lint.

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, and details.line and details.key when 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).

See also#

On this page