Preconditions
Cheat sheet · https://pcornel.dk/topic.php?topic=5919
Answer
Preconditions are explicit facts that must be true at the decision point for an automation step to be valid, safe and deterministic.
Remember
- Precondition true once ≠ true at mutation time.
- Object exists ≠ object is the intended version or state.
- Lock checked free ≠ lock acquired.
- Dependency healthy ≠ dependency state cannot change during the step.
First checks
- Precondition assertions in code (assert/that) — guards
- Required state documented — contract
- Skip/abort behaviour — safety
Commands
test -r <required-file> && test -n "$<REQUIRED_VAR>"- Read-only/validation observation for readability of one required file and presence of one required non-secret environme…
Verify in this order
preconditions → assert → continue
Where it usually breaks
Preconditions prove eligibility only at the observed decision boundary; they do not prove postconditions or eliminate races unless execution is guarded atomically.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Preconditions validation proof-boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Criteria / input | Criteria, source revision, validator and exact target identity are explicit | A generic pass exists without versioned criteria or target correlation |
| Preconditions / operation | Current authoritative facts are bound to the exact operation | Stale preflight or requested state substitutes for execution-time facts |
| Effective outcome | Authoritative state/read-back and service-relevant evidence match the expected result | Tool/test/validator success substitutes for effective target or workload proof |
| Limits / next action | Coverage limits, unknowns and failures drive the next narrower check | Unknown evidence becomes pass, retries hide failures or broad success is inferred from one check |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5919