Skip to content

canair validate

Alias: val

usage: canair validate [-h] [--stats] [--strict] [--max-untimed N]
                       [--show-untimed]
                       [{pids,captures,ecus,states,can-buses,signals,groups,can,all}]
                       [files ...]

[UDS+CAN] Validate a profile's data files against their schemas and
report problems.

Pick a target (default: all):
  pids      the per-ECU ecus/ files (identity/scan_log/dtcs/pids/...)
  captures  the captures/ payload files (+ soft warnings, see below)
  ecus      alias for pids
  states    vehicle_states.yaml (vehicle power-state vocabulary + predicates)
  can-buses can_buses.yaml (per-profile CAN bus segment vocabulary)
  signals   signals/ broadcast signal-definition files (domain B)
  groups    groups.yaml (named capture/monitor selector groups)
  can       captures/can/index.yaml (raw-CAN log index)
  all       everything above

`validate captures` also emits soft warnings for out-of-vocabulary vehicle
states, SID/PID/DID echo mismatches (misfiled frames), non-hex payloads
(e.g. a stored 'NO DATA'), and untimed payload captures. Pass --strict to
promote the untimed-payload warning to an error — the CI / new-data gate.

`validate states` resolves every `when:` predicate's ECU.PARAM references
against the ecus/ registry: a predicate naming a signal that does not exist
can never match, and the evaluator cannot report it (a missing signal is
indistinguishable from a not-polled one), so this is the only place a
renamed or typo'd signal name in a predicate is caught.

Run this after editing ecus/ or adding captures; `canair pids` already
validates each edit, so this is the whole-profile check.

positional arguments:
  {pids,captures,ecus,states,can-buses,signals,groups,can,all}
                        What to validate (default: all)
  files                 Specific ecus/ files (only with target=pids/ecus)

options:
  -h, --help            show this help message and exit
  --stats               Show parameter statistics (pids)
  --strict              Treat soft warnings that gate new data (currently:
                        untimed payload captures) as errors — for CI / new-
                        capture checks
  --max-untimed N       Fail (exit 1) if the profile has MORE than N untimed
                        payload captures — a ratchet baseline for CI. Writes
                        are enforced to carry a timestamp, so the count only
                        ever falls; lower N as it drops. Distinct from
                        --strict (which forbids any untimed row)
  --show-untimed        List untimed payload captures per file instead of
                        collapsing them to a single count — they otherwise
                        drown the echo/quality warnings that need attention
                        (the count is always reported in the footer)

examples:
  canair validate                     # validate everything (pids + captures + states)
  canair validate --stats             # + a count summary (ECUs/PIDs/params/verified)
  canair validate pids                # just the ecus/ definition files
  canair validate captures            # just captures/ (with soft warnings)
  canair validate captures --strict   # treat untimed-payload warnings as errors (CI)
  canair validate states              # just vehicle_states.yaml
  canair validate pids ecus/bms.yaml  # a specific ECU file only