Account for the interval a model proposes; never clamp it

M4.3 advances a cohort over one declared interval and deliberately does not model
one. ECOLOGY_MODEL keeps population maths an experiment and asks for several
candidates to be compared, so choosing one here would turn a recommendation into
a locked rule. A model proposes fluxes; this checks the declared result is
exactly what they imply, for counts and for every inventory channel.

Nothing is clamped. A loss larger than what is there refuses the interval and
says whether it was the population or the biomass, so a caller can subdivide;
subtraction is checked against what is present rather than performed and
repaired, so a negative population is never constructed. That is the answer to
the named risk: a clamp is how an interval a model could not integrate becomes a
plausible result, and how a false extinction arrives. Both clamp mutations are
detected by the tests.

Counts carry whole members and owed fractions as one quantity, so a population
below one member is a number rather than a rounding decision. Biomass has no
birth term at all, so a birth cannot bring inventory in and newborns are
necessarily funded from what the cohort holds. Immigration draws from a reservoir
that already held it, so a late transfer is not new production. Conservation runs
through the ledger as one atomic transaction; an interval where nothing moves
submits none.

Two amendments to M4.1 were forced, not chosen. A cohort records the reservoir
backing it, because an advance cannot otherwise know where the inventory is and
passing it alongside would let a caller advance one cohort against another's
store, which comparing balances cannot detect between equal reserves; the
registry now refuses two cohorts sharing one. And a cohort may be vacant, through
a separate factory so vacancy stays deliberate, because a decline to exactly zero
was otherwise unrepresentable and the only way through would have been the clamp
this milestone exists to refuse. A vacant cohort is not an extinction: the
record, its genome, its habitat and its provenance remain and it stays installed.

Fourteen guards confirmed load-bearing by removing each and rerunning. Two of my
own expectations were wrong rather than the code: escrow arithmetic in the
migration test, and a dwindling case that shed all but one femtogram while
declaring a result holding none. The second surfaced a real tension now recorded
in ADR-0038 rather than worked around: a class reduced to a fraction of a member
may hold no reserve, because reserve belongs to members and a fraction is not one
yet, so that biomass has to go somewhere the same interval.

Closure is checked and stability is not, so an interval whose arithmetic balances
and whose ecology is nonsense is accepted. The declared age structure is not
verified to be what ageing would produce, because that needs the within-class
distribution the record discards.

Release 36/36, analysis, ASan 36/36 and clang-format all ran and passed here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-24 10:23:09 -04:00
co-authored by Claude Opus 5
parent 0697895e25
commit cabada70c4
16 changed files with 1331 additions and 8 deletions
+73
View File
@@ -1061,3 +1061,76 @@ mangled the escaped newlines in the mutation script and the script failed to
parse, so nothing was ever mutated. It is the second time this environment quirk
has produced a false negative in a mutation sweep, and both times the printed
output rather than the exit status is what revealed it.
## M4.3 interval accounting
Executed on this Windows host (2026-09-24): Release configure, build and `ctest`
36/36; the analysis preset (clang-tidy 19, warnings as errors) built clean; the
ASan preset configured, built and ran 36/36; `clang-format` 19.1.5 reported no
violations. All four checks ran and passed on the committed tree. No Clang or GCC
compile happens on this host, so Linux CI remains the first such result.
`evo-population-tests` covers ten properties, and `evo-cohort-tests` gained two
for the amendments. An interval with no flux advances the clock and submits no
ledger transaction. Births change the population and leave the reserve untouched.
Death, predation, immigration and emigration each move biomass once to the named
counterparty with the conserved total unchanged. A loss exceeding the population
or any one inventory channel is refused rather than clamped, including at the
boundary of a single millionth of a member, while taking exactly everything is
vacancy rather than refusal. A population below one member stays a population and
its record stays installed. A declared result that does not match the fluxes is
refused in both directions, for counts and for biomass. Empty and backward
intervals, a foreign owner and a repeated revision are refused. A commit against a
record that has moved on, or a reservoir that no longer holds what was counted,
changes nothing in either the ledger or the registry, and one plan cannot be
committed twice.
The seeded ensemble runs twenty-four seeds of forty proposed intervals each,
deliberately proposing losses unbounded relative to the cohort so that some must
be refused. Every accepted interval is checked for the conserved total being
unchanged and for the cohort's reservoir equalling its recorded reserve. The test
asserts that both the accepted and the refused path actually occurred, so a change
that made everything refuse, or everything pass, fails rather than looking clean.
All fourteen guards were confirmed load-bearing by removing each in turn and
rerunning: the two no-clamp guards, the two mismatch guards, the interval, owner,
revision and counterparty guards, the three commit staleness guards, and the three
amendments to the cohort record. The two clamp mutations are the ones worth
naming, because they are the defect rather than a missing check: replacing the
refusals with saturating subtraction, which is what a clamp is, is detected.
Two of my own expectations were wrong rather than the code. The escrow arithmetic
in the migration test was miscalculated: the reservoir receives two hundred matter
and returns one hundred, so from seven it stands at a hundred and seven, not a
hundred and ninety-seven. And the dwindling-population test shed all but one
femtogram of the reserve while declaring a result that held none, which is a real
`biomass_mismatch`; the test now sheds the whole reserve. That second one surfaced
a genuine tension worth recording: a class reduced to a fraction of a member may
hold no reserve, because ADR-0036 gives reserve to members and a fraction is not
one yet, so that biomass has to go somewhere in the same interval. It is recorded
in ADR-0038's costs rather than worked around.
ADR-0036 was amended twice, and both were forced by this milestone rather than
chosen. Threading the reservoir through each request instead of binding it to the
record would have let a caller advance one cohort against another's store, and a
balance comparison cannot distinguish two equal reserves, so the binding is a
correctness fix and not tidiness. Vacancy is required because a decline to exactly
zero was otherwise unrepresentable and the only way through would have been the
clamp this milestone exists to refuse. `Cohort::vacant` is a separate factory
precisely so that an empty class list in a draft stays an error.
Coverage limits. Closure is checked and stability is not: an interval whose
arithmetic balances and whose ecology is nonsense is accepted, and no test asserts
otherwise, because comparing matched ensembles is M4.5. The declared age structure
is not verified to be what ageing would produce, since that needs the within-class
distribution the record discards; nothing here checks that members did not get
younger. Emigration escrows into a reservoir nothing settles with. Ownership
remains a single-process invariant. The overflow and ledger-failure branches are
reachable only past bounds the tests do not build, so they are refused by
construction rather than exercised. Nothing is serialized.
The proof golden `d61ad5bf0c928c76`, the ecosystem fingerprint
`2cd4a15f9fbe9949`, the ensemble fingerprint `5ec59d390909b526` and the frozen
genome fixture are unchanged, and the other 33 tests pass untouched. No deployment
manifest or image pin changed. Linux validation is pending; no Gitea result is
claimed since `b01a824`.