Component test reference

Results

Verdicts, result hierarchy, and reading failures

Verifier writes test results to results.json after every run. This page covers the verdict hierarchy, how to read a failure, the results.json format, and the other three artifact files written alongside it.

Did It Pass?

The fastest answer is verifier results passed. It exits 0 when every protocol in every iteration passed, 1 otherwise, and prints nothing.

verifier results passed

To narrow the gate to one protocol:

verifier results passed --protocol example.sensor.sampleFlow

Without a subcommand, verifier results prints the summary verdict for each protocol in every iteration:

verifier results

To dig into one protocol’s traces across all iterations:

verifier results prot sampleFlow

The interactive browser is verifier results tui. See verifier docs open commands/results for the full CLI and TUI reference.

The Three Verdicts

Every trace, attempt, and protocol ends with one of three verdicts.

  • valid — the trace reached a declared end state with every constraint satisfied. A protocol passes an iteration when at least one attempt is valid.
  • invalid — the trace cannot progress. A constraint on a message your component sent was not satisfied, a message arrived out of order, or an expected message never arrived. Inspect reason and failed_constraints on the invalid trace to see which condition triggered it.
  • inconclusive — the trace stayed in a legal state but never reached an end condition. Verifier saw nothing wrong, but the protocol was not completed. Timeouts and early component exits leave traces inconclusive.

A protocol whose attempts are all inconclusive is not valid. verifier results passed returns 1 for an inconclusive protocol.

Result Hierarchy

Results are nested: iterations at the top, then protocols, then attempts, then traces. Every level maps to a field in the JSON file.

{
  "iterations": [
    {
      "iteration": 0,
      "protocols": {
        "example.sensor.sampleFlow": {
          "name": "example.sensor.sampleFlow",
          "valid": true,
          "attempts": [
            {
              "name": "example.sensor.sampleFlow",
              "attempted_protocol": "example.sensor.sampleFlow",
              "attempt": 0,
              "valid": true,
              "valid_traces": [ ... ],
              "inconclusive_traces": [],
              "invalid_traces": []
            }
          ]
        }
      }
    }
  ]
}
  • iterations — one entry per iteration; the iteration field is the 0-based index.
  • protocols — a map from fully-qualified protocol name to the protocol’s results for that iteration. valid is true when any attempt passed.
  • attempts — one entry for each time Verifier evaluated this protocol in the iteration. The attempt field is the 0-based attempt number. A protocol’s bucket may hold more entries than the attempts targeted at it; see Accidental Qualification below.
  • valid_traces, inconclusive_traces, invalid_traces — the trace buckets for one attempt entry. Each holds a list of trace objects. Most protocols produce one trace per bucket; branching protocols produce more.

Reading a Failure

When a protocol is invalid, start with invalid_reason on the attempt entry. This field names a failure that came from outside the protocol state machine, such as a component that did not start or an unexpected termination type. If it is empty, the failure is at the trace level.

Each trace in invalid_traces carries:

  • reason — a sentence describing why the trace stopped, when the failure has a cause that is not a constraint violation.
  • failed_constraints — a list of constraint expressions that did not hold. Each entry has expr (the constraint text from the model) and location (the source element, line, and column). When location is all zeroes, the source map could not place the expression.
  • events — the ordered list of events before the trace stopped. Message events carry direction (In or Out), messageName, and a message object with the field values. Non-message events (ProgramStart, ProgramExit, Timeout, Trigger) carry only kind and time.

verifier results prot <name> prints a text summary of each trace and its failed constraints. verifier results tui shows the full event timeline alongside the result tree.

Accidental Qualification

Verifier advances all protocols on every event, even when testing only one. When messages exchanged for protocol A happen to satisfy protocol B’s sequence, B reaches a verdict too. The result is stored in B’s bucket under A’s attempt. This is accidental qualification.

For example: your model has protocols reqRes and heartbeat. While Verifier tests reqRes, the messages exchanged satisfy heartbeat’s sequence. The heartbeat bucket now holds an entry like this:

{
  "name": "example.sensor.heartbeat",
  "attempted_protocol": "example.sensor.reqRes",
  "attempt": 0,
  "valid": true
}

The two fields that distinguish entries in a bucket are:

  • name — always equal to the bucket key; the protocol this entry describes.
  • attempted_protocol — the protocol Verifier was intending to test when this entry was recorded.

When attempted_protocol == name, the entry is the intended result for this protocol. When they differ, the protocol reached a verdict incidentally. attempted_protocol may be empty in files written before the field existed; treat an empty value as unknown rather than assuming it is intended.

The CLI and TUI show only intended entries by default, so accidental ones do not inflate displayed attempt counts. The raw JSON contains all entries.

results.json Field Reference

The top-level key is iterations, an array of iteration objects. The old key runs is accepted on read; a file with neither is rejected.

Each iteration object:

  • iteration — 0-based integer index. The old key run is accepted on read.
  • protocols — object keyed by fully-qualified protocol name.

Each protocol object:

  • name — same as the key; fully-qualified protocol name.
  • valid — true when at least one attempt is valid.
  • attempts — array of attempt entries.

Each attempt entry:

  • name — always equal to its bucket key; redundant, not distinguishing.
  • attempted_protocol — protocol under test when recorded. Optional (may be absent or empty for files written before this field existed).
  • attempt — 0-based attempt number.
  • valid — true when valid_traces is non-empty.
  • valid_traces, inconclusive_traces, invalid_traces — arrays of trace objects.
  • invalid_reason — non-constraint failure description. Optional (omitted when empty).

Each trace object:

  • id — integer; the last protocol state-machine node reached.
  • events — array of event objects, in order.
  • end — string naming the end condition, or null when none was reached.
  • reason — failure description. Optional (omitted when empty).
  • failed_constraints — array of failed constraint entries. Optional (omitted when empty).

Each event object:

  • kind — “Message”, “ProgramStart”, “ProgramExit”, “Timeout”, or “Trigger”.
  • time — elapsed time from the trace’s first event, e.g. “11ms”.
  • direction — “In” or “Out” (Message events only).
  • messageName — the message type name (Message events only).
  • message — field values as a JSON object (Message events only).

Each failed constraint entry:

  • expr — the constraint expression text from the model.
  • location — object with the Flex source coordinates: pkg (package name), name (element name), line, and col. line and col are zero when the source map could not place the expression.

Parser invariants:

  • attempts[].name always equals its bucket key. Use attempted_protocol to distinguish intended from incidental entries.
  • A bucket holds at most one intended entry per attempt number, but several entries can share one attempt number: an attempt targeting one protocol also records what other protocols did. Deduplicate by attempt number when counting attempts.
  • valid on an attempt entry is derived from the trace buckets on read, not taken from the file; check the bucket arrays directly.
  • valid on a protocol object is read as stored, so it always agrees with the verdict the run printed. Do not recompute it.

The Other Artifact Files

Each run writes four files to a timestamped directory under .verifier/:

results.json — the full verdict tree described on this page. Use it to check verdicts, read failed constraints, and step through the event sequence on a trace.

log.json — structured log records for the run, one JSON object per record, each carrying a level, timestamp, scope, and message. Every record at the configured log level lands here whether or not it appeared in the terminal, so the file is complete even when the interactive display was running. Open this when you want to trace Verifier’s activity at a specific moment, or when a run failed before any results were written.

stream.json — per-attempt results written as NDJSON as the test runs. Each line is one JSON object written the moment an attempt completes, with three keys: iteration (the iteration number, or null before the first iteration is set), component (the component name), and results (the attempt: attempt, attempted_protocol, protocols, and the longest events list from any of its traces). Open this to see partial results from an interrupted run, or to process results in a streaming pipeline as they arrive.

trace.json — event-level protocol state-machine detail for every attempt. For each event, it records a state snapshot for every protocol still in play: the active frames, the variables bound in each frame, the statements executed, and, where a trace went invalid, the constraint expression that failed. Open this for deep debugging when the event sequence in results.json does not show enough of what the state machine was doing.

Commands that read artifact files find the newest directory automatically. Pass --results or --logs with a path to read a specific file.