Skip to main content

Module before_state

Module before_state 

Source
Expand description

The before-state a setup step saves ahead of a change it cannot undo.

A step that removes or replaces forge state reads what it is about to change, through the same read-only calls the observers make, and writes it to the run’s snapshot directory before its script runs: the repository settings behind the default branch and the merge settings, the rulesets, each ruleset a step replaces read in full, and the classic protections, and every branch single-trunk deletes, by name and commit, with a bundle where this clone holds the commit. A read that fails refuses the step, because a change nobody can restore is not one this setup makes. A saved state is a backup: no later run reads it to decide anything.

SATISFIES forge-setup:a-step-is-idempotent

Constants§

DESTRUCTIVE
Every step that removes or replaces forge state.

Functions§

destructive
Whether step removes or replaces forge state.
reads
The read-only calls that capture what step changes.
save
Read and save the before-state of step into snapshot, returning where it went.