---
title: "Failure Cascades"
subtitle: "Structural Dependency Criticality via PageRank: what stops when a system fails, and how often"
---
```{r load}
#| include: false
for (f in sort(list.files("R", pattern = "^[0-9].*\\.R$", full.names = TRUE))) source(f)
res <- load_results()
s <- res$scores
n_assets <- nrow(s)
th <- res$params$thresholds
cv <- res$cascade_vault
cvh <- res$cascade_vault_hard
spof <- s |> filter(blast_value_hard >= th$spof_value_share) |> arrange(desc(blast_value_hard))
redis <- s |> filter(name == "Redis_Session_Cache")
mc <- res$mc
mc_top <- mc$by_asset |> slice_max(expected_value_lost, n = 2, with_ties = FALSE)
ko <- res$knockouts
rdi <- ko |>
filter(!is.na(delta_score)) |>
slice_max(delta_score, n = 1, with_ties = FALSE, by = shock_target) |>
transmute(shock_target, top_gainer = name, top_gain = delta_score) |>
right_join(distinct(ko, shock_target, rdi), by = "shock_target") |>
left_join(select(s, shock_target = name, tier, p_custom), by = "shock_target") |>
arrange(desc(rdi))
vault_ko <- ko |> filter(shock_target == "Secrets_Vault", !is.na(delta_score)) |> arrange(desc(delta_score))
```
PageRank measures how much a system is relied on. It does not say what happens when the system fails. This page answers that question directly with a **failure-cascade model**: fail one system, then fail every system that has a failed hard dependency, and repeat until nothing changes. The result is the system's **blast radius**, counted in systems and in business value.
## Blast radius {#sec-blast}
```{r blast-plot}
#| fig-height: 8
s |>
mutate(name = fct_reorder(name, blast_value_hard + blast_value / 100)) |>
ggplot(aes(y = name)) +
geom_col(aes(x = blast_value), fill = "#cde2fb", width = 0.75) +
geom_col(aes(x = blast_value_hard), fill = "#2a78d6", width = 0.45) +
geom_vline(xintercept = th$spof_value_share, linetype = "dashed", color = "#444444") +
annotate("text", x = th$spof_value_share, y = 1.5, hjust = -0.05, size = 3.4,
label = paste0("SPOF threshold (", percent(th$spof_value_share), ")"), color = "#444444") +
scale_x_continuous(labels = percent_format(1), limits = c(0, 1.05), expand = expansion(mult = c(0, 0.02))) +
labs(
title = "Business value disabled when each system fails",
subtitle = "Dark bar: hard dependencies only. Light bar: every dependency treated as hard.",
x = "Share of business value disabled", y = NULL
)
```
**How to read the plot.** Each bar is one system. The dark bar shows the share of business value that stops when that system fails, counting only hard dependencies, where a dependent cannot run without it. The light bar behind it shows the same measure if every dependency were hard. The dashed line marks the `r pct(th$spof_value_share, 1)` threshold above which a system is classed as a systemic single point of failure.
**What the plot tells you.** `r nrow(spof)` systems cross the threshold. The vault and cloud IAM each stop `r pct(spof$blast_value_hard[1], 1)` of business value, followed by `r spof$name[3]` at `r pct(spof$blast_value_hard[3], 1)` and `r spof$name[4]` at `r pct(spof$blast_value_hard[4], 1)`. Treating every dependency as hard would raise the cache and search systems from 0% to `r pct(redis$blast_value, 1)` and `r pct(s$blast_value[s$name == "Elastic_Search"], 1)`, which shows how much the hard/soft judgment matters. Every bar assumes no redundancy, so real impacts are lower wherever backups exist.
```{r blast-table}
s |>
arrange(desc(blast_value_hard), desc(blast_value), rank_custom) |>
select(name, tier, rank_custom, blast_n, blast_value, blast_n_hard, blast_value_hard) |>
gt_house(title = "Blast radius by system", subtitle = "Sorted by business value disabled through hard dependencies") |>
cols_label(
name = "Asset", tier = "Tier", rank_custom = "PageRank rank",
blast_n = "Systems failed (all edges)", blast_value = "Value disabled (all edges)",
blast_n_hard = "Systems failed (hard edges)", blast_value_hard = "Value disabled (hard edges)"
) |>
fmt_percent(columns = c(blast_value, blast_value_hard), decimals = 0) |>
tab_spanner("All dependencies hard", columns = c(blast_n, blast_value)) |>
tab_spanner("Soft dependencies degrade", columns = c(blast_n_hard, blast_value_hard))
```
**How to read the table.** Each row is one system, sorted by the share of business value its failure stops. The first pair of result columns assumes every dependency is hard; the second pair lets soft dependencies degrade gracefully, so only hard links spread the failure. "Systems failed" counts the other systems that stop, and "value disabled" is the business value they carry, including the failed system's own. PageRank rank is shown for comparison.
**What the table tells you.** With every dependency hard, the vault stops `r cv$n_dependents_failed` of the other `r n_assets - 1` systems and cloud IAM stops `r s$blast_n[s$name == "Cloud_IAM"]`. The table also shows where PageRank misleads. The risk-scoring engine ranks `r s$rank_custom[s$name == "Risk_Scoring_Engine"]` by PageRank, yet its failure stops `r pct(s$blast_value_hard[s$name == "Risk_Scoring_Engine"], 1)` of business value, because the payment, ordering and gateway systems sit on top of it. The session cache ranks `r redis$rank_custom` but stops nothing once its soft links degrade.
The cascade code is in `R/03_cascade.R` (`simulate_cascade()`). The tests check that, with every edge hard, the vault takes down 19 systems and cloud IAM 20, and that the cascade matches igraph's reachability count for every system.
## With full redundancy: dominators {#sec-dominators}
The cascade above is pessimistic: any failed hard dependency stops the dependent. The opposite assumption is that a system keeps running as long as *any* supply path from the foundation layer still reaches it, as if every dependency were redundant. Under that assumption, a system is still a single point of failure for another if every supply path to the second passes through the first. In graph terms, the first system **dominates** the second.
```{r dominators-table}
bind_rows(
res$dominators |> mutate(map = "v1 (original)"),
res$dominators_v2 |> mutate(map = "v2 (with DNS, vault–IAM cycle)")
) |>
filter(dominates_n > 0) |>
select(map, name, dominates_n, dominates_value, dominated_assets) |>
gt_house(title = "Systems that remain single points of failure even with full redundancy",
subtitle = "Dominator analysis on the supply graph, from a virtual root feeding every foundation system") |>
cols_label(map = "Map", name = "Dominating system", dominates_n = "Systems dominated",
dominates_value = "Business value dominated", dominated_assets = "Systems dominated") |>
fmt_percent(columns = dominates_value, decimals = 0)
```
**How to read the table.** Each row is a system that would remain a single point of failure even if every other dependency had a backup. "Systems dominated" counts the systems that would lose all supply if this one failed, and "business value dominated" is the share of business value those systems carry. The last column names them. The first rows use the original map, and the last row uses the more complete v2 map.
**What the table tells you.** On the original map, no system dominates any revenue-earning system, so with full redundancy no single failure would stop the business. The vault and IAM dominate only data stores whose sole dependency they are. On the v2 map, Root_DNS dominates all `r res$dominators_v2$dominates_n[res$dominators_v2$name == "Root_DNS"]` other systems, because every supply path ends at it. A real estate lies between this optimistic view and the pessimistic cascade, depending on where backups actually exist.
## Expected annual loss (Monte Carlo) {#sec-montecarlo}
A board allocates budget against expected loss, which needs a likelihood as well as an impact. Each system is given an illustrative annual probability of a disabling outage, by asset type ([Data & Topology](data.qmd)). The simulation runs `r number(mc$n_years, big.mark = ",")` years (seed `r mc$seed`). In each year, every system fails independently with its probability, and the year's loss is the business value inside the union of the hard-edge cascades.
```{r mc-table}
mc$by_asset |>
left_join(select(s, name, tier, rank_custom), by = "name") |>
arrange(desc(expected_value_lost)) |>
slice_head(n = 12) |>
select(name, tier, rank_custom, annual_failure_prob, blast_value_hard, expected_value_lost, mc_value_lost) |>
gt_house(title = "Expected annual business value disrupted, by initiating system",
subtitle = "Top 12; probability × value disabled, with the Monte Carlo estimate as a check") |>
cols_label(name = "Asset", tier = "Tier", rank_custom = "PageRank rank",
annual_failure_prob = "Annual failure probability", blast_value_hard = "Value disabled per failure",
expected_value_lost = "Expected per year", mc_value_lost = "Monte Carlo per year") |>
fmt_percent(columns = c(annual_failure_prob, blast_value_hard), decimals = 0) |>
fmt_percent(columns = c(expected_value_lost, mc_value_lost), decimals = 1)
```
**How to read the table.** Each row is one of the twelve systems whose failures disrupt the most business value per year on average. The annual failure probability is the assumed chance of a disabling outage, and the value disabled per failure comes from the cascade above. Their product is the expected share of business value disrupted per year. The Monte Carlo column repeats that estimate from `r number(mc$n_years, big.mark = ",")` simulated years as a check.
**What the table tells you.** `r knitr::combine_words(mc_top$name)` lead, at `r if (n_distinct(mc_top$expected_value_lost) == 1) paste(pct(mc_top$expected_value_lost[1], 0.1), 'a year each') else paste(knitr::combine_words(pct(mc_top$expected_value_lost, 0.1)), 'a year')`, because they combine a large blast radius with the higher failure rate assumed for application services. The vault and IAM stop everything when they fail, but they are assumed to fail less often, so they rank lower. The calculated and simulated columns agree closely. The ranking rests on illustrative failure probabilities: it shows how likelihood changes priorities, not real expected losses.
```{r mc-hist}
#| fig-height: 5
tibble(loss = mc$year_loss) |>
ggplot(aes(loss)) +
geom_histogram(binwidth = 0.05, boundary = 0, fill = "#2a78d6", color = "white") +
scale_x_continuous(labels = percent_format(1)) +
scale_y_continuous(labels = comma) +
labs(
title = "Simulated years by share of business value disrupted",
subtitle = paste0(comma(mc$n_years), " simulated years; overlapping cascades in the same year are counted once"),
x = "Share of business value disrupted at least once in the year", y = "Years"
)
```
**How to read the plot.** Each bar counts simulated years by the share of business value that was stopped at some point during the year, in steps of 5%. The tall bar at the far left counts years with no disabling outage. A system that is hit twice in one year is counted once, and outage length is not modeled, so a one-hour outage and a one-week outage count the same.
**What the plot tells you.** In `r pct(mean(mc$year_loss == 0), 1)` of simulated years nothing fails, but in `r pct(mean(mc$year_loss >= th$spof_value_share), 1)` the year's outages together stop at least `r pct(th$spof_value_share, 1)` of business value at some point, and in `r pct(mean(mc$year_loss >= 1 - 1e-9), 1)` they stop everything. These frequencies follow directly from the illustrative, deliberately round failure probabilities. The chart demonstrates the method; real incident data would turn it into a defensible estimate of how often major disruptions occur.
## Centrality redistribution after removal (not a failure model) {#sec-knockout}
The original study removed a system from the graph, recomputed PageRank, and called the change "stress shifting onto surviving systems". That is not what happens in a real outage. When the vault fails, its dependents fail with it; they do not hand their load to IAM. The calculation is kept here as a sensitivity measure, described accurately as **centrality redistribution**.
For each system $i$, the system is deleted from the graph, PageRank is recomputed on the `r n_assets - 1` survivors, and the result is compared with the baseline scores renormalized over the same survivors. The **Rank Distortion Index** is
$$
\text{RDI}(i) = \sqrt{\sum_{j \neq i} \left( \tilde{p}^*_{\text{baseline}}(j) - p^*_{-i}(j) \right)^2}, \qquad \tilde{p}^*_{\text{baseline}}(j) = \frac{p^*_{\text{baseline}}(j)}{\sum_{k \neq i} p^*_{\text{baseline}}(k)} .
$$
```{r rdi-table}
rdi |>
select(shock_target, tier, p_custom, rdi, top_gainer, top_gain) |>
gt_house(title = "Rank Distortion Index for every system",
subtitle = "Vertex removed, PageRank recomputed, compared with the survivor-renormalized baseline") |>
cols_label(shock_target = "System removed", tier = "Tier", p_custom = "Baseline PageRank",
rdi = "RDI", top_gainer = "Largest gainer", top_gain = "Gain (pp)") |>
fmt_percent(columns = p_custom, decimals = 2) |>
fmt_number(columns = rdi, decimals = 3) |>
fmt(columns = top_gain, fns = \(x) number(100 * x, accuracy = 0.01)) |>
sub_missing(missing_text = "–")
```
**How to read the table.** Each row is one system removed from the map. Baseline PageRank is its score before removal. The rank distortion index (RDI) measures how much the remaining systems' scores move when PageRank is recalculated without it: 0 means no change, and larger values mean more reshuffling. The last two columns name the system that gains the most share and how many percentage points it gains.
**What the table tells you.** Removing the vault reshuffles the scores most (RDI `r number(rdi$rdi[1], 0.001)`), followed by `r rdi$shock_target[2]` (`r number(rdi$rdi[2], 0.001)`). Half of all removals have an RDI below `r number(median(rdi$rdi), 0.001)`. This measures how much the ranking leans on each system; it is not a failure simulation. In a real outage, the systems that depended on the removed one would stop rather than pass their importance to others, so treat these values as a sensitivity check only.
```{r redistribution-plot}
#| fig-height: 6
vault_ko |>
slice_max(abs(delta_score), n = 10) |>
mutate(name = fct_reorder(name, delta_score), direction = if_else(delta_score > 0, "Gains share", "Loses share")) |>
ggplot(aes(delta_score * 100, name, fill = direction)) +
geom_col(width = 0.7) +
geom_vline(xintercept = 0, color = "#444444") +
scale_fill_manual(values = c("Gains share" = "#2a78d6", "Loses share" = "#eb6834"), name = NULL) +
labs(
title = "Centrality redistribution after removing Secrets_Vault (not a failure cascade)",
subtitle = "Change in PageRank share against the survivor-renormalized baseline",
x = "Change in share (percentage points)", y = NULL
)
```
**How to read the plot.** Each bar is one of the ten systems whose PageRank share changes most when the vault is removed from the map. Bars to the right of the center line gain share, and bars to the left lose share. Changes are in percentage points of PageRank, measured against the original scores rescaled so that the remaining systems again add up to 100%.
**What the plot tells you.** `r vault_ko$name[1]` gains `r pp(vault_ko$delta_score[1])`, while almost every other system loses a little. The shift is mechanical: systems that depended on both the vault and IAM now send their whole share to IAM. It does not mean that load or risk moves to IAM during a real vault outage, when most of IAM's dependents would be down as well (see [Blast radius](#sec-blast)).