Keep a distribution, because a mean cannot say who survives
M4.1 defines the tier 2 record and who may act on it, and nothing else: no collapse transaction, no population advance, no materialization, no habitat geometry. Those are M4.2 to M4.4 and each needs its own decision. The named risk for this step is that population averages hide viable outliers, which is a property of the record rather than of the maths applied to it later, so it is answered here. Age classes each carry their own count and their own reserve. A count with a mean reserve cannot tell a provisioned cohort from one where half the members hold nothing, and nothing downstream can recover what that discarded. Within a class members are indistinguishable; that is the declared resolution and a stated loss. No accessor returns a mean, because an average that is easy to reach becomes the authority. Totals are summed from the classes rather than stored beside them, following the archive's rule that a second tally is a thing that can disagree. Lineage is not a field at all: ancestry is resolved from the genome through the archive, so a cohort cannot contradict it or invent parentage from membership. Residuals are integer numerators strictly below one member and are never added to a count. Ownership is enforced rather than described. One record per habitat and genome makes no-inventory-spendable-in-two-tiers unrepresentable instead of forbidden, and replacement is refused under a different worker or an older epoch. That is a single-process invariant; fencing between workers is M7 and M10. The approximation bound is carried and never computed, since carrying a bound is not meeting one. All nine guards were confirmed load-bearing by removing each and rerunning. An earlier sweep reporting none of them load-bearing was wrong and discarded: it wrote to /tmp, which Git Bash and PowerShell resolve differently, so nothing was ever mutated. Release 34/34, analysis, ASan 34/34 and clang-format all ran and passed here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
# ADR-0036: Cohort state, declared resolution and exclusive ownership
|
||||
|
||||
## Status
|
||||
|
||||
Adopted for M4.1. 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.
|
||||
|
||||
## Context
|
||||
|
||||
ECOLOGY_MODEL locks two things about tier 2 and leaves the rest recommended: no
|
||||
inventory is spendable in two tiers, and distinct genomes are never averaged into
|
||||
one genome. Everything M4 does afterwards moves inventory between a cohort and
|
||||
individuals, so the record has to exist and has to be checkable before any of that
|
||||
is written. M3 supplies what a cohort is about: a genome that validates, a
|
||||
phenotype that derives from it and an archive that retains its ancestry.
|
||||
|
||||
The named risk for this step is that population averages hide viable outliers. A
|
||||
record holding a count and a mean reserve cannot answer whether anyone in it would
|
||||
survive, because a well-provisioned member and a starving one reduce to the same
|
||||
average. That is a property of the record, not of the maths applied to it later,
|
||||
so it has to be answered here or not at all.
|
||||
|
||||
## Decision
|
||||
|
||||
A `Cohort` is a validated value. `Cohort::create` takes a draft and either returns
|
||||
a cohort meeting every invariant below or an error naming the one it broke; there
|
||||
is no way to assemble one field by field and no way to mutate a field afterwards.
|
||||
|
||||
Age structure is a sequence of classes, each carrying its own count and its own
|
||||
reserve. A cohort therefore stores a distribution and never a mean. Within one
|
||||
class members are indistinguishable, which is a real loss and is the record's
|
||||
declared resolution: the class bounds state it, and a reader that needs finer
|
||||
structure declares narrower classes rather than dividing a total. No accessor
|
||||
returns a mean, because an average that is easy to reach is an average that will
|
||||
be used as the authority.
|
||||
|
||||
Totals are derived by summing the classes, never stored beside them. The lineage
|
||||
archive already establishes this: a second tally is a thing that can disagree.
|
||||
Summation rejects overflow rather than wrapping.
|
||||
|
||||
A cohort names the genome it carries and does not store its lineage. Ancestry is
|
||||
the archive's answer, resolved from the genome, so a cohort cannot claim a
|
||||
parentage the archive would contradict and cannot invent precise parentage from a
|
||||
statistical membership, which ECOLOGY_MODEL forbids.
|
||||
|
||||
Fractional members are carried per class as a residual: an integer numerator over
|
||||
a declared scale, strictly less than one member. Integer arithmetic only, as
|
||||
everywhere else in this project. A residual is owed and not yet present, so it is
|
||||
not a count and is never added to one. Funding it is M4.3's problem.
|
||||
|
||||
Ownership is exclusive and enforced rather than described. A `CohortRegistry`
|
||||
admits at most one cohort per habitat and genome, because two records of the same
|
||||
genome in one habitat would be two places the same biomass could be spent, which
|
||||
is exactly what ECOLOGY_MODEL locks against. Every cohort names an owner and an
|
||||
epoch, and a registry replacement is refused unless it comes from the recorded
|
||||
owner under the recorded epoch and leaves the habitat and genome unchanged. A late
|
||||
writer holding an old view cannot install it.
|
||||
|
||||
Approximation error is a declared field, carried and never computed here. M4.5
|
||||
measures resolution equivalence; a bound this type calculated for itself would be
|
||||
a claim it has no basis for.
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
Storing a count with mean age and mean reserve is smaller and is what the risk
|
||||
warns about: it cannot distinguish a cohort that is fine from one where half the
|
||||
members are about to starve, and no later stage can recover what it discarded.
|
||||
Storing lineage on the cohort would make membership self-describing at the cost of
|
||||
a second ancestry that can drift from the archive's and of inviting invented
|
||||
parentage. Storing totals beside the classes would save a summation and introduce
|
||||
a field that can disagree with the classes it summarises. Floating point would
|
||||
make residuals natural and determinism impossible. Leaving ownership as a
|
||||
documented rule with a field to check would repeat the mistake ADR-0034 corrected:
|
||||
an invariant nothing enforces is an invariant a later change removes quietly.
|
||||
Making the registry own conversion as well would settle M4.2 by implication.
|
||||
|
||||
## Benefits
|
||||
|
||||
The record can answer who is viable, because it never averaged that away. Double
|
||||
ownership of one genome's biomass in one habitat is unrepresentable rather than
|
||||
forbidden. Every total is derived, so no two fields of a cohort can disagree.
|
||||
Ancestry has exactly one authority. Residuals are explicit, bounded and integer,
|
||||
so a fractional member can never be mistaken for an available one.
|
||||
|
||||
## Costs
|
||||
|
||||
A cohort is larger than a count and a mean, and every class costs an inventory.
|
||||
Declaring classes is a modelling decision a caller has to make, and a caller that
|
||||
declares one wide class gets the average it was trying to avoid. Totals cost a
|
||||
summation on every query. The registry is a bounded in-memory container with no
|
||||
persistence, no sharding and no cross-worker protocol; nothing here is serialized.
|
||||
|
||||
## Risks
|
||||
|
||||
A cohort is not evidence that aggregation is ecologically faithful. It holds a
|
||||
declared approximation bound that nothing yet computes or checks, and carrying a
|
||||
bound is not meeting one. The class boundaries are a chosen resolution, and
|
||||
structure finer than one class is genuinely gone. Conservation between a cohort
|
||||
and the rest of the world is the ledger's property and is not asserted by this
|
||||
type, which holds an inventory without participating in any transfer. Ownership
|
||||
here is a single-process invariant: epochs make a stale writer fail locally and
|
||||
say nothing about fencing across workers, which is M7 and M10. Nothing in this
|
||||
ADR says a population may advance, collapse or materialize.
|
||||
|
||||
## Consequences
|
||||
|
||||
Test that a valid cohort round-trips its declared fields, that totals equal the
|
||||
summed classes, and that every invariant is rejected by name: an unsupported
|
||||
representation version, a zero identity, no classes, classes that are unordered,
|
||||
overlapping or empty, a class holding reserve with nothing to hold it, a residual
|
||||
of one member or more, and a summation that would overflow. Test that a registry
|
||||
refuses a second cohort for one habitat and genome, that replacement is refused
|
||||
under a wrong owner, a stale epoch or a changed habitat or genome, and that it
|
||||
succeeds under the recorded owner. Test that a cohort names a genome the archive
|
||||
can resolve ancestry for without storing that ancestry. Negative reserves are not
|
||||
representable, since every quantity here is unsigned; what is rejected instead is
|
||||
a declared state that would require one. No genome schema, mutation catalog,
|
||||
archive, ledger, episode driver, ensemble, renderer or deployment changes.
|
||||
@@ -28,6 +28,7 @@ Each record has the eight required sections.
|
||||
0033 adopts the bounded mutation catalog and uniform seeded candidate draws.
|
||||
0034 adopts the permanent lineage archive and absence that is never extinction.
|
||||
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.
|
||||
|
||||
Every dependency adoption records exact version/commit and integrity hash,
|
||||
transitive license obligations, maintenance/security review, owner and removal
|
||||
|
||||
Reference in New Issue
Block a user