Expand description
The bounded loop that repeats a pass after corrections changed candidate content. What: The bounded loop that repeats a whole policy pass after corrections changed the candidate content, until the content is stable or the loop gives up. Why: A correction by one policy can create a finding for another, so every changed state restarts the complete order. The loop must end: at most eight passes may change the content, and returning to an earlier state is a cycle. This module owns only that control flow; running policies, applying corrections and storing exact states stay behind a small interface, so the loop is testable without Git.
In TS you’d write (pseudocode):
// const convergence = await convergeCommitPolicies({ firstPass, firstSnapshot, ... });Enums§
- Convergence
- What:
How the loop ended.
Settledcarries the number of passes that changed content. Why: The caller reports the stable pass, or one engine failure for each other ending. - Pass
Result - What:
What one whole policy pass over the current state ended in.
An
enumis a closed set of named alternatives.#[derive(...)]asks the compiler to generate copying, debug printing and==. Why: Only a pass that proposes corrections continues the loop.
Constants§
- FIX_
CYCLE_ MESSAGE - The engine-failure message of corrections that returned to an earlier state.
- FIX_
PASS_ LIMIT_ MESSAGE - The engine-failure message of a pass that still proposes corrections after the limit.
- MAXIMUM_
CHANGED_ PASSES - What:
The most passes that may change candidate content.
usizeis the unsigned integer of list positions and counts (siblingsu32,u64). Why: The incumbent stops after eight changed passes;usizeis the type the snapshot numbers below are counted in.
Traits§
- FixPasses
- What:
The work the loop drives.
A
traitis a named set of methods a type promises to provide, like a TSinterface;&mut selflends the implementer for writing. Why: Exact candidate states can be large, so the implementer stores them (the incumbent used private files) and answers equality by snapshot number; the loop never holds content. Gotcha: Snapshot 0 is the state before the first pass and must exist before the loop starts.
Functions§
- converge
- What:
Drive passes until the state is stable or the loop must give up.
Why:
The bound is structural:
the
forloop runs at most eight times, each round ending or storing exactly one new state, and one last pass may only confirm stability.