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:
@@ -29,6 +29,7 @@ materializes anything.
|
||||
| last tick | u64 | The last interval boundary integrated to. Never runs backwards |
|
||||
| revision | u64 | Nonzero. Strictly increases with every replacement within an epoch |
|
||||
| conversion | u64 | The conversion that produced this record. Nonzero provenance |
|
||||
| reservoir | u32 | Nonzero. The ledger reservoir holding this cohort's reserve |
|
||||
| age classes | 1 to 64 | Ordered, disjoint, each non-empty. See below |
|
||||
| approximation bound | count + inventory | Declared, never computed here |
|
||||
|
||||
@@ -73,7 +74,7 @@ error instead.
|
||||
| Rejected | Error |
|
||||
|---|---|
|
||||
| Representation version other than 1 | `unsupported_version` |
|
||||
| Zero habitat, genome, owner worker, owner epoch, revision or conversion | `invalid_identity` |
|
||||
| Zero habitat, genome, owner worker, owner epoch, revision, conversion or reservoir | `invalid_identity` |
|
||||
| No age classes | `no_age_classes` |
|
||||
| More than 64 age classes | `overflow` |
|
||||
| `age_high <= age_low`, or a class overlapping or preceding the one before it | `unordered_age_classes` |
|
||||
@@ -97,6 +98,8 @@ forbidden by convention.
|
||||
| Rejected | Error |
|
||||
|---|---|
|
||||
| Installing a second record for one habitat and genome | `duplicate_cohort` |
|
||||
| Installing a record whose reservoir another record already uses | `duplicate_cohort` |
|
||||
| Replacing with a record naming a different reservoir | `unknown_cohort` |
|
||||
| Replacing a record that is not installed, or naming a different habitat or genome | `unknown_cohort` |
|
||||
| Replacing under a different worker | `wrong_owner` |
|
||||
| Replacing under an older epoch | `stale_epoch` |
|
||||
@@ -120,3 +123,31 @@ no lock, lease or quorum.
|
||||
A cohort is copy-only. A moved-from record would keep its identities and lose its
|
||||
classes, which is the invalid state construction refuses, so the implicit moves
|
||||
are suppressed and a move decays to a copy.
|
||||
|
||||
## Vacancy
|
||||
|
||||
A cohort whose population reached exactly zero has no classes, no members and no
|
||||
reserve. It is built by a separate factory, so vacancy is always deliberate: the
|
||||
ordinary constructor goes on refusing a draft that merely has no classes, which
|
||||
would otherwise become a vacant record by accident.
|
||||
|
||||
| Rejected | Error |
|
||||
|---|---|
|
||||
| Building a vacant record from a draft that has classes | `not_vacant` |
|
||||
| Building an ordinary record from a draft with no classes | `no_age_classes` |
|
||||
|
||||
Vacancy exists because a population declining to exactly zero has to be
|
||||
representable. Without it a caller would have to clamp, which ECOLOGY_MODEL
|
||||
forbids, and rounding a density to zero would become a deletion. A vacant cohort
|
||||
is not an extinction and not an absence: the record, its genome, its habitat, its
|
||||
owner and its provenance all remain, and it stays installed in the registry.
|
||||
|
||||
## Reservoir
|
||||
|
||||
A cohort records which ledger reservoir holds its reserve. The reservoir is bound
|
||||
to the record rather than supplied alongside it, because an advance would
|
||||
otherwise be able to run one cohort's fluxes against another cohort's store, and
|
||||
comparing balances cannot tell two equal reserves apart. The registry refuses two
|
||||
records sharing a reservoir, and a replacement may not move a record to a
|
||||
different one: that would be other inventory holding this cohort, not a later view
|
||||
of this one.
|
||||
|
||||
Reference in New Issue
Block a user