nika test <file> runs the workflow
under the mock provider β offline, deterministic, zero keys, zero
tokens β and compares the typed outputs: against a golden file
(<file>.golden.json) committed next to it. Same idea as snapshot testing:
pin what the workflow produces, and any future edit that changes the
contract fails loud in CI.
Why the mock makes this possible
nika test swaps every infer: / agent: call to the mock provider,
whatever model: the file declares β your ollama/llama3.2:3b (or
mistral/β¦, or any cloud model) workflow tests offline, unchanged.
The mock is not a stub that returns "ok". It is schema-conformant:
when a task declares a schema:, the mock synthesizes an instance that
validates against it β required fields present, types respected. Every
schema workflow runs offline, end to end, through the same runtime,
bindings, and typed-outputs validation as a live run.
triage.nika.yaml
The golden lifecycle
First run β no golden exists yet, sonika test teaches instead of
guessing (exit 3):
--update, review it once, commit it:
triage.nika.yaml.golden.json
nika test compares. A match is exit 0; drift renders a
per-path diff and exits 1:
--update and commit the new golden β the diff shows up in code
review, exactly like a snapshot test.
Exit codes Β· the CI contract
nika test refuses to run a dirty file the same way nika run does: a
workflow with check findings exits 2 before anything executes.
Wire it into CI
Offline and deterministic means no keys in CI, no flakes, no spend:.github/workflows/nika-test.yml (fragment)
*.golden.json files in the same directory as the workflows
they guard. A PR that edits a workflow either keeps its golden green or
shows the re-pinned golden in the diff β both are reviewable.
Related
- Concepts Β· Workflows: typed
inputs:in, typedoutputs:out β the callable contract the golden pins. - Reference Β· CLI: every
nika testflag. - Guides Β· Troubleshooting: when
nika checkfindings block a test (exit 2).