\Drupal\strata\Health RepairPass

Runs the repair a finding's rung names, unattended or for one code on request.

Until 1.0.3 the ladder had no runner. health.auto_repair shipped on by default, a checkbox on the retention form wrote it, the schema declared it, the README said the four rungs at or below rebuild run on cron - and nothing read the setting. CircuitBreaker had a full unit suite and no caller. So a site that recorded a finding recorded it forever: nothing ran a pass, and nothing called HealthLedgerInterface::resolve() anywhere in the module, so the dashboard only ever grew.

Findings are resolved before a pass runs, not after, and put back when it raises. A pass that succeeds proves the work was done, never that the symptom is gone, and only some passes re-check: Verifier::verify() sweeps the tripwires again and re-records whatever is still true, while Reindexer::reindex() does not. Clearing afterwards would therefore delete a symptom the pass had just re-confirmed. Clearing first and restoring on failure keeps both ends honest: the ledger shows the newest sweep rather than a running total, and a pass that could not run leaves the store looking exactly as broken as it is.

A rung's pass runs once however many codes name it. Four codes sitting at reindex are one reindex, not four.

Failure escalates, and escalation is how cron hands the problem over. A code whose pass raises climbs one rung; climbing past rebuild reaches quarantine, which RepairLadder::isAutomatic() refuses, so the code stops being retried and waits for a person. The breaker is the shorter leash inside a single run: three failures on a code and it is left alone.

Summary

Methods
Properties
Constants
__construct
run
runCode
describe
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
repair
execute
clear
openCodes
ledger
breaker
logger
passes
No private constants found

Properties

$breaker

$breaker : \Drupal\strata\Health\CircuitBreaker

Type

CircuitBreaker

$logger

$logger : \Psr\Log\LoggerInterface

Type

LoggerInterface

$passes

$passes : array

Type

array<string|int, mixed>

Methods

__construct()

__construct(\Drupal\strata\Health\HealthLedgerInterface  $ledger, \Drupal\strata\Health\CircuitBreaker  $breaker, \Psr\Log\LoggerInterface  $logger, array  $passes) : mixed

Constructs the pass.

Parameters

\Drupal\strata\Health\HealthLedgerInterface $ledger

Where findings and rungs are read and written.

\Drupal\strata\Health\CircuitBreaker $breaker

Stops a code that keeps failing from being retried for the rest of the process.

\Psr\Log\LoggerInterface $logger

Records every pass that ran and every one that raised.

array $passes

Rung name keyed to what running it does, each returning its own summary line. Callables rather than objects so a site with no encryption key does not assemble a store to discover there is nothing to repair.

Returns

mixed —

run()

run() : \Drupal\strata\Health\RepairReport

Repairs every open code whose rung an unattended run may take.

Returns

\Drupal\strata\Health\RepairReport —

What the pass did.

runCode()

runCode(string  $code) : \Drupal\strata\Health\RepairReport

Repairs one code, whether or not it is open.

Parameters

string $code

The finding code.

Returns

\Drupal\strata\Health\RepairReport —

What the pass did.

describe()

describe(string  $rung) : string

What running a rung actually does, in a sentence an operator can act on.

Parameters

string $rung

The rung.

Returns

string —

The description.

repair()

repair(list  $codes) : \Drupal\strata\Health\RepairReport

Repairs a set of codes, running each rung's pass at most once.

Parameters

list $codes

The finding codes.

Returns

\Drupal\strata\Health\RepairReport —

What the pass did.

execute()

execute(array>  $byRung, int  $considered, int  $held) : \Drupal\strata\Health\RepairReport

Clears what each rung's codes have open, then runs that rung once.

Parameters

array> $byRung

Rung name keyed to the codes sitting on it.

int $considered

How many codes were looked at in total.

int $held

How many were left for a person before this ran.

Returns

\Drupal\strata\Health\RepairReport —

What the pass did.

clear()

clear(list  $codes) : list<\Drupal\strata\Health\Finding>

Resolves everything these codes currently hold open, and hands it back.

The findings are returned so a pass that raises can put them straight back. A ledger keys one open row per code and scope and re-stamps a repeat, so this is exactly what was there.

Parameters

list $codes

The codes about to be repaired.

Returns

list<\Drupal\strata\Health\Finding> —

What was cleared.

openCodes()

openCodes() : list<string>

The distinct codes the ledger currently holds open.

Returns

list

The codes, each once.