Implement M6.5c persisted environmental community and bounded writers

This commit is contained in:
dingo
2026-09-27 13:07:35 -04:00
parent e9ea388cef
commit 364c090bc8
16 changed files with 970 additions and 42 deletions
+5
View File
@@ -451,3 +451,8 @@ and the [process contract](biology/ENVIRONMENTAL_PROCESS.md) specify conversions
source residual policy, temperature gates, synthetic depletion and private resource
checkpoints with process retry history. Next: M6.5c implementation/persistence,
then M6.5d qualification. No rate-enabled runtime exists yet.
M6.5c implemented: complete process envelope and atomic environmental fixture.
Source rates, residuals, last funded interval, lifecycle and exact retry reports now
restore together; retained history is replay-validated against an audit anchor.
Next M6.5d: broader boundary/long-run qualification; M6.5 remains open until it passes.
+18 -1
View File
@@ -61,7 +61,7 @@ for the bounded proof; the general production ECS remains a later measured choic
| Priority | Work | Completion evidence |
|---|---|---|
| 1 | M6.5c implement persisted producer/consumer fixture | Complete rate/biology envelope, then atomic process stepping under ADR-0055 |
| 1 | M6.5d qualify persisted producer/consumer fixture | Broader adversarial bounds, long-run seeds, restored replay and cost evidence |
| Research | Improve aggregate fidelity and measure Linux/target-host costs | M4.6 found no qualifying width; see the aggregate budget report |
| 2 | Revisit the ADR-0031/0032 reproduction cost model | Reproduction is affordable only at the genome schema's floor; decide whether that is intended before M4 builds cohorts on it |
| 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 |
@@ -691,3 +691,20 @@ Next: M6.5c implements the fixture and complete source-rate/biology snapshot bef
exposing advance; M6.5d qualifies it. M6.5 remains incomplete. M2/M3 maintenance,
reproduction and mortality behavior is unchanged; resource starvation is reported
without inventing a new death policy.
## M6.5c persisted environmental fixture (2026-09-27)
Implemented EnvironmentalCommunity: area-bounded finite capture, recipe growth,
organic feeding/waste/heat, source exhaustion and temperature gates, plus whole-tick
rollback and exact retained retries. Rates execute only alongside the complete
[process envelope](../schemas/environmental-community.md), which restores primitive
config, residuals, lifecycle, resources and history and audits retained inputs by
replay from a historical anchor. Existing M2/M3 rules and codecs are unchanged.
The pasted GCC 14 CI log exposed a vector reserve/append diagnostic in the resource
snapshot writer. Both coupled writers now fill exactly sized buffers and check their
final cursor, retaining strict compiler warnings and unchanged resource wire bytes.
Native validation is recorded separately from Linux CI verification.
Next: M6.5d broader qualification (boundary/adversarial cases, long-run seeds and
cost evidence). M6.5 as a whole is not yet marked complete; no deployment changed.
@@ -71,3 +71,9 @@ M6.5c must implement and test the full envelope before exposing advance. M6.5d m
check source-off, resource limits, temperature boundaries, retries, rollback and
restored seeded continuation. Durable publication remains M7. No dependency or
schema implementation is introduced merely to make the repository appear complete.
M6.5c implemented 2026-09-27. One-site staged scalars replace full terrain cloning;
the private checkpoint validates accounting before nonthrowing publication. The
complete envelope includes an audit anchor that permits deterministic replay of the
retained process receipts on restore. See schemas/environmental-community.md and
the process contract for bounds. M6.5d remains the broader qualification gate.
+6
View File
@@ -112,3 +112,9 @@ The process library may depend on world; world must not depend on process or gen
code. Only constrained process operations may create private resource checkpoints.
Complete rate/biology persistence precedes executable stepping in M6.5c. Existing
M2 process interfaces and results remain unchanged.
M6.5c now implements `evo::processes::EnvironmentalCommunity` and its complete
[rate/biology envelope](../../schemas/environmental-community.md). World only exposes
a private conserved checkpoint to this constrained process owner; no genome or
process-type dependency enters the world library. New public stepping lives in the
process layer; existing M2 process interfaces remain unchanged.
+24 -9
View File
@@ -1,13 +1,13 @@
# M6.5 environmental process contract v1
Authority: ADR-0055, ADR-0054, environmental units (ADR-0050), and the scoped
producer/feeding rules (ADRs 0025/0026). **Specified, not implemented.** M6.5b is a
contract segment. M6.5c must implement this contract and the complete buffer codec
before advance is enabled. Coefficients below are fixture inputs, not game rules.
producer/feeding rules (ADRs 0025/0026). **Implemented in M6.5c; broader qualification remains M6.5d.** M6.5b is a
contract segment. M6.5c implements the runtime and complete buffer codec together.
Coefficients below are fixture inputs, not game rules.
## Ownership and interface boundary
One `EnvironmentalCommunity` (working name) owns one coupled resource owner,
One `EnvironmentalCommunity` owns one coupled resource owner,
immutable configuration, progress and process retry receipts. Admission supports
one habitat site and exactly two sorted nonzero actor IDs. Producer and consumer
are configured capabilities, not inheritance classes or permanent species.
@@ -19,13 +19,13 @@ Require all ten fields present, valid material binding and capacities, and a fre
resource owner (command/adoption watermark zero and no history). Reject adopting a
previously advanced independent resource owner: migration is not implied.
Conceptual API, to be finalized with callers/tests in M6.5c:
Public API in `include/evo/processes/environmental_community.hpp`:
- create(config, exclusively owned resources, total peak byte budget) -> expected owner;
- advance(exact next tick, immutable tick input) -> expected report;
- snapshot() -> complete canonical process envelope;
- restore(bytes, expected world, budgets) -> detached validated owner;
- inspect() -> read-only values/views, invalidated at publication.
- resources()/progress() -> read-only resource access and copied progress; views require freshness validation.
No mutable resource getter, user-supplied resource delta, commit callback, external
credit/debit or independent process-state setter. Host access is single-writer.
@@ -39,7 +39,7 @@ sequenceDiagram
participant C as Detached candidate
H->>P: exact tick + bounded input
P->>P: resolve retained exact retry or reject conflict
P->>C: clone complete owned state within peak budget
P->>C: stage scalar balances and progress within peak budget
C->>C: capture then growth then feeding
C->>C: validate conservation, capacity, progress and report
P->>P: publish resources + progress + retry history (noexcept)
@@ -173,8 +173,7 @@ history order/count, latest tick, endpoint/rules references, residual bounds and
resource checkpoint watermark. Reject a bare resource snapshot as a process snapshot.
Do not synthesize absent source or lifecycle state from defaults.
M6.5c must define exact byte fields, bounds and malformed-input validation before
exposing advance. Nothing here grants restart fencing, durable ACKs, disk publication
M6.5c defines exact byte fields and validation in [the envelope schema](../../schemas/environmental-community.md). Nothing here grants restart fencing, durable ACKs, disk publication
or host-loss recovery; those remain M7/M8.
## Hand-checkable acceptance vectors
@@ -199,3 +198,19 @@ zero efficiency, all capacity/overflow bounds, exact retry after restore, more t
64 ticks, malformed snapshots, deterministic seeded input streams and independent
per-channel accounting. No stochastic fairness or RNG is required in the engine;
seeded test drivers record their full input sequence.
## M6.5c implementation detail
For one site, field channels are uniform scalars. Stage all 30 balances, progress,
report and the historical audit anchor in bounded arrays. A private world checkpoint
validates conserved totals and capacities then replaces baselines without allocation;
process progress/history publish immediately afterward without throwing. Terrain is
unchanged. There is no full terrain clone or codec round trip in advance. This refines
the initial cloning baseline above while retaining detached candidate semantics.
Restore replays the 64-tick receipt window from a persisted historical anchor and
compares all reports and final state. The anchor is not spendable. The consumer is
always active in rules v1 (no consumer-death operation exists); producer terminal
state is serialized explicitly. Frame/site, account IDs, source identity and primitive
rate config come from the complete envelope, never missing-state defaults.
+37
View File
@@ -1839,3 +1839,40 @@ all passed. `git diff --check` passed. These are specification checks, not runti
integration tests. No C++/CMake/schema change; builds, CTest and sanitizers were not
rerun for this documentation segment. M6.5c/d must supply executable evidence for
rollback, source exhaustion, temperature limits, lifecycle and restored replay.
## M6.5c persisted environmental community - 2026-09-27
Implemented the one-habitat/two-actor fixture and envelope v1, preserving source
identity/rate, residuals, last funded interval, lifecycle, resources and 64 exact
input/report receipts. Restore replays receipts from a historical anchor, validates
reports and compares the final state. Scalar candidate staging commits without
allocation; the world layer checks capacities and conserved totals before publication.
Executed Windows x64 checks:
- Release check: 53/53 CTests passed, NDEBUG enabled.
- Analysis check: clang-tidy/warnings-as-errors build and 53/53 CTests passed.
- ASan check: 53/53 CTests passed.
- After final tight-budget and continuous/restored comparison additions, analysis
ran all 53 tests again; Release and ASan rebuilt and the two environmental
transfer/community tests passed again.
- Release format check passed. No existing golden changed.
Coverage includes hand-calculated capture/growth/feeding, source disabled/unfunded,
frozen residuals, inclusive temperature gates, terminal producer, whole-tick rollback,
exact/conflicting/expired retries, eight deterministic input sequences through 90
ticks, continuous versus restored bytes/reports, every truncation length, corruption,
recomputed-checksum invalid config/anchor/report/count/state, identity and budgets.
M6.5d remains the broader adversarial, long-run and cost qualification gate.
The supplied Gitea log shows GCC 14 Release rejecting transfer_codec.cpp with
-Werror=free-nonheap-object in the vector reserve/push_back path. Changed that writer
and the new process writer to exactly sized buffers, checked writes and final cursor
validation. No warning suppression or resource format change. The next Gitea run must
confirm Linux: Docker's Linux engine was unavailable locally; WSL Ubuntu exists but
has no g++/g++-14, CMake or Ninja. No toolchain installation was attempted. No local
Linux/UBSan/TSan or cluster result is claimed.
Initial native static analysis flagged an unspecified enum base and integer widening
in a size constant; both corrected before the passing analysis runs. No disk/host-loss
recovery, biological maintenance, reproduction or player/offline progression added.