\Drupal\strata\Health RepairLadder

The escalation ladder, and the rule about which rungs a machine is allowed to take.

Rungs run lowest-first, cheapest and most reversible first. A repair only ever moves one rung at a time, in either direction, so a code that keeps failing climbs at a rate an operator can watch and a code that goes quiet walks back down on its own.

The line that matters sits between rebuild and quarantine. Everything at or below rebuild reconstructs derived state from data that still exists, so the worst case of running it wrongly is wasted work. Quarantine removes a restore target and refuse blocks a restore outright; both take away the thing a backup exists to provide, which is a decision a human makes, not cron.

Summary

Methods
Properties
Constants
initialRung
escalate
decay
isAutomatic
rank
No public properties found
RUNGS
AUTOMATIC_CEILING
UNRANKED
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Constant

RUNGS

RUNGS = ['observe', 'reindex', 'refetch', 'rebuild', 'quarantine', 'refuse']

The rungs, lowest first.

AUTOMATIC_CEILING

AUTOMATIC_CEILING = 'rebuild'

Highest rung an unattended run may take by itself.

UNRANKED

UNRANKED = -1

Rank returned for a rung that is not on the ladder.

Methods

initialRung()

initialRung(int  $severity) : string

Where a finding of this severity starts.

Read with >= rather than ==, so an ordinal above CRITICAL - a caller inventing its own scale, or a value read back from a newer schema - lands on quarantine instead of falling through to observe. Being wrong upward costs a paused code; being wrong downward costs a restore.

Parameters

int $severity

One of the Finding severity ordinals.

Returns

string —

A rung name from RUNGS.

escalate()

escalate(string  $rung) : string

One rung up, saturating at the top.

Saturation rather than an exception, because escalation runs on the failure path: a code that has already reached refuse and fails again should stay at refuse, not throw on top of the failure that got it there.

Parameters

string $rung

Current rung.

Returns

string —

The next rung up, the same rung at the top, or the lowest rung when $rung is not on the ladder at all.

decay()

decay(string  $rung) : string|null

One rung down, or NULL at the bottom.

NULL is the signal to stop tracking the code entirely rather than to park it at observe forever; a ledger that never forgets a resolved code grows without limit.

Parameters

string $rung

Current rung.

Returns

string|null —

The rung below, or NULL when already at the bottom or not on the ladder.

isAutomatic()

isAutomatic(string  $rung) : bool

Whether an unattended run may take this rung without asking.

Fails closed: a rung this class does not recognise is not automatic. The cost of refusing a repair is a finding that stays in the ledger until someone looks; the cost of running quarantine unattended is a restore target that is gone when it is needed.

Parameters

string $rung

The rung being considered.

Returns

bool —

TRUE for observe, reindex, refetch and rebuild. FALSE for quarantine, refuse, and anything not on the ladder.

rank()

rank(string  $rung) : int

The position of a rung on the ladder.

Parameters

string $rung

The rung name.

Returns

int —

Its index in RUNGS, or UNRANKED when the name is not a rung.