# Runs and records

# Runs and records

A run is one sequence started on the deployed system for one unit. It keeps a
record no one edits: what ran, wired how, every step, check and answer, and how
it ended.

## Start a run

On the **Dashboard**, a sequence's launcher says what it needs ("Asks for
serial number to start") and **Start** opens the start form: the unit's
identity, each setting (with its default) and each run field. **Start next
unit** begins the next one with the same form.

A start is refused, and nothing moves, when a required value is missing, a
setting is outside its bounds, or the system is shut down, stopped or starting.

From a terminal:

```bash
phloem trellis start proof --identity SN-0142 --setting "target pressure=32" --field batch=B7
phloem trellis start proof --identity "serial number=SN-0142" --identity board_rev=C
phloem trellis start leak_jig --slot A=SN-0142 --slot B=SN-0143   # a fixture; slot C left empty
phloem trellis answer --yes                 # confirm (signs one that asks for a signature)
phloem trellis answer --reading 24.1        # a reading, in the question's unit
phloem trellis answer --reading 3.1 --reading 3.0 --reading 3.2   # a question that asks for 3
phloem trellis answer --text "B7"           # a text answer
phloem trellis answer --date 2027-03-01     # a date
phloem trellis answer --choice "Grade A"    # one of the question's options
phloem trellis answer --could-not "probe broken"   # where the question allows it
phloem trellis answer --passed              # an inspection
phloem trellis answer --failed --reason porosity --note "left side"
phloem trellis answer --continue            # resume a pause
phloem trellis skip "leak check"
phloem trellis abort --reason "wrong fixture"
```

| Flag | Answers |
|---|---|
| `--yes` / `--no` | a confirm, or a yes-or-no question |
| `--reading N` | a number, in the question's unit; repeat it for a question that asks for several |
| `--text`, `--date`, `--choice` | a text, a date (`YYYY-MM-DD`) or one of the listed options |
| `--could-not WHY` | a question that accepts "could not", with why |
| `--passed` / `--failed` | an inspection; `--reason` names one of its fail reasons |
| `--continue` | a pause |

A flag the waiting question does not take is refused, naming the one it does.
One `--identity` value is the identity's first part; an identity in several
parts takes each as `LABEL=VALUE` (a part that is a run field comes from its
`--field`). A fixture start names each unit with `--slot`. A gate that asks for
photos, or an inspection answered view by view, is answered in Computer.

## While it runs

The run shows its step ("Step 2 of 3 · inspect"), the gate it waits on, and
each check as it is judged. **Abort** ends it as aborted, after its `at_end`
lines run. A shutdown or **Stop** ends it too.

## Outcomes

| Outcome | Means |
|---|---|
| **passed** | every check passed |
| **failed** | a check or an inspection failed, a wait, question or script timed out, or a check with `on_fail="stop"` failed |
| **incomplete** | nothing failed, but something was not measured — a silent input, an event that never came, a person's **Couldn't measure**. The setup could not see the unit: run it again |
| **passed, pending** | every check passed but one written `if_fails="pending"` — the unit works, but a setting it had to keep did not stick. Cleared by a person with a reason, then it reads passed |
| **aborted** | a person aborted it, an `abort(...)` line ran, a confirmation was declined, a decision could not be made, a script could not start, a drive lost its input, or the system shut down |
| **completed** | the sequence judges nothing (no check, or only `record`); it ran to its end |
| **interrupted** | the device restarted mid-run, so how it would have ended is not known |

A run that failed only on an inspection says so ("weld failed inspection").

## The record

| Part | Holds |
|---|---|
| what ran | the sequence, the system, and the deployment: program and wiring, by hash |
| started with | the unit's identity, settings, run fields, and where the start came from |
| steps | each step's start and end; a skip with who skipped it and the note |
| checks | each check's value, unit, limit, margin, sample count and verdict; each `record`'s value |
| ramps and scripts | each ramp's ends and whether it got there; each script's arguments, contents by hash, exit code and output |
| sources | each value the system or sequence `cite`s, with its source and revision |
| answers | each gate's answer, where it came from, when, its photos, note and failure reasons; signatures marked as signed |
| project | the project active on the device, its version, and whether it had unsaved edits |

**Runs** in the system lists every run, searchable by serial, sequence or
outcome; **Open in replay** opens the run's window with its data. Runs sync to
the cloud and appear on the console's **Runs** page. Each run is a row of the
lake's `runs` table (`kind = 'sequence'`) — see
[Charts and dashboards](https://phloem.ai/docs/review/charts/).

A Trellis run is evidence: it can be released from the device, never deleted.

- [Runs](https://phloem.ai/docs/review/runs/): Find, download or release a run
- [Charts and dashboards](https://phloem.ai/docs/review/charts/): Yield and failures across runs, as SQL
