Add shared feeding community with atomic resource transfers
This commit is contained in:
+4
-1
@@ -45,7 +45,7 @@ this proof. Production indexing awaits actual interaction workloads.
|
||||
|---|---|---|---|---|---|
|
||||
| 2.1 Ratify accounting units and ledger | accounting/ledger.*, ENERGY_MODEL, ADR-0024 | M1, units ADR | Exact local units/ranges, finite inventories and atomic ordered transfers | Unit-type separation, rollback/overflow/replay, million-transaction independent balance checks | Mistaking conservation for valid biology |
|
||||
| 2.2 Add abiotic source and producer | processes/producer.*, ADR-0025 | 2.1 | Finite source capture, whole growth recipes, carried rate remainders and atomic owned ledger | Closed-box audit, independent fractional reference, finite-resource and arithmetic limits | Confusing synthetic process with organism biology |
|
||||
| 2.3 Add consumer intentions and ingestion | biology/digestion, simulation/spatial | 2.2, 1.7 | Shared validated action path transfers matter/energy | Predator/prey transfer and dead-action rejection | Consuming twice in same tick |
|
||||
| 2.3 Add consumer intentions and ingestion | processes/feeding.*, ADR-0026 | 2.2 | Shared ledger and atomic tick; capped ordered feeding with heat/waste outputs | Predation, contention, rollback, terminal depletion, replay/conservation | Fixture rules becoming gameplay; spatial validation remains separate |
|
||||
| 2.4 Death and decomposition | biology/lifecycle, ecology | 2.3 | Active capability ends; corpse pool transfers conserved nutrients | Death terminality, decomposition limits, ledger audit | Nutrients double counted |
|
||||
| 2.5 Reproduction and wildlife identity | biology/reproduction, genome identity | 2.4, reproduction contract | Sufficient resources required; child consumes parent budget | Insufficient investment, unique ID and ancestry tests | Free offspring or implicit player ownership |
|
||||
| 2.6 Long-run ecosystem fixture | apps/evo-sim, tests/ecosystem, metrics | 2.2–2.5 | Producer→consumer→death→nutrients cycle; report over million ticks | Many seeds, nonnegative balances, measured extinction/diversity | Passing invariants despite uninteresting ecology |
|
||||
@@ -59,6 +59,9 @@ integration requires its own versioned format; it is not provided by M1's codec.
|
||||
M2.2 now supplies the isolated synthetic process contract and implementation.
|
||||
M2.3 must establish interacting process ownership before introducing consumers;
|
||||
the existing fixture is not itself a complete ecosystem or an organism model.
|
||||
M2.3 now supplies this bounded shared ownership and ingestion fixture. M2.4 must
|
||||
retain remaining inventory on death and implement explicit corpse/decomposition
|
||||
flows, rather than relying on M2.3's zero-inventory depletion trigger.
|
||||
|
||||
## M3 — Genome v0.1
|
||||
|
||||
|
||||
+12
-4
@@ -7,7 +7,7 @@ persistent simulation server. The founding vision remains unchanged.
|
||||
## Completed implementation
|
||||
|
||||
- Vision, architectural pillars, risks, open-question register, architecture
|
||||
diagrams, biological contracts, engineering constitution and 25 ADRs.
|
||||
diagrams, biological contracts, engineering constitution and 26 ADRs.
|
||||
Proposed/deferred choices remain distinct from accepted proof decisions.
|
||||
- M0–M4 task breakdowns with dependencies, acceptance evidence and risks,
|
||||
plus M5–M14 gates in [ROADMAP.md](ROADMAP.md).
|
||||
@@ -61,8 +61,8 @@ for the bounded proof; the general production ECS remains a later measured choic
|
||||
|
||||
| Priority | Work | Completion evidence |
|
||||
|---|---|---|
|
||||
| 1 | M2.3 consumer and ingestion contract | Bounded shared process state, validated feeding transfers, waste/heat accounting and terminal activity rules |
|
||||
| 2 | M2.4–2.6 first headless energy cycle | Death → decomposition → nutrients and funded reproduction; seeded million-tick ecosystem evidence |
|
||||
| 1 | M2.4 death and decomposition contract | Terminal activity with remaining inventory, corpse ownership, bounded decomposition and nutrient return |
|
||||
| 2 | M2.5–2.6 first headless energy cycle | Funded reproduction and complete producer/consumer/decomposition cycle; seeded million-tick ecosystem evidence |
|
||||
| Delivery gate | Add/update the dev workload when a deployable increment needs it; Argo is ready | Observe Job/pod completion separately from image publication; no World0 changes |
|
||||
|
||||
M1.6 now implements [the sequential scheduler contract](architecture/SCHEDULER_CONTRACT.md):
|
||||
@@ -105,7 +105,15 @@ hand-calculated outcomes, 32 seeded reference/replay runs, source and nutrient
|
||||
exhaustion, invalid tick/config rejection and u64 arithmetic limits. No organism,
|
||||
genome, database, process snapshot or deployment is implied by this fixture.
|
||||
Native Release, analysis, ASan and format checks passed, and Gitea run 1413
|
||||
passed all Linux checks, ECS, TSan and image jobs. M2.3 is the next increment.
|
||||
passed all Linux checks, ECS, TSan and image jobs.
|
||||
|
||||
M2.3 adds a shared feeding community with one producer and up to 16 consumer
|
||||
capabilities. One ledger owns all process resources, heat and waste. Ordered
|
||||
intake-capped feeding, producer progression and terminal depletion commit as one
|
||||
tick; a rejected request leaves the entire community unchanged. Tests cover
|
||||
predation, resource contention, terminal actors, batch order/replay and conservation.
|
||||
No spatial/perception validation,
|
||||
organism biology, persistent checkpoint or deployment is included in this fixture.
|
||||
|
||||
Before biology, resolve the relevant heredity and energetic contracts rather
|
||||
than treating proof particles as organisms. Exact game tick rate, NPC mutation,
|
||||
|
||||
@@ -39,6 +39,9 @@ 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
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
# ADR-0026: Shared synthetic feeding community
|
||||
|
||||
## Status
|
||||
|
||||
Adopted for bounded M2.3 process fixtures; not biological classes or live-world
|
||||
organism rules. Extends ADR-0025's isolated ownership with one community owner.
|
||||
|
||||
## Context
|
||||
|
||||
Copying producer balances into a consumer ledger would duplicate resources.
|
||||
Producer progress and feeding must commit against one inventory owner.
|
||||
|
||||
## Decision
|
||||
|
||||
`FeedingCommunity` privately owns one ProducerProcess and 1–16 configured consumer
|
||||
capabilities sharing its ledger. A narrow friend boundary permits this owner to
|
||||
construct the larger ledger and orchestrate transfers; no mutable ledger escapes.
|
||||
The standalone producer API and four-reservoir fixture remain compatible.
|
||||
Producer stepping uses the next ledger action watermark rather than assuming one
|
||||
ledger action per tick. The community clock remains the producer's logical tick.
|
||||
|
||||
Reservoirs 1–4 retain source/nutrients/producer/heat. Consumer reservoirs follow;
|
||||
one final reservoir holds unassimilated matter. Process IDs: producer=1, consumers
|
||||
=2 onward. These IDs are fixture identities, not entity handles, species or classes.
|
||||
Opening consumer inventories are explicit experimental budgets; no persistent
|
||||
world founder or biomass is automatically created.
|
||||
|
||||
Each exact-next-tick call accepts at most 16 immutable FeedIntent records, with
|
||||
nonzero unique host sequences. Sort by sequence; at most one feeding request per
|
||||
consumer per tick. This prevents splitting an intake limit into multiple requests.
|
||||
Requests name a distinct active target (producer or another consumer), a nonzero
|
||||
inventory bundle and an active consumer. Each channel must fit the configured
|
||||
intake cap and current target balance. No silently reduced bite. First ordered
|
||||
request gets first access; later overdraft rejects the entire tick.
|
||||
|
||||
Run producer capture/growth first if active, then feeding on a private community
|
||||
copy. Assimilated energy and matter use a fixed configured fraction in thousandths;
|
||||
floor each channel independently with overflow-safe quotient decomposition. Energy
|
||||
remainder goes to heat, matter remainder to waste. This split deliberately has no
|
||||
fractional entitlement carried between bites: integer waste is real inventory.
|
||||
It cannot create an advantage by splitting, but its small-quantity bias must be
|
||||
reviewed before biological tuning. An efficiency of 1000 transfers all, 0 transfers
|
||||
all energy to heat and all matter to waste.
|
||||
|
||||
A target whose entire inventory becomes zero due to feeding becomes terminally
|
||||
inactive. It cannot act, be targeted again or resume capture/growth. This is a
|
||||
synthetic depletion trigger, not a chosen health/starvation rule. Empty opening
|
||||
fixtures may be active; only actual feeding causes this transition. Partial injury,
|
||||
corpses and decomposition remain M2.4. Inactive producer ticks advance the shared
|
||||
clock without advancing its fractional capture/growth state.
|
||||
|
||||
Any invalid command, stale tick, overflow or allocation failure rejects the whole
|
||||
candidate. Publish inventories, activity flags, producer remainders and sorted
|
||||
receipts via noexcept moves only. No current operation resurrects a process.
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
Separate ledgers need escrow and cross-owner transactions; unjustified locally.
|
||||
Public mutation access could recycle heat. Partial per-request commits complicate
|
||||
replay. A generic ECS rewrite or service boundary has no benefit for this fixture.
|
||||
|
||||
## Benefits
|
||||
|
||||
One conserved source of truth, bounded input, deterministic contention, shared
|
||||
capture/feeding atomicity and explicit terminal activity.
|
||||
|
||||
## Costs
|
||||
|
||||
Whole-community copies and small fixed actor/command limits. No spatial gate is
|
||||
implemented: requests are trusted co-located fixture intentions, not network input.
|
||||
Body reserve and material are independently requested, not a complete digestion model.
|
||||
|
||||
## Risks
|
||||
|
||||
This fairness, rounding and depletion policy must not become gameplay by accident.
|
||||
No lineage, perception, authorization or collision rule is implied. A later corpse
|
||||
model must preserve inventories when death occurs before complete depletion.
|
||||
|
||||
## Consequences
|
||||
|
||||
Test order permutations, whole-tick rollback including producer progress, competing
|
||||
feeders, intake bounds, invalid/self/dead targets, terminal actors, heat/waste,
|
||||
efficiency endpoints, arithmetic extremes and repeated conservation/replay.
|
||||
No snapshot, database, renderer or deployment changes. M2.4 must extend this shared
|
||||
ownership model for terminal death with remaining resources and decomposition.
|
||||
@@ -18,6 +18,7 @@ Each record has the eight required sections.
|
||||
0023 defines local periodic neighborhood queries and a measured linear baseline.
|
||||
0024 adopts finite, typed energy/matter inventory transfers for M2.1.
|
||||
0025 scopes finite capture, growth recipes and residual accounting for M2.2.
|
||||
0026 adds shared community ownership and bounded synthetic feeding for M2.3.
|
||||
|
||||
Every dependency adoption records exact version/commit and integrity hash,
|
||||
transitive license obligations, maintenance/security review, owner and removal
|
||||
|
||||
@@ -61,6 +61,10 @@ in the proof. Accounting has an independent tested contract; it is not yet wired
|
||||
into particle state. Future rows are boundaries, not empty directories or dummy services.
|
||||
Split a library when a real independently tested contract exists.
|
||||
|
||||
The processes library now includes a shared feeding community (ADR-0026): producer
|
||||
and consumer reservoirs have one owner, with heat/waste and activity flags committed
|
||||
atomically. Standalone producer fixtures remain available for focused testing.
|
||||
|
||||
## Runtime topology and data flow (target)
|
||||
|
||||
```mermaid
|
||||
|
||||
@@ -146,3 +146,31 @@ do not select photosynthetic chemistry, area, metabolic efficiency, world time
|
||||
or the final units library. No producer state is attached to the particle world,
|
||||
serialized, connected to PostgreSQL or deployed. Later persistent integration
|
||||
must include config, reservoirs, tick and all three remainders in one checkpoint.
|
||||
|
||||
## Implemented M2.3 shared feeding fixture
|
||||
|
||||
[ADR-0026](../adr/0026-shared-feeding-community.md) introduces `FeedingCommunity`,
|
||||
owning one producer and up to 16 consumer capabilities in a single ledger. The
|
||||
producer's standalone interface remains unchanged. A narrow private ownership
|
||||
boundary permits orchestration without exposing arbitrary inventory writes.
|
||||
|
||||
Each tick stages producer activity, then at most one feeding request per consumer
|
||||
in ascending host sequence. Intake limits apply per inventory channel, and a
|
||||
request must be fully available. Assimilated quantities go to the consumer,
|
||||
unassimilated energy to heat, and unassimilated matter to a finite waste reservoir.
|
||||
Every quantity has a counterpart. Floor rounding in feeding goes to real waste/
|
||||
heat, unlike the producer's carried capture entitlement; see the ADR for scope.
|
||||
|
||||
A depleted target becomes inactive only when all its inventory is consumed. It
|
||||
cannot act, be targeted or restart capture. This is a terminal synthetic trigger,
|
||||
not a biological death model. Whole-community staging ensures failed feeding
|
||||
rolls back producer progress, earlier bites, terminal flags and ledger outcomes.
|
||||
The host submits trusted co-located intentions; spatial reach, authenticated input,
|
||||
partial injury, corpses, decomposition and actual organism ancestry are absent.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
P[Producer or consumer target] -->|assimilated energy and matter| C[Consumer]
|
||||
P -->|unassimilated energy| H[Heat]
|
||||
P -->|unassimilated matter| W[Waste inventory]
|
||||
```
|
||||
|
||||
@@ -232,3 +232,21 @@ passed all four jobs for source `af293b8b50cbb506a49dfff10c6cc92307e16aca`:
|
||||
Linux checks, ECS regression, separate TSan and runtime image smoke/publication.
|
||||
The initial push was delayed by a tool approval-review usage limit; retry succeeded
|
||||
after the maintainer resumed work. No deployment image pin was changed.
|
||||
|
||||
## M2.3 shared feeding community (2026-09-20)
|
||||
|
||||
Native Release, clang-tidy and MSVC ASan each passed 8/8 CTests; formatting passed.
|
||||
Commands: `tools/windows-check.ps1 -Preset <release|analysis|asan> -Action check`
|
||||
and Release `-Action format`. The new suite checks hand-calculated capture/feeding,
|
||||
producer-to-consumer and consumer-to-consumer predation, heat/waste outputs,
|
||||
terminal actor rejection, full-tick rollback, competing resource requests,
|
||||
duplicate sequence/consumer admission, per-channel intake caps, invalid actors,
|
||||
config/capacity limits and u64 assimilation endpoints. 32 seeds × 200 ticks compare
|
||||
reordered input batches, receipts, full balances and producer progress, with
|
||||
independently recomputed energy and elemental totals. Standalone producer and
|
||||
existing particle golden tests remain unchanged and passing.
|
||||
|
||||
No serialized recovery, allocation-failure injection, spatial reach/perception,
|
||||
physical injury, corpse handling or persistent-world integration was tested or
|
||||
implemented. These are co-located synthetic process fixtures. Linux CI is pending
|
||||
the source push; no deployment image pin is changed.
|
||||
|
||||
Reference in New Issue
Block a user