nfrs.sgit.ai / resilience

Design for the failure you had

Resilience engineering usually goes wrong in one of two directions: nothing is built because no failure has happened yet, or a great deal is built against failures nobody has seen and the mechanisms themselves become the largest source of complexity. This estate landed somewhere more disciplined, and it landed there without ever writing the rule down.

Every resilience mechanism in this estate traces to a named incident. That is the doctrine.

Why incident-traced beats threat-modelled, here

The rule is not that imagined failures do not matter. It is a rule about what earns a mechanism, and it produces three properties that speculative resilience work does not:

PropertyWhy the incident rule produces it
The set stays smallIncidents are rarer than imagined failure modes by orders of magnitude, so the mechanism count stays reviewable.
Every mechanism has a storyA new engineer can be told why this exists, with a date. Mechanisms without stories are the ones that get removed by someone tidying up, correctly-looking and wrongly.
The tests are realThe failure has occurred, so the reproduction is known. A mechanism against an imagined failure is verified against an imagined reproduction.

It is the same rule the structural-guard pattern reaches independently — every guard encodes a rule that was violated at least once — which is some evidence that the rule is a real finding rather than a convenient description of what happened to get built.

The patterns

The artefacts themselves — the code, the specifications, the measurements — belong to sg-compute.sgit.ai. This page owns the doctrine, and describes each mechanism only as far as the pattern it demonstrates.

MechanismThe pattern it demonstrates
The watchdog that exits hardWhen the process is deadlocked, an orderly shutdown path is itself deadlocked. The watchdog exits at the lowest level available rather than asking the runtime politely, and the source carries the reasoning about why the polite path cannot work. A recovery mechanism must not depend on the subsystem it is recovering from.
The two-phase health pollerHealth is not one question. Is it up and is it working have different answers, different latencies, and different correct responses, and collapsing them into one endpoint loses the distinction exactly when it matters.
Halt means terminateA stopped-but-existing resource is a resource that still costs money and can still be reached. The ambiguous middle state is removed rather than managed.
Idle reconciliationReality drifts from the record whenever anything fails partway. Rather than trying to make every operation atomic, a reconciliation pass runs when nothing else is happening and converges the two. Assume drift; schedule convergence.
Build-time guards citing incidentsEach guard names the production incident that motivated it, in the source. That citation is what stops a future cleanup from deleting it.

Counter-evidence

Three things this doctrine does not do, and one place it failed.