# What an erase ratio cannot tell you

## Evidence reviewed
Maneas, Mahdaviani, Emami and Schroeder, Operational Characteristics of SSDs
in Enterprise Storage Systems: A Large-Scale Field Study, FAST 2022,
pp. 165-180, ISBN 978-1-939133-26-7. No DOI asserted.
https://www.usenix.org/conference/fast22/presentation/maneas
https://www.usenix.org/system/files/fast22-maneas.pdf
Accessed 2026-11-25. Reviewed section 2, section 3.3, figure 4 labels and footnote 2.
Telemetry: almost two million SSDs, 21 snapshots from January 2017 to March
2021, one vendor's enterprise systems. Section 3.3 defines maximum/mean erase
count and (maximum-minus-mean)/rated limit; footnote 2 says the minimum
per-block erase count for each SSD was unavailable. This is observational telemetry, not a randomized comparison.
The source supports the metrics, not the constructed vectors below.

## Original derivation
For n nonnegative block counts, S = sum(e_i), M = max(e_i), and reference L > 0:
mean = S/n; ratio = n*M/S when S > 0;
normalized excess in percent = 100*(n*M-S)/(n*L).
The zero vector has no defined ratio. Our output uses JSON null, never NaN,
Infinity or an invented perfect-balance value. Equal positive counts give 1.

Multiplying every count by a positive factor preserves the ratio but changes
absolute exposure. Vectors [10,10,10,30] and [1000,1000,1000,3000] both give 2.
With reference 3000, the normalized gaps are 0.5% and 50%.

Even mean, maximum and normalized gap together do not identify the population.
Vectors [1000,1000,1000,3000] and [0,0,3000,3000] both have mean 1500 and maximum
3000, but one versus two blocks meet the reference. Their minimums also differ.
This is an exact four-block counterexample, not a claim about the paper's
unavailable per-block histogram or a statistical estimate for real SSDs.

For S > 0, 1 <= ratio <= n because M <= S <= n*M. The ratio's feasible range
therefore depends on the population size. A single sampled maximum cannot
identify subsequent wear rates. A lower ratio can arise when less-used blocks
catch up while the maximum is unchanged; it need not mean that damage reversed.

## Measurement contract and limits
The caller supplies exact nonnegative safe integer counters from one fixed,
equally weighted block population. No rounding, sampling, counter resets,
block retirements, controller-specific inclusion rules or changes of population
are reconstructed. For telemetry, retain those definitions and the observation
time. A lifetime maximum over retired blocks and a mean over active blocks
would not necessarily satisfy this contract. This helper cannot detect that
semantic mismatch from numbers alone.

The 3000-cycle reference is stipulated normalization, not a failure event,
retirement rule, warranty or physical survival guarantee. atOrAboveReference
only counts the supplied vector's arithmetic comparisons; it is not inferred
from mean/maximum. No field rate, future lifetime, retention, WAF or confidence
interval is estimated. Original payload examples remain unchanged.
No paper text, figures or private telemetry are redistributed.

## Sharp count bounds from exact summaries

This is Hesela's elementary finite-population derivation, not a result extracted
from FAST 2022 and not a new statistical theorem. The field study motivates the
question; its private block histograms are neither available nor reconstructed.

Suppose n >= 1 nonnegative integer counters have exact sum S and attained
maximum M. The summaries are feasible exactly when M <= S <= n*M. Let T >= 1
be an integer reference, and k the number of counters at least T.
If M < T, k is zero. Otherwise k >= 1, because some block attains M.
For a specified k:

    smallest possible sum = M + (k - 1)*T
    largest possible sum  = k*M + (n - k)*(T - 1)

For the lower sum, retain one block at M, set the other k - 1 high blocks to T
and all low blocks to zero. For the upper sum, set every high block to M and
every low block to T - 1. Keep the first M fixed and increment the remaining
counters inside their intervals: every integer sum between the two endpoints
is reachable. Thus these inequalities are both necessary and sufficient, not
just loose bounds. Solving them gives:

    k_min = max(1, ceil((S - n*(T - 1)) / (M - T + 1)))
    k_max = min(n, 1 + floor((S - M) / T))

Every integer k in this range has a witnessing population. The ceilings use
exact integer arithmetic; a negative numerator cannot raise the lower bound
above one. For n=4, S=6000, M=T=3000, the feasible count is 1 through 2,
not a point estimate. These summaries do not tell us which value occurred.

Knowing that M is attained can materially improve the usual sum/T upper bound.
For n=4, S=11, M=8, T=3, sum/T alone allows three high blocks. The true upper
bound is two: [8,3,0,0] attains it, whereas [8,1,1,1] attains one. Three high
blocks would need at least 8+3+3=14 erases, exceeding the sum. A nontrivial lower
bound also occurs: n=4, S=16, M=5, T=3 forces three or four high blocks, with
witnesses [5,5,5,1] and [5,5,3,3]. These are synthetic arithmetic examples.

### API and limits

`boundErasesAtReference(summary, referenceCycles)` consumes `blockCount` as a
positive safe integer and `totalErases` / `maximumErases` as canonical unsigned
decimal strings, matching the existing snapshot helper. The reference is a
positive safe integer. Results are integer `minimumBlocks` and `maximumBlocks`.
The function does not allocate or scan an n-element vector. It uses a fixed
number of BigInt operations; their cost still grows with operand bit length.
Impossible summaries and ambiguous numeric forms are rejected, not repaired.
The earlier full-vector helper and all its result fields retain their meaning.

An exact mean plus n can determine S, but a rounded mean generally cannot.
Unknown rounding intervals would require a different contract. Nor can the
helper validate that counters actually refer to the same block population,
timestamp or inclusion rule. A sampled maximum or a rated endurance limit is
not an observed maximum. No distributional, independence or random-sampling
assumption is needed, and no confidence level is attached. Crossing T is not
defined as damage, retirement, lost data or an SSD failure event.

### Verification

The independent enumeration test constructs all 55,986 vectors of lengths
1 through 6 with counter values 0 through 5. Across references 1 through 7,
it groups 1,827 distinct (n,S,M,T) cases and obtains feasible counts directly
from the vectors, without using the formula. It verifies both attained
endpoints and every intermediate integer. Separate tests cover impossible
summaries, threshold boundaries, zero counts and totals beyond binary64's
exact integer range. This finite enumeration supports the implementation;
the argument above establishes the general result under the stated contract.

## Reproduce
Requires Node.js with the built-in test runner; no new dependency.

    node generate-erase-examples.mjs
    node --test erase-distribution.test.mjs erase-bounds.test.mjs
    node generate-erase-examples.mjs --check

In a full source checkout, also run cli.test.mjs alongside model.test.mjs.
check.mjs requires an explicit --source or --built mode; neither a missing mode
nor a misspelled mode can claim success. publish.mjs --check never repairs drift.
The source and built checks also recompute the generated erase examples. Two
matching copies of an incorrect result must fail acceptance rather than pass
merely because canonical and public bytes agree.

The module uses BigInt products and reduced fractions. It rejects empty/sparse
arrays, negative/fractional/unsafe/nonfinite counts and invalid references.
Generated results remain separate from original inputs.
