Files
aevolution/schemas/region-commit.md
T

5.2 KiB

Region commit manifest contract v1 (M7.1 design)

Authority: ADR-0058 and docs/architecture/REGION_DURABILITY.md. Logical schema, not an implemented wire codec, SQL migration or permission to serialize structs. M7.2 chooses concrete storage types preserving these domains; M7.4 specifies canonical byte encoding and tests before publication. No format may silently truncate u64 to a signed database integer. No credentials or executable URLs.

Field Domain / invariant
manifest_version Exactly 1
world_id, region_id, frame_id Nonzero u64; durable provisioned identities
profile Explicit enum: environmental-v1 initially; unknown values reject
commit_id Opaque globally unique 128-bit request identity, immutable across retries
commit_sequence u64; genesis 0, otherwise predecessor+1 without wrap
predecessor_commit_id / digest Absent only for genesis; otherwise exact committed head
begin_tick / end_tick u64; begin equals predecessor end; 1..64 tick delta except genesis 0/0
holder / epoch Unique holder identity and nonzero u64 acquisition epoch; checked in DB
tick_microseconds Positive u64 matching nested immutable config
version_bundle Exact required rule/schema/generator/coordinate/material versions plus retained build artifact identity
payload_key Opaque immutable store key resolved only in configured namespace
payload_bytes / sha256 Positive length <=1MiB for environmental-v1; 32-byte strong content digest
canonical_request / request_sha256 <=160KiB canonical publication metadata, trace and ordered decisions; binds payload digest and predecessor; SHA-256 is not authentication
validation_trace Complete ordered EnvironmentalInput/Report pairs for each tick in this batch, <=64; included in canonical request identity; <=64KiB separately from decision bytes
decisions <=64, sorted unique durable request IDs, canonical input/result and outcome type; combined request/result <=64KiB
history/outbox rows Deterministically derived from decisions; same transaction and commit reference, stable event IDs
durability_policy Explicit configured profile verified at deployment; no assumed host-loss guarantee

The commit digest is SHA-256 of canonical publication metadata and ordered decisions (excluding the digest itself and DB timestamps). Payload SHA-256 covers the exact uncompressed payload bytes. It is distinct from nested FNV checksums. Use a vetted digest provider selected/pinned in M7.2, never implement crypto here. The build identity refers to an immutable retained artifact and is part of the allowlist; a semver string alone cannot authorize recovery.

Initial payload: complete M6 environmental envelope, rules=2/format=2; nested coupled resources/fields/terrain formats=1 and coordinate/generator/material=1; interval adapter=1 has no payload state. Outer world/frame/end tick must equal nested identity/tick/field revision. Region mapping is manifest-owned and immutable within the provisioned region. Both organism account IDs remain local to that region; a future globally bound profile requires explicit ownership mapping.

environmental-v1 refuses player sessions, reproduction, genome/lineage bindings, population ownership and external transfers. Its permanent outcomes are only the two fixture terminal transitions, identified by region+actor, and recorded atomically with checkpoint state. Ordered accepted host input identifies the cause/request; depletion-derived death uses a deterministic region/tick/actor event identity. The committed predecessor's terminal state cannot become active. Every new terminal transition in the admitted batch requires exactly one outcome; no unchanged/dead actor may yield a new death event. Verify the batch input/report trace against the predecessor during staging and compare its resulting bytes to the uploaded candidate. At <=64 ticks this trace is bounded; this is commit validation, not a retained recovery replay tail. Opaque caller-supplied events alone cannot validate a checkpoint. Persist canonical causal requests in receipts.

Lineage-capable profiles remain unassigned: they require a complete archive codec, organism/genome mappings, allocator state, all phenotype/development progress and random streams actually used. Their durable history includes extinct genomes; they cannot reuse environmental-v1 with missing sections. Implement this extension before claiming the M7 retained-ancestry exit criterion.

Database commit operation: lock lease row; validate holder/epoch/unexpired authority; check commit-ID deduplication and exact canonical bytes; validate expected head; insert manifest + decisions/history/outbox and advance head atomically. For exact previously committed IDs, resolution can return the original immutable receipt without new mutation even under a later epoch. A stale writer cannot use that receipt to obtain current readiness. Changed bytes conflict. No decision may reference a future or uncommitted manifest.

One in-flight commit and fixed metadata/input bounds avoid unbounded ambiguity queues. Genesis uses a distinct provisioning operation, never ordinary recovery. Objects cannot be collected merely because they precede the current head; decision records, archives, clones and backups may still reference them. No GC in initial M7.