Files
aevolution/docs/adr/0172-cellular-environment-ownership.md
T
dingoandClaude Opus 5.5 4c70257883
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (deploy) (push) Successful in 4m59s
Foundation / checks (network) (push) Successful in 20m56s
Foundation / checks (client) (push) Successful in 22m1s
Foundation / checks (tsan) (push) Successful in 45m41s
Foundation / checks (postgres) (push) Successful in 1h13m35s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 1h20m34s
feat(ecology): own cells and their local environment together
ADR-0172 records the maintainer's M12.5 ownership decision: one owner per
patch of space for cells and their local environment, reserves belonging
to the biological individual, and an open planet boundary whose every
crossing is a recorded import or export.

The portable CellularEnvironment owner (envelope AEVOCEN1) holds an exact
population with tagged water and dissolved compartments, refuses declared
atmosphere, imports infall from finite per-source entitlements (ADR-0136
step B) and radiates retained heat. Each tick's exchange is a validated
swap on the nested owner, undone if the biological tick refuses. Closed
and source-off regions keep their biology byte for byte; raw and cohort
representations agree under infall. No existing format, trace, golden,
default opening or live version changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 16:05:17 -04:00

125 lines
7.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-0172: Cellular environment ownership and open-boundary contract
## Status and scope
Accepted 2026-10-19. The maintainer accepted the single-owner direction of the
[ownership resolution](../engineering/M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md) and
clarified its scope. This ADR is M12.5a: the contract that the portable composite
owner (12.5b) implements. It extends ADR-0136 step B, ADR-0144 and ADR-0157/0165.
No default/live version, durable profile, SQL schema, photosynthesis, atmosphere
or M6 fixture change. ADR-0136 step C remains proposed design input.
## Maintainer clarification
- **One owner per patch of space, at any moment.** It is not one global owner.
A world is many regions, each with exactly one owner of its cells *and* their
local environment. Stock changes owner only through recorded, paired transfers
(ADR-0147–0149 escrow). This carries forward unchanged to the multicellular 3D
world (M13.8/M14): more and larger owners, never two ledgers for one stock.
- **Reserves belong to the biological individual.** A single cell owns its body
and reserve. A colony or multicellular body sharing resources internally is a
later, separately versioned rule (ADR-0135 colonies, M14.2). Nothing here pools
reserves between organisms or forecloses that rule.
- **The planet is an open system.** Resources may enter or leave the region, and
later the planet as a whole. Every crossing is an explicit, versioned process
recorded as a cumulative import or export. Nothing is minted or deleted silently:
`current = opening + imports − exports`, per channel. Exported stock is gone; it
returns only as a new recorded import.
## Decision
`CellularEnvironment` (envelope `AEVOCEN1`, format 1, environment rules 1) takes
exclusive ownership of one exact `CellularPopulation` (raw or cohort; nested owner
7 with rules 8 or 9, or owner 8 with rules 10) and of that region's tagged
environmental compartments. Neither the nested owner nor any copy is separately
spendable while the composite exists. It exposes read-only views only.
### Geometry
One declared axis-aligned habitat inside one environmental voxel: voxel address,
micrometre origin and a box whose width and height equal the cellular area and
whose effective depth is positive (`world::measure_habitat`). Depth defines a
sampling volume for concentration views only; it never creates or scales stock.
Organism count and camera size never determine depth or supply.
### Compartment map, version 1
| Compartment | Owner | Edible | v1 processes |
|---|---|---|---|
| Organic energy, C, N, P, other in deposits, lives, corpses, nursery | nested cellular owner | yes (existing contact feeding) | existing biology; infall import |
| Heat (energy) | nested cellular owner | no | radiative export |
| Water | composite | no | none: conserved, audited, never converted |
| Dissolved inorganic N, P | composite | no | none: conserved, audited, never converted |
| Atmospheric species | unsupported | — | declaring any is refused (`unsupported`), never zero or unlimited |
| Incident light | not stock | — | not represented until a producer process exists |
Cellular `other` means organic other only. `accounting::Inventory` has no water,
dissolved or gas channel, so no generic retag can turn water into food, dissolved
nutrients into edible matter or heat into usable energy. A conversion between
compartments requires a separately versioned process with debit, credit, work,
waste and residual terms. Rules 1 define none.
### Processes, rules 1 (all coefficients are trial values)
1. **Infall import (ADR-0136 step B).** At most four sources, sorted unique
nonzero ids, with disjoint rectangles inside the habitat, a half-open active
tick interval and a finite per-channel **entitlement**. On each advancing tick
`t` in its interval a source fires when a SplitMix64 roll of
`(world, region, source, t)` is divisible by its mean interval (trial 2,400
ticks, two simulated minutes). An event drops `min..max` (trial 12–24) single-
channel bubbles within a 500 µm disc at a seeded centre in the source rectangle,
cycling the channels its per-bubble amount stocks. Each bubble credits
`min(per-bubble amount, remaining entitlement)`. A zero credit, an occupied
address or the 4,096-deposit limit skips that bubble; skips are counted, never
deferred. Credits enter the nested boundary `incoming` and the source's
cumulative `imported`; remaining entitlement is derived, never stored twice.
Exhausted or inactive sources import nothing. Restart, retry and representation
change cannot reset entitlement, because `imported` is persisted.
2. **Radiative heat export.** Each advancing tick exports `min(heat, cap)` pJ of
retained heat (cap per tick is configuration; zero closes the boundary). The
amount enters the nested boundary `outgoing` and the composite's cumulative
export. Heat is never spendable before or after export.
Infall happens only on advancing ticks, so a region that does not tick (offline,
ADR-0128) imports nothing. There is no catch-up credit.
### Tick and atomicity
For advancing tick `t`: derive the exchange from the committed state; apply it to
the nested owner as a validated swap (new habitat, heat and boundary ledger, with
`current = opening + incoming − outgoing` rechecked); then run the unchanged
population tick (shared wildlife controller, controlled intentions, selections).
If the biological tick refuses, the exchange is swapped back and the composite is
byte-for-byte unchanged. Environment progress commits only with the tick. There is
no independently acknowledged environmental or cellular prefix.
### Envelope and versions
The envelope stores identity, completed tick, geometry, compartments, radiation
cap and cumulative export, every source with its cumulative import and event/skip
counters, and the complete nested population envelope, with an FNV-1a64 checksum
and byte-identical re-encoding. A nested owner restored alone must not publish a
joint result. Old cellular formats 6/7/8, rules 8/9/10, population envelopes 1–3,
traces and durable bundles 9–11 keep their exact meaning; none gains fields. The
composite admits only nested owners with a boundary ledger (format 7 or 8).
The nested boundary ledger also carries migration flows (ADR-0144). The composite's
own cumulative import and export distinguish environmental crossings from migration.
## Consequences
The open boundary is auditable: replay re-derives every infall from configuration,
tick and seed, and restore continues from persisted cumulative entitlement. Source-
off, exhausted and open worlds become directly comparable. Producers (photosynthesis)
still require ADR-0136 step C's genome capability, coefficients and a capture
process debiting a declared light entitlement; until then 12.5 is not complete.
Durable publication (12.5c), worker/census/migration integration (12.5d) and target-
host qualification (12.5e) remain separate segments.
## Alternatives
A copied environmental view, reuse of the M6 two-actor fixture, two independently
committed checkpoints and a generic inventory setter remain rejected (see the
resolution). A single global owner was rejected by the maintainer's clarification:
regions scale by count, not by one shared ledger.