Expand description
Workload verification — run a workload and check its output against rules
embedded in the workload file. Shared by the nmbrs check subcommand and the
example-walker test, so “how CI checks the examples” and “how a user checks
their own workload” are the same code.
A verification target is resolved the same way nmbrs run resolves
workload=…: a directory (walk every workload under it), an existing
.yaml/.yml file (run it by path), or a bundled catalog name such as
examples/cursors/all_cursor/enumerate (run it by name, read its rules from the embedded
source). So whatever tab-completion offers for nmbrs check <TAB> — local
files and catalog names — checks the same way it runs.
Two equivalent rule surfaces (a file may use either, or both — their cases combine):
#@comment directives — trailing YAML comments, inert to the runtime:#@ run scenario=enumerate #@ expect 50 completed, 0 failed #@ case overload #@ run concurrency=32 rate=100000 #@ expect-fail error_rate_exceeded #@ requires backend (needs a live service) #@ session cwd (sessions under the sandbox cwd — stick_session) #@ again phases=probe (a second invocation, session state preserved)- A
verify:YAML block — also inert (the runtime ignores unknown top-level keys). Three equivalent shapes:# single case (a directive map) verify: { run: scenario=enumerate, expect: "50 completed, 0 failed" } # a list of cases verify: - { case: a, run: scenario=a, expect: "..." } - { case: b, expect-fail: "..." } # a name-keyed map (key = case name) verify: a: { run: scenario=a, expect: "..." } b: { expect: ["x", "y"] }
expect / expect-fail accept a single regex or a list of regexes. Each
must match the run’s combined stdout+stderr; expect-fail additionally
requires a non-zero exit.
Structs§
- Verify
Case - One verification case: an invocation plus the regexes its output must match.
- Verify
Plan - The parsed verification plan for one workload file.
- Verify
Summary - Aggregate verification result across one or more files.
- Workload
Timing - Wall-clock spent checking one workload, with its aggregate status.
Enums§
- Check
Progress - Live verification progress, emitted as workloads start and finish so a
caller (e.g.
nmbrs check) can render an active/pending/done/errors status line. Invoked from worker threads — handlers must beSync. - Check
Status - A single workload’s aggregate outcome, for live progress and the
timing report. Coarser than
Outcome(which is per case): a workload with any failing case isCheckStatus::Fail; one with no failures and at least one skip (and no pass) isCheckStatus::Skip; otherwiseCheckStatus::Pass. - Outcome
- What one verification case produced.
- Workload
Source - Where a verification target’s rule text and run reference come from. Mirrors
nmbrs run’sworkload=…resolution.
Constants§
- DEFAULT_
TIMEOUT_ SECS - Default per-case run timeout, in seconds.
Functions§
- check_
case_ output - Check one case’s RUN RESULT against its expectations — the run-mechanism-
agnostic half of
run_case.combinedis the merged stdout+stderr the run produced;succeededis its exit success;timed_outis the timeout signal. Used both by the subprocessrun_caseand bynmbrs’s in-processrun_executions-backed verification (so the SAMEexpect/expect-failrules apply whether examples run as subprocesses or as concurrent in-process executions sharing one session). - collect_
workload_ files - Every
*.yaml/*.ymlworkload file underdir(recursive), sorted. The discovery half ofverify_path, exposed so the in-process example walker (nmbrs_runtime::verify_in_process) finds the same files the subprocess walker does. - declared_
params - A workload reference’s declared top-level
params:(string scalars), following itsextends:chain — resolved the waynmbrs runresolvesworkload=…. ReturnsNoneif the reference resolves to nothing or has noparams:block. - no_
progress - No-op progress handler, for callers that only want the summary.
- requires_
verification_ rules - Whether a workload is REQUIRED to declare verification rules.
- resolve_
ref - Resolve a single workload reference the way
nmbrs rundoes: an existing.yaml/.ymlfile path first, then a bundled catalog name.Noneif it is neither. Directories are not a single workload — callers handle those separately (viaverify_path). - run_
case - Run one case via
<binary> run workload=… <args> --session-path …(under an in-process deadline) fromsandbox, capture combined output, and check the rules.workload_refis whatever goes afterworkload=— an absolute file path or a bundled catalog name; the subprocess resolves it exactly as a normalnmbrs runwould. - verify_
file - Verify one workload file: read it, then run it by its absolute path. The file is read relative to this process’s cwd, but the run reference is made absolute because each case is launched from a sandbox cwd.
- verify_
path - Verify a workload file or every
*.yamlunder a directory (recursively). Files run concurrently (cases within a file are sequential).progressis invoked from worker threads as each workload starts and finishes — passno_progressfor a quiet run. - verify_
source - Verify a workload from its rule text + run reference: parse the rules, run
every case, return one
(label, Outcome)per case (or a single Skip / Fail for the whole workload).run_refis what to pass asworkload=— an absolute file path or a catalog name. - verify_
target - Verify a target named the way
nmbrs runnames workloads: a directory (walk every workload under it), an existing workload file, or a bundled catalog name (examples/cursors/all_cursor/enumerate, …). This is thenmbrs checkentry point — so anything the binary canrunby name, it cancheckby the same name.
Type Aliases§
- Progress
Fn - A progress handler.
&-shared across verification worker threads.