Files
aevolution/docs/adr/0056-environmental-terminal-decay.md
2026-10-08 12:08:53 -04:00

62 lines
3.2 KiB
Markdown

[Reviewed]
# ADR-0056: Retained environmental corpses and bounded decay
## Status
Accepted for the M6.6 synthetic fixture, 2026-09-27. Rules 2 extend ADR-0055;
rules 1 and their canonical envelope remain supported without reinterpretation.
## Context
Death must not erase inventory or permit further feeding/growth. Lifecycle,
remaining corpse balances and retries must commit together. ADR-0027 establishes
retained accounts and bounded decay for M2; M6 requires tagged destinations.
## Decision
Input carries two terminal flags, producer then consumer, each 0/1. These are
trusted host facts, not client kill requests or a mortality model. Reject a flag
for an already terminal account on a new tick. Retained exact retries still return
their original report. Apply facts before capture/growth and feeding. A bite
involving either terminal actor rejects the entire tick, including pending deaths.
Emptying a producer by feeding still terminates it.
Keep the original account and capacities, including after it empties. There is no
new spendable corpse copy or resurrection. Read-only balances plus terminal flags
identify corpse inventory. Ten explicit integer per-tick decay caps, default zero,
use field order and are shared across corpses in ascending ID order (producer,
consumer). Unused quota expires; unprocessed inventory survives. These are whole
bounded transfers, not fractional kinetics. There is no decay backlog or fractional
clock. Source/growth rational residuals retain their existing meaning.
Decay runs last. Source fields 0..9 return to environment fields
0,1,2,3,1,2,6,9,8,9 respectively: organic N/P mineralize; organic energy becomes
heat; other compartments keep their tags. Carbon remains prepaid organic carbon.
Water return is additionally bounded by habitat water headroom; residual water
stays in the corpse. Source-channel caps are independent. This gate does not decay
environmental waste or imply decomposer kinetics/reactants. Returned nutrients
become available to growth on the following tick.
Reports include consumer transition and ten summed corpse debits in source field
order. Publish via the existing atomic resource checkpoint. Envelope v2 records
caps, both lifecycle states, terminal inputs and decay reports in its replay audit.
Format must match rules. No in-place migration or automatic organism replacement.
## Alternatives Considered
Deleting accounts loses matter. Separate corpse inventories duplicate ownership.
Fractional rates add state without a selected kinetic model. Reinterpreting v1
silently changes physics. Integer caps follow the existing scoped M2 contract.
## Benefits
Exact conservation, bounded work, recoverable partial decay and unchanged v1 bytes.
## Costs
Two scoped rules/codec versions and larger bounded receipt storage.
## Risks
Synthetic mineralization is not complete chemistry. ID priority is a fixture
policy, not a fairness rule. Terminal facts need future host validation. Retaining
empty accounts remains bounded to two actors.
## Consequences
Test pending-death rollback, inactive actors, shared caps, water blocking, partial
decay/restore, retries, malformed envelopes, history eviction and nutrient-fed
regrowth. Durable publication remains M7; M6.7 schedules intervals.