# `mix surfex.status`
[🔗](https://github.com/dcoai/surfex/blob/v0.13.0/lib/mix/tasks/surfex.status.ex#L1)

Scans the spec and the code, reads the relation log, and reports the state of every
relation (`Surfex.Status`).

    mix surfex.status                  # text; fails if anything needs attention
    mix surfex.status --format json    # the work list for tools and agents
    mix surfex.status --verify         # also verify the log (edits, removals, truncation)
    mix surfex.status --no-planned     # also fail on planned relations: everything built
    mix surfex.status --evidence       # also check confirmations by evidence against the last run
    mix surfex.status --merge A --merge B   # check them against several CI jobs' evidence together
    mix surfex.status --validated      # also fail on relations nothing has validated (§18)
    mix surfex.status --no-deviations  # also fail on declared deviations: a release's check
    mix surfex.status --issues         # also ask the tracker whether each deferral's issue is open
    mix surfex.status --spec           # the spec side alone: a repository that holds only a spec

It fails on any dangling, orphaned or conflicted relation, on any id the `require:`
policy in `.surfex.exs` says must be related and isn't, and, with `--verify`, on any
problem with the log. With `--no-planned` it fails on any planned relation as well, for
a check that everything planned has been built (a release, say). A unit a test declares
the code deviates from (`@tag deviation: "#119"`) is listed, and its proposed relations
don't fail; with `--no-deviations` any deviation fails, and a deviation test that passed
in the evidence always does (`Surfex.Status`). With `--evidence` it
fails when a relation confirmed by evidence isn't borne out by the evidence the last
`mix test` recorded: its test didn't run, failed, or ran against other code. It also
fails on any `verifies` or `tests` relation whose test failed, whatever validated it: a
review relies on the run to say whether its test passes. With
`--merge PATH` (once per file, implying `--evidence`) it checks the claims against several
CI jobs' evidence files together: a disproof in any fails, and so does a claim no job
ran. It only
reads: nothing is recorded, so CI can run it after `mix test`. With `--issues` it runs
the command `issues:` in `.surfex.exs` declares once per issue the spec's deferrals
name (`Surfex.Issues`), so a deferral whose issue is closed,
or that the tracker can't answer, fails; a command that exits non-zero stops the task
with its output. The states are never stored (§13.7). A project scanner is
project code, so the task compiles first when `.surfex.exs` names one.

With `--spec` it reads the spec side alone (§13.16), for a repository that holds a spec
another implements: `.surfex.exs` is read and validated as always, then only the spec is
scanned. Code, tests, checks, relations, the log, evidence, `require:` and completeness
are not read, and the report opens saying so (the JSON carries `mode: "spec"`). It fails
on scan errors and on each citation of an arity the spec's own contracts don't state;
restated contracts and the other spec-shape warnings are listed. The flags that read
what `--spec` skips are refused with it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
