Pcornel
Automation · Validation

Syntax Validation

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

Back to the Topic

Answer

Syntax Validation proves that an automation artifact conforms to the grammar and parser rules expected by the exact interpreter, tool or format version.

Remember

  • Parseable ≠ deployable or semantically correct.
  • Syntax accepted by one version ≠ accepted by another version.
  • Formatter success ≠ parser success.
  • No syntax error ≠ referenced names, resources or values exist.

First checks

  • yamllint . && ansible-playbook site.yml --syntax-check — YAML/Ansible
  • terraform validate — HCL
  • shellcheck *.sh — shell

Commands

bash -n <script.sh>
Read-only/validation observation for Bash parser/syntax result without executing the script body.

Verify in this order

code → linters/syntax checks → pass/fail

Where it usually breaks

Syntax Validation proves grammar acceptance by a named parser version; it does not prove schema conformity, semantic correctness, dependency resolution or successful execution.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Syntax Validation 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=5915

Confirmation

Confirm action

Continue?