# When agreement is wrong

An executable, synthetic illustration of three-output majority voting. It is
not an EnvyFS implementation, benchmark, fault-injection reproduction or estimate
of real storage reliability.

## A voter has no truth oracle

| Three returned labels | Decision | Meaning if "correct" is the oracle |
| --- | --- | --- |
| correct, correct, wrong | correct | One disagreement is masked |
| correct, wrong, wrong | wrong | A wrong majority wins |
| wrong, wrong, wrong | wrong | Unanimity can still be wrong |
| correct, wrong-a, wrong-b | no-majority | No result has two votes |

The labels represent completed, already comparable outputs. Real operation
semantics, missing responses, crashes, checksum collisions, repair, timing,
persistence and voter faults are outside this example. In particular, absence
of agreement is not counted as a wrong majority.

## Same marginals, different dependence

Assume each child returns one of two outputs: the correct value or the same wrong
value. Let p be each child's probability of a wrong value per trial.

With independent children, a wrong majority occurs in three ways with exactly
two wrong outputs, and one way with three:
3 p^2 (1-p) + p^3 = 3 p^2 - 2 p^3.

With perfectly shared failures, all children are correct with probability 1-p
and all are wrong with probability p. Each child still has marginal probability
p, but the voter is wrong with probability p as well.

For the **chosen** p = 0.01, the results are 0.0298% and 1%. These are exact
arithmetic results under different assumptions, not confidence intervals or
measurements. They show why individual error probabilities alone do not identify
system risk. Different wrong outputs could instead produce no majority.

## Reproduce

Requires Node.js with its built-in test runner, no third-party dependency.
Download [model.mjs](./model.mjs) and [model.test.mjs](./model.test.mjs) together.

```sh
node --test model.test.mjs
node --input-type=module -e "import {example} from './model.mjs'; console.log(example())"
```

Tests enumerate all 27 triples over three labels and all eight binary states
for 1001 values of p. No random sampling or seed is involved.

## Sources and interpretation

[EnvyFS, USENIX ATC 2009](https://www.usenix.org/legacy/event/usenix09/tech/full_papers/bairavasundaram/bairavasundaram.pdf)
motivates comparing different filesystems. The [corpus record](https://hesela.dev/terms/envyfs/)
separates its documented architecture and prototype limitations from this model.

[Knight and Leveson, IEEE TSE 1986](https://doi.org/10.1109/TSE.1986.6312924)
provide independent experimental context: independent development did not ensure
independent errors for their chosen programming task. That is not an EnvyFS
failure-rate measurement, nor proof that diversity cannot help.

Hesela model and tests authored 2026-12-02. No source-paper figures, text extracts
or experimental data are redistributed.
