81 lines
4.1 KiB
Markdown
81 lines
4.1 KiB
Markdown
# ADR-0027: Terminal inventory ownership and bounded decomposition
|
|
|
|
## Status
|
|
|
|
Adopted for the M2.4 synthetic community fixture. No biological death cause,
|
|
decomposer organism, biochemical reaction or live-world identity is selected.
|
|
|
|
## Context
|
|
|
|
M2.3 only deactivates targets completely consumed by feeding. Real terminal
|
|
events can leave reserve and structure behind; removing that inventory would
|
|
violate conservation. Nutrient return must have a finite per-tick bound.
|
|
|
|
## Decision
|
|
|
|
Extend `FeedingCommunity::advance` with an optional bounded list of trusted
|
|
`TerminalEvent` facts (process ID only). They are host/system decisions, never
|
|
client kill commands. Admit at most one per process, reject zero/unknown/duplicate
|
|
or already inactive IDs, and apply them before producer activity. A terminated
|
|
producer does not capture or grow in that tick. Existing feeding still rejects
|
|
inactive actors and targets; scavenging is not added in this increment.
|
|
|
|
A dead process's existing ledger reservoir becomes its corpse compartment. There
|
|
is no duplicate corpse inventory and no account ownership; the immutable process
|
|
ID identifies the residual material. `corpse(id)` returns its current inventory
|
|
by value, rejects active/unknown IDs, and returns zero after decomposition. IDs and
|
|
terminal flags remain even when inventory is empty. There is no resurrection API.
|
|
|
|
Tick phases: terminal facts → producer activity → ordered feeding → decomposition
|
|
→ atomic publish. Decomposition drains inactive process reservoirs in ascending
|
|
process ID, then the waste reservoir. Each community has one configured inventory
|
|
budget per tick, shared across all corpses and waste, independently per channel.
|
|
Take min(remaining budget, available inventory). Energy goes only to heat;
|
|
C/N/P/other matter goes unchanged to nutrients. No yield, energy reuse, reactants,
|
|
fractional kinetics or invisible sink is claimed. Nutrients can fund growth next
|
|
tick, not earlier in this same tick. Zero budgets disable the corresponding channel.
|
|
|
|
The cap defaults to zero to preserve M2.3 fixture behavior. Empty corpses do not
|
|
consume budget or ledger actions. Unused budget expires; no backlog accumulates.
|
|
Expose `last_decomposed()` as the committed inventory moved in that tick; it is
|
|
diagnostic state, not an additional owned resource. It resets on each successful
|
|
tick and remains unchanged on failed ticks.
|
|
|
|
All phases run on the existing private candidate. Invalid feeding after a death
|
|
fact rolls back death, producer progress, transfers and diagnostics. Death facts
|
|
are not idempotent acknowledgments: replay of a committed tick or a repeated death
|
|
is rejected. Durable exactly-once history and snapshots remain separate work.
|
|
|
|
## Alternatives Considered
|
|
|
|
Copying into a corpse object risks double counting; moving into a new reservoir
|
|
requires unnecessary allocation/identity lifecycle for this bounded fixture.
|
|
Unbounded instant decay hides the ecological rate constraint. Per-corpse budgets
|
|
scale throughput with corpse count; one shared budget makes this proof's bound
|
|
explicit. A reaction solver requires reactants/stoichiometry not yet defined.
|
|
|
|
## Benefits
|
|
|
|
One owner for every residual quantity, terminal activity, exact conservation and
|
|
a measurable upper bound on nutrient return. A complete return-to-producer path
|
|
can now be tested without implementing reproduction.
|
|
|
|
## Costs
|
|
|
|
Dead process slots are retained. Oldest-ID priority may starve later corpses/waste;
|
|
it is an experimental scheduling rule, not an ecological fairness decision.
|
|
Per-element caps can change residual composition; they are not physical kinetics.
|
|
|
|
## Risks
|
|
|
|
Do not label this as microbial decomposition or use host terminal facts as a
|
|
client-authorized action. Actual death, lineage history, corpse scavenging and
|
|
decomposer capabilities need their own contracts. No synthetic actors seed World0.
|
|
|
|
## Consequences
|
|
|
|
Test death before producer activity, preserved corpse inventories, no dead actions,
|
|
duplicate/stale events, rollback, budget sharing, zero/full caps, exact u64 limits,
|
|
waste decay, returned nutrients funding later growth and repeated conservation.
|
|
No state codec, PostgreSQL connection, renderer or deployment change.
|