Files
aevolution/docs/adr/0025-finite-producer-process.md
T
2026-10-08 12:08:53 -04:00

81 lines
4.1 KiB
Markdown

[Reviewed]
# ADR-0025: Finite synthetic producer process
## Status
Adopted for the M2.2 headless process fixture. Not organism biology or live-world
founder creation; genotype/development and player-origin lineage remain later gates.
## Context
The ledger conserves inventories but permits arbitrary transfers. Producer rules
must constrain usable energy, finite source capture, growth costs and rounding,
and commit their own state with inventories. No database is needed for this proof.
## Decision
Add an independently tested `evo::processes` library with `ProducerProcess` owning
one ledger. Four fixed reservoirs hold source energy, nutrient matter, producer
reserve/structure, and heat. Opening source energy and nutrients are explicit;
producer and heat start empty. Inspection is read-only; no arbitrary transfer API
or mutable ledger escapes. Heat never funds capture or growth.
Each exact next logical tick performs capture then growth. Capture quota is
integer picojoules per positive integer number of ticks. Consume at most this
quota and available source energy. A fixed efficiency in thousandths splits the
actual capture into producer reserve and heat. Growth quota is integer recipe
units per positive integer number of ticks. Each recipe unit requires a positive
energy cost and a nonzero C/N/P/other matter bundle; growth is the minimum of its
quota and all available energy/material constraints. Matter moves intact from
nutrients to producer structure; growth energy moves from reserve to heat.
Maintain separate remainder counters for capture rate, growth rate and conversion
efficiency. Quotient/remainder arithmetic avoids wide multiplication and retains
sub-quantum entitlement without floating point. Unfulfilled whole quotas are
discarded; they cannot accumulate while the source or nutrients are exhausted.
Fractional remainders persist. Conversion remainder follows actual captured
energy, never unfunded quota. Remainders are not additional physical inventory.
Compute the report and next remainders first, submit four ordered ledger legs
as one transaction with action ID equal to target tick, then publish scalar state
without throwing. A failed or duplicate/late/future tick changes nothing. The
first tick is 1. No host clock, variable dt, network, persistence or hidden RNG.
ADR-0026 extends ledger action allocation to next-watermark IDs within a shared
community. Standalone action IDs still equal ticks; multiple feeding actions in
a community tick no longer conflict with the next producer step.
One owner provides sequential access. Copies are experiment branches only.
## Alternatives Considered
Public ledger access could recycle heat. Independent process/ledger commits could
lose fractional state or double-fund growth. Floating rates lose exact residuals.
A general dimensional library remains a gate before physical flux/area/time
equations; this fixture only divides already typed inventory quotas by tick
counts and does not choose watts, geometry, photosynthetic chemistry or a game rate.
## Benefits
Finite-source producer behavior, explicit heat losses, exact conserved matter,
resource-limited growth and atomic process/accounting state.
## Costs
One producer and four reservoirs only; no interactions, maintenance, starvation,
reproduction or persistent state format. Full ledger copying per tick remains
the bounded correctness baseline. Efficiency and recipe parameters are synthetic.
## Risks
Conservation alone cannot establish biochemical plausibility. Recipe units are
not cells or organisms. Rate remainder retention is a scoped fixture policy and
must be reviewed for future changing rates or resource replenishment. The finite
source models a prepaid budget, not a star that shuts off when locally depleted.
## Consequences
Tests must cover fractional rates/conversion, 0/100% capture, zero rates, source
and element exhaustion, energy-limited growth, u64 extremes, tick rejection,
copy/replay and independently recomputed conservation. A later process snapshot
must contain all inventories, config, tick and remainders together; M1's snapshot
does not serialize any of this. No production migration/version changes now.