Commit Graph

1 Commits

Author SHA1 Message Date
A.Shakhmatov
8f63c6df70 tests/e2e: the churn gate, as a committed harness
D7.4 was the only block in `tests/e2e/results/m0-gates.txt` without a
`reproduce:` line. The numbers were real and the harness was not committed, so
the one measurement the whole free-list decision rested on could not be re-run
against a change. This is that harness.

Self-contained like `e2e6.js`: it spawns its own server on a fresh database.
Two modes, delete-and-refill and repeated update, over `--docs` documents of
`--doc-size`, with `--index` to put index maintenance inside the churn rather
than beside it.

Three things it does that the ad-hoc version did not:

Live bytes are computed here, from the serialized size of one document, rather
than read off the server. That is what makes a run against an older binary
comparable -- and the first thing this harness was used for was measuring the
pre-Stage-3 binary, which has no `multifora` section at all.

Deleted ids are sampled from the ids actually live. Sampling blind from the id
space re-picks dead ones, so a round deletes fewer documents than it inserts
and a supposedly flat-live measurement quietly grows. The first run of this
harness ended with 3211 documents where it should have had 2000.

And it prints `inUse` beside `ratio`. The data file never shrinks, so
`file / live` is a high-water mark and cannot come down however well
reclamation works; `inUse` is `(allocTail - freeReady) / live`, which is what
the database is actually occupying. On the update line those two read 2.46x
and 1.06-1.26x for the same run, and the difference between them is the whole
finding.

A fixed seed, so two runs churn the same documents in the same order and a
difference between them is the code rather than the dice. `--target x` fails
the run above a ratio, for use as a gate; without it the harness measures and
reports.
2026-08-09 17:44:05 +03:00