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
+12
View File
@@ -119,6 +119,18 @@ reserve, and the destination is proved available before anything moves, so every
rejection leaves both the ledger and the registry exactly as they were. What this
cannot check is that the caller offered every member it had.
M4.3 advances a cohort over one declared interval (ADR-0038) without choosing an
ecology: a model proposes fluxes and this accounts for them, checking that the
declared result is exactly what they imply. Nothing is clamped, because a clamp is
how an interval a model could not integrate becomes a plausible result and how a
false extinction arrives; a loss larger than what is there refuses the interval and
says whether it was the population or the biomass. Counts carry whole members and
owed fractions together, so a population below one member is still a number.
Biomass has no birth term at all, so newborns are necessarily funded from what the
cohort already holds. It amends ADR-0036 twice: a cohort records the reservoir
backing it, and may be vacant, because a decline to exactly zero had to be
representable.
M3.6 closes M3 by making the pieces meet (ADR-0035): `strategy_for` turns a genome
into the `StrategyConfig` the M2.6 driver already takes, founders are pre-diverged
variants of one ancestor admitted to the archive, and `evo-sim --ensemble` runs
+42 -2
View File
@@ -7,7 +7,7 @@ persistent simulation server. The founding vision remains unchanged.
## Completed implementation
- Vision, architectural pillars, risks, open-question register, architecture
diagrams, biological contracts, engineering constitution and 37 ADRs.
diagrams, biological contracts, engineering constitution and 38 ADRs.
Proposed/deferred choices remain distinct from accepted proof decisions.
- M0–M4 task breakdowns with dependencies, acceptance evidence and risks,
plus M5–M14 gates in [ROADMAP.md](ROADMAP.md).
@@ -61,7 +61,7 @@ for the bounded proof; the general production ECS remains a later measured choic
| Priority | Work | Completion evidence |
|---|---|---|
| 1 | M4.3 advance local cohorts | Conservative birth, death, predation and migration accounting per interval |
| 1 | M4.4 materialize representatives | Withdraw exact shares and residuals while preserving genome identity |
| 2 | Revisit the ADR-0031/0032 reproduction cost model | Reproduction is affordable only at the genome schema's floor; decide whether that is intended before M4 builds cohorts on it |
| Delivery gate | Add/update the dev workload when a deployable increment needs it; Argo is ready | Observe Job/pod completion separately from image publication; no World0 changes |
@@ -376,3 +376,43 @@ picojoules against a cohort recording 60, so the cohort's reserve understated wh
backed it and the surplus belonged to nobody. A destination holding anything is
now refused, a cohort's reserve is the whole of its reservoir rather than a part
of it, and the success test asserts that equality directly.
M4.3 advances a cohort over one declared interval (ADR-0038) 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 that 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
names whether it was the population or the biomass, so a caller can subdivide and
retry, and subtraction is checked against what is present rather than performed
and repaired. That is the answer to the milestone's named risk: a clamp is how an
interval a model could not integrate becomes a plausible looking result, and how a
false extinction arrives. Counts carry whole members and owed fractions together,
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 already holds; immigration
draws from a reservoir that already held it, so a late transfer is not new
production either. Conservation runs through the ledger as one atomic transaction,
and an interval in which nothing moves submits none.
Two amendments to M4.1's record were forced rather than chosen. A cohort now
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 refuses two cohorts sharing a reservoir. And a cohort may
be vacant, through a separate factory so vacancy stays deliberate, because a
population declining to exactly zero would otherwise be unrepresentable and the
caller would have to clamp. A vacant cohort is not an extinction: the record, its
genome, its habitat and its provenance all remain and it stays installed.
Limits are stated rather than implied covered. Accounting is not fidelity: closure
is checked, stability is not, so a long interval whose arithmetic closes 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 deliberately discards. Emigration escrows into a reservoir nothing settles
with, since `TransferPopulation` does not exist. All fourteen guards, including
both clamp mutations, were confirmed load-bearing by removing each and observing a
failing run. Native Release, analysis, ASan and formatting passed 36/36; Linux CI
has not run yet.
+8 -1
View File
@@ -2,7 +2,14 @@
## Status
Adopted for M4.1. It defines the tier 2 record and who may act on it, and nothing
Adopted for M4.1, and amended twice by ADR-0038 when M4.3 needed what this record
did not carry. A cohort now records the reservoir backing it, and the registry
refuses two cohorts sharing one. A cohort may also be vacant, holding no classes,
no members and no reserve, through a separate factory so vacancy stays deliberate
and `create` goes on refusing a draft that merely has no classes; without it a
population declining to exactly zero would be unrepresentable and a caller would
have to clamp. Both amendments are described in ADR-0038 and in
`schemas/population-v1.md`. It defines the tier 2 record and who may act on it, and nothing
else: there is no collapse transaction, no population advance, no materialization
and no habitat geometry. Those are M4.2 to M4.4 and each needs its own decision.
No M1 to M3 contract changes. ECOLOGY_MODEL's population math stays an experiment.
+141
View File
@@ -0,0 +1,141 @@
# ADR-0038: Accounting a proposed interval without choosing an ecology
## Status
Adopted for M4.3. It accounts for one declared interval on one cohort and does
not model one: no birth rate, no mortality curve, no functional response and no
carrying capacity is chosen here. Materialization back into individuals is M4.4
and resolution equivalence is M4.5. It amends ADR-0036 in two ways, both forced
by this milestone and described below. No M1 to M3 contract changes.
## Context
ECOLOGY_MODEL is explicit that the population maths is an experiment: it lists
`N_next = N + births - deaths + immigration - emigration`, the matching biomass
identity, and then says to compare bounded flux, seeded stochastic and
deterministic expected-density models. Picking one of those here would turn a
recommendation into a locked game rule, which the working agreement forbids.
What the same document does lock is the arithmetic around whichever model runs:
never hide negative populations with clamps, reject or subdivide unstable
intervals, births redistribute funded investment rather than creating biomass,
predation transfers biomass once and death returns detritus, one owner integrates
each interval, late transfers are not new production, and rounding a density to
zero cannot declare extinction. Those are the contract. The named risk is
numerical instability and false extinctions, and a clamp is exactly how both
arrive: it turns an interval the model could not integrate into a plausible
looking result, and it manufactures an extinction nobody proposed.
## Decision
A model proposes fluxes and this library accounts for them. `plan_advance` takes
the cohort, the interval end, the declared fluxes and the declared resulting age
structure, and checks that the result is exactly what the fluxes imply. It never
computes the result itself, because computing it would mean choosing the model.
Nothing is clamped. A loss larger than what is there refuses the interval and
names whether it was the population or the biomass, so a caller can subdivide and
retry. Subtraction is checked against what is present rather than performed and
repaired afterwards, so a negative value is never constructed in the first place.
Counts are carried in units of `residual_scale`, whole members and owed fractions
together. A population below one member is then a number, not a rounding
decision, and a density falling towards zero stays a density.
Biomass has no birth term at all. A birth cannot bring inventory in because there
is no field by which it could, so newborns are necessarily funded from what the
cohort already holds. This is ECOLOGY_MODEL's rule made structural rather than
documented. Immigration does have a term, and it draws from a reservoir that
already held the inventory, so a late transfer is not new production either.
Conservation runs through the ledger, as in ADR-0037. Each non-empty outflow and
inflow becomes one leg of a single atomic transaction against the cohort's
reservoir, so the conserved total is unchanged by construction. An interval in
which nothing moves submits no transaction at all rather than an empty one.
Commit refuses a proposal computed against a stale view. The installed record
must still be exactly the one the plan started from, down to the revision, and
the reservoir must still hold what the plan counted. Ownership and ordering are
then the registry's existing rules, so one owner integrates each interval and a
late writer cannot install an older view.
This milestone amends ADR-0036 twice, and both amendments are corrections rather
than additions. A cohort now 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 while a balance comparison
could not tell two equal reserves apart. The registry accordingly refuses two
cohorts sharing a reservoir. A cohort may also now be vacant, holding no classes,
no members and no reserve, through a separate factory so vacancy is always
deliberate and `create` goes on refusing a draft that merely has no classes.
Without that, a population declining to exactly zero would be unrepresentable and
a caller would be forced to clamp, which is the thing this ADR exists to prevent.
A vacant cohort is not an extinction: the record, its genome, its habitat and its
provenance all remain.
## Alternatives Considered
Computing the fluxes here from rates would be a model, and would make one of the
candidates ECOLOGY_MODEL wants compared into the only one that exists. Clamping
at zero and reporting a warning was rejected because a warning is not a refusal
and the result would still propagate. Deriving the resulting age structure by
ageing the classes is impossible without the within-class distribution ADR-0036
deliberately discards; asking the caller for it is honest about what the record
knows. Keeping counts in whole members would make a population below one member
round to zero, which the model forbids being read as extinction. Deleting a
cohort that reaches zero would destroy the genome and habitat association that
makes absence recoverable, and is the false extinction named in the risk column.
Threading the reservoir through each request instead of binding it to the record
was rejected above. Letting the advance perform several ledger transactions would
give up atomicity for no gain, since one transaction holds all four legs.
## Benefits
Whatever model runs above this, its arithmetic has to close, and an interval it
cannot integrate fails loudly with enough information to subdivide. Conservation
is the ledger's property rather than a claim. Births cannot create biomass
because there is no way to express it. A population can shrink below one member,
and reach zero, without anything being deleted or declared extinct.
## Costs
The caller supplies the resulting age structure, which is more work than being
handed one and is a modelling decision it must make. Four fluxes plus a structure
is a wide request. A plan holds copies of both cohorts. An interval is accounted
for as a whole, so a caller that needs finer granularity subdivides and pays for
several plans. The residual carried by a class that has fallen below one member
cannot hold reserve, because ADR-0036 gives reserve to members and a fraction is
not one yet; that biomass has to go somewhere the same interval.
## Risks
Accounting is not fidelity. Nothing here says the proposed fluxes are
ecologically reasonable, and a model that conserves exactly can still be wrong in
every other way; M4.5 is where resolution equivalence is measured. The interval
is not checked for stability, only for closure, so a caller can propose a long
interval whose arithmetic closes and whose ecology is nonsense. The declared age
structure is not verified to be what ageing would produce, because that cannot be
checked without the distribution the record does not keep. Emigration escrows
into a reservoir this milestone does not settle with, so a destination cohort
receiving it is `TransferPopulation` and does not exist. Ownership remains a
single-process invariant. Nothing is serialized.
## Consequences
Test that an interval with no flux still advances the clock and submits no ledger
transaction, that births change the population and leave the reserve untouched,
and that death, predation, immigration and emigration each move biomass once to
the right counterparty with the conserved total unchanged. Test that a loss
exceeding the population or any one inventory channel is refused rather than
clamped, at the boundary of a single millionth of a member, and that taking
exactly everything is vacancy rather than refusal. Test that a population below
one member is still a population and that its record stays installed. Test that a
declared result which does not match the fluxes is refused, in both directions,
for counts and for biomass. Test that an empty or backward interval, a foreign
owner and a repeated revision are refused. Test that 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 that one plan cannot be
committed twice. Test over many seeded interval sequences that the conserved
total never moves, that the cohort's reservoir always equals its recorded reserve,
and that both the accepted and the refused paths actually occur. No genome schema,
mutation catalog, archive, ledger, episode driver, ensemble, renderer or
deployment changes.
+1
View File
@@ -30,6 +30,7 @@ Each record has the eight required sections.
0035 derives strategies from genomes and measures them over a split-half gradient.
0036 defines the tier 2 cohort, its declared resolution and exclusive ownership.
0037 collapses individuals into a cohort as one sampled, ledger-exact transaction.
0038 accounts a proposed interval, refusing rather than clamping, without picking a model.
Every dependency adoption records exact version/commit and integrity hash,
transitive license obligations, maintenance/security review, owner and removal
+34
View File
@@ -193,3 +193,37 @@ only the registry's single-ownership rule bounds what that would mean. Durable
conversion sequence numbers, escrow and crash recovery across a process boundary
are M7 and M8; the before-and-after property proved here holds across a rejection
inside one process.
## Implemented M4.3 interval accounting
[ADR-0038](../adr/0038-interval-accounting.md) implements `AdvancePopulation` as
accounting rather than as a model. The population maths above stays an experiment:
no birth rate, mortality curve, functional response or carrying capacity is chosen
here, so none of the candidate models listed above has been made the only one.
What is enforced is the arithmetic around whichever model runs.
Nothing is clamped. A loss larger than what is present refuses the interval and
names whether it was the population or the biomass, so an unstable interval is
rejected and can be subdivided. Subtraction is checked against what is there
rather than performed and repaired, so a negative population is never constructed.
Counts carry whole members and owed fractions as one scaled quantity, so a density
below one member is still a number and rounding it to zero is not available as a
decision. A population that reaches exactly zero becomes a vacant record, which is
neither absence nor extinction: the genome, the habitat, the owner and the
provenance all remain and the record stays installed. Deleting it would have been
the false extinction this milestone is named against.
Births redistribute funded investment because there is no term by which a birth
could bring biomass in. Immigration draws from a reservoir that already held the
inventory, so a late transfer is not new production. Death returns detritus and
predation transfers once, each to a named counterparty, as one atomic ledger
transaction against the cohort's reservoir.
Three gaps are explicit. Closure is checked and stability is not, so an interval
whose arithmetic balances and whose ecology is nonsense is accepted; comparing
matched ensembles and publishing error envelopes is M4.5. The resulting age
structure is supplied by the caller and is not verified to be what ageing would
produce, because ageing across a class boundary needs the within-class
distribution the declared resolution discards. And emigration escrows into a
reservoir nothing settles with, because `TransferPopulation` does not exist.
+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`.