Pcornel
Automation · Validation

Preconditions

Cheat sheet · https://pcornel.dk/topic.php?topic=5919

Back to the Topic

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

BoundaryHealthy evidenceSuspicious evidence
Criteria / inputCriteria, source revision, validator and exact target identity are explicitA generic pass exists without versioned criteria or target correlation
Preconditions / operationCurrent authoritative facts are bound to the exact operationStale preflight or requested state substitutes for execution-time facts
Effective outcomeAuthoritative state/read-back and service-relevant evidence match the expected resultTool/test/validator success substitutes for effective target or workload proof
Limits / next actionCoverage limits, unknowns and failures drive the next narrower checkUnknown 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

Confirmation

Confirm action

Continue?