awa run validation policies — result-only replay
On this page
[[run.validation]]
name = "cargo-test" # a label for output; renaming it keeps cached results
argv = ["cargo", "test"] # the complete command, element for element
cwd = "." # the exact execution directory
unobserved_dirs = ["target"] # exact directories below the project root
Some checks write a huge or constantly changing build directory: cargo test
fills target/. awa watches that directory as generated state, so a run either
cannot observe it (effect-state-unavailable) or sees it change
(effect-state-differs), and never becomes reusable. A validation policy lets
one exact invocation replay its recorded result anyway.
What a policy asserts
Declaring one states two independent things about each unobserved directory:
- its prior contents cannot change the command's result — exit code and output;
- the files the command writes there are not needed after a replay.
awa checks neither. If a test reads a file generated earlier, the first is false; if a later step uses the build, the second is. Declare a policy only when both hold.
Exact selection
- A policy applies only when the complete child argv equals
argvelement for element and the execution directory equalscwd, both relative to the project root. Without--cwdthat is the directory you invoked awa from, socwd = "."matches only a run started at the root. Nothing is joined, prefixed, globbed, or aliased:cargo test --releaseandcargo tstay ordinary runs. Two policies selecting one invocation are a configuration error. - Each
unobserved_dirsentry is an exact path below the project root, never a name matched at any depth and never a pattern:targetis the root'starget/, notcrates/x/target/, and*is a literal character. The root itself, an absolute or..path, and.git/.awaare refused. - Only a real directory at that path is waived, also when the path passes through a symlink awa already follows; a file or symlink at the path itself is observed as usual, and the same directory under another name is not waived.
- There is no flag:
awa runandawa run explainselect the policy themselves.awa config effectivelists the policies in effect and the layer each came from.
Conflicting scope
A --scope or --include operand naming a waived directory, or a path inside
one, asks awa to observe what the policy says not to: the run is refused with exit
2 before anything is scanned or executed. The same conflict from
run.default_scope is a configuration error, exit 4. A broader scope is fine —
., or artifacts with artifacts/cache waived — the policy removes the waived
subtree from it.
What changes for the matched run
- The waived directories are not traversed for input identity or for effect observation, before or after the command. Their size, unreadable files, changes, and deletion do not block reuse.
- Everything else still applies: the other inputs and watched roots, the mutation
guard, stdin/TTY, trust mode, skipped inputs,
--record,--no-cache, and failed-run caching. - The policy is part of the cache key: changing its argv, cwd, or directories
misses. Renaming it does not. Editing
awa.tomlstill misses once, because the file is itself a run input. - Each stored run keeps the policy it ran under. Changing the config later never gives an older run a waiver it did not have.
What a hit means
replay: result only (policy cargo-test); not observed or recreated: target
The stored exit code, stdout, and stderr are replayed; nothing is written to the
waived directories, so a deleted target/ stays deleted. A hit is not evidence
that build artifacts exist or are current, nor that a fresh build would print the
same log or take the same time. Run the build itself before a step that needs
its artifacts.
Evidence limits
A waived directory is unobserved — never reported as unchanged or empty.
awa changes and awa diff between run states say nothing about it, and
awa restore from a run state deletes nothing below it: the deletion is withheld
as ignored-boundary, or first as policy-incompatible when the run's scan
policy differs from the current one.
Checkpoints and their history scope are unaffected.
Files outside the project are outside the evidence too. A policy alone does not
make a toolchain change invalidate a stored result; only facts awa keys do, such
as names in [run].env_allowlist or the identity probes below.
Identity probes
[[run.validation.identity_probes]] # in awa.toml, inside the policy above
name = "rustc" # a label for output only
argv = ["rustc", "-vV"] # a literal command, never a shell line
awa config probes allow # approve this project's probes
awa config probes revoke # withdraw that approval
A probe is a command whose exact stdout becomes part of the policy's cache key, so a different report means a miss. Up to 8 probes per policy.
- Permission. Probes are code from the project config, so no config file
can let them run.
awa config probes allowshows each policy's argv, cwd and probe argv and approves exactly those for this project, running none of them;revokewithdraws it. Each allow replaces the approval with exactly the probes the current config declares; it does not remember others, so a policy absent then (on another branch, say) needs allow again when it returns. The grant is per-user state outside the project (in the OS user config directory, underawa/probe-grants), keyed by the project's canonical path: a symlink to the same directory shares it, a moved or copied project, another worktree or a project in another place needs its own. A new or changed probe, policy argv or cwd is denied until approved again; renaming a probe or policy is not. Approval is for these commands at this path, not for what their executables do: a project replaced at the same path keeps it, and a changed script or tool behind the same argv is not detected. It is not a sandbox: a probe can do anything a command can. A missing, unreadable or damaged grant, or one stored inside the project, authorizes nothing.awa config effectiveshows the grant apart from the config layers. - When. Only
awa run, never explain,run ls, show, status, doctor, or config. A run that could be reused runs the probes before it looks up a result, also when that becomes a hit, and again after the command before it stores a reusable result.--record,--no-cache, disabled capture, unkeyed stdin, and fast trust mode skip them. Each runs in the command's cwd with the command's sanitized environment and null stdin. The grant is checked again before each phase, so a revoke stops the next phase, not a probe already running. - Bounds. Each probe gets 10 s, 64 KiB of stdout, and 64 KiB of stderr; one phase of probes gets 30 s. Exceeding a bound ends that probe.
- Unavailable. A probe that is not approved, is not found, fails to start,
exits non-zero or by a signal, times out, prints nothing, or overflows a bound
makes the facts unavailable. The command still runs with its own exit code and
output; only reuse is lost. Before the run that is
external-facts-unavailable; after it,external-facts-unavailable-post-run. Different bytes after the run areexternal-facts-changed. Without the grant, explain,run ls, and status report that same blocker with every probedenied, and run none. With the grant they run none either, so a run that needs current probe reports isincompletein explain and listed underunassessedbyrun lsand status, never a hit or a miss;awa runacquires them. - Privacy. Probe output is never stored or shown, also on failure. Runs keep each probe's status and a fingerprint of its stdout. A fingerprint is not encryption: a short guessable report can be guessed.
Matching reports prove only that the probes printed the same bytes at those two
moments. They do not identify libraries, compiler components, build-script
discoveries, or services the probes do not report. awa does not check that a
probe describes the tool the command uses: for cargo +nightly test, plain
rustc -vV can report a different toolchain, so name the same selection in the
probe argv.
Inspect
awa run explain -- cargo test # replay: on a hit, else policy:; JSON current.validation
awa run show --last --meta # the policy and facts that run recorded
awa run --json reports inputs.validation; run show, run ls, run log, and
explain candidates report the policy each stored run recorded. With identity
probes, identity_probes lists each probe's before and after status and
fingerprint.