diff --git a/docs/ci-cd.md b/docs/ci-cd.md index 357f1af20..f350d6c77 100644 --- a/docs/ci-cd.md +++ b/docs/ci-cd.md @@ -72,8 +72,9 @@ step is now continuous. The release boundary is instead where you: consolidating 15 of the 18 offenders away. The floor is a fraction rather than "at least one record", which would accept any ceiling up to 229 on the live corpus; as a fraction the accepted range is 43..180. - - **reported, never asserted** — the fine claim that the ceiling sits between the **90th and - 95th percentile**, i.e. at the tail boundary. `main()` prints a `::notice::` when it drifts. + - **reported, never asserted against the LIVE corpus** — the fine claim that the ceiling sits + between the **90th and 95th percentile**, i.e. at the tail boundary. `main()` prints a + `::notice::` when it drifts; the tests assert it only on distributions they own. It is an order statistic over a sparse distribution, so a single new record could move p90 by 21 lines and red the blocking job for whoever wrote it; a ceiling going out of date is the passage of corpus growth, not a defect in the commit under test, so it is treated like diff --git a/docs/decisions/records/docs/corpus-size-signal.md b/docs/decisions/records/docs/corpus-size-signal.md index da91b5123..650a7d0b2 100644 --- a/docs/decisions/records/docs/corpus-size-signal.md +++ b/docs/decisions/records/docs/corpus-size-signal.md @@ -65,8 +65,9 @@ all asserted, in the blocking job, a property of a corpus the commit under test The fine claim is genuinely useful and genuinely fragile, so it is now measured on every run and printed as a `::notice::` — the same treatment `stale_records` gets, and for the same stated reason: a constant going out of date is the passage of time, not a defect in this change. What stays -blocking is only what routine growth cannot break — each record moves a fraction by at most 1/N, so -from **18/183** over the ceiling it takes **38** consecutive over-ceiling additions to BREACH the +blocking is only what no SINGLE ordinary addition can break — each record moves a fraction by at +most 1/N, so from **18/183** over the ceiling it takes **38** consecutive over-ceiling additions to +BREACH the 25% cap (37 lands exactly on 0.25, which still passes), against **one** record to break v4. **The floor is a fraction, not `> 0`, and review is why.** The first draft of v5 asserted only diff --git a/scripts/tests/test_decisions_validate.py b/scripts/tests/test_decisions_validate.py index 917e952a0..6ce7d4833 100644 --- a/scripts/tests/test_decisions_validate.py +++ b/scripts/tests/test_decisions_validate.py @@ -1110,6 +1110,37 @@ def test_ceiling_calibration_is_empty_safe(): assert cal.n == 0 and not cal.marks_tail and not cal.flags_minority +def test_the_minority_band_BOUNDARIES_are_exactly_where_documented(): + """Pins both constants AND both inclusivities, which review found entirely unmutated. + + Mutating `0.02 -> 0.03`, `0.25 -> 0.30`, or either `<=` to `<` passed all eight calibration + tests. These are not free parameters — they ARE the documented CI-red thresholds, so a silent + shift changes them (a strict cap reds after 37 long additions instead of 38; a strict floor + after 717 short ones instead of 718), quietly falsifying the numbers in `docs.corpus-size-signal` + and `docs/ci-cd.md`. + + 100-record fixtures make the fraction exact and readable: k over the ceiling IS k%. Both + `2/100` and `25/100` are exactly representable and compare equal to the module constants, so + these are true boundary cases rather than near-misses. + """ + + def corpus(n_over: int, total: int = 100): + return [_rec_body(f"a.o{i}", 61) for i in range(n_over)] + [ + _rec_body(f"b.u{i}", 10) for i in range(total - n_over) + ] + + # The bounds are INCLUSIVE — exactly on either edge still passes. + assert dv.ceiling_calibration(corpus(2), 60).flags_minority, "the 2% floor must be inclusive" + assert dv.ceiling_calibration(corpus(25), 60).flags_minority, "the 25% cap must be inclusive" + + # ...and one record beyond either edge does not. + assert not dv.ceiling_calibration(corpus(1), 60).flags_minority, "1% is below the floor" + assert not dv.ceiling_calibration(corpus(26), 60).flags_minority, "26% is above the cap" + + # The constants themselves, so a change has to be deliberate and visible in the diff. + assert (dv.CEILING_MINORITY_MIN, dv.CEILING_MINORITY_MAX) == (0.02, 0.25) + + # `test_adding_ordinary_records_cannot_RED_the_blocking_property` used to live here. It appended two # long synthetic records to the LIVE corpus and asserted `flags_minority` on the result — which # crosses the 25% cap TWO records before the production bound does (56/221 vs 54/219), making the