feat(lifecycle): qualify portable maturing wildlife transfers
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (deploy) (push) Successful in 4m12s
Foundation / checks (network) (push) Successful in 20m57s
Foundation / checks (client) (push) Successful in 22m9s
Foundation / checks (tsan) (push) Successful in 28m49s
Foundation / checks (postgres) (push) Successful in 1h5m2s
Foundation / checks (checks) (push) Successful in 1h17m42s
Foundation / postgres-tools (push) Successful in 1m10s
Foundation / server-image (push) Successful in 3m51s
Foundation / image (push) Successful in 4m54s
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (deploy) (push) Successful in 4m12s
Foundation / checks (network) (push) Successful in 20m57s
Foundation / checks (client) (push) Successful in 22m9s
Foundation / checks (tsan) (push) Successful in 28m49s
Foundation / checks (postgres) (push) Successful in 1h5m2s
Foundation / checks (checks) (push) Successful in 1h17m42s
Foundation / postgres-tools (push) Successful in 1m10s
Foundation / server-image (push) Successful in 3m51s
Foundation / image (push) Successful in 4m54s
This commit is contained in:
@@ -25,3 +25,7 @@ limits in docs/engineering/VALIDATION.md. Preserve uncommitted work by others.
|
|||||||
|
|
||||||
After each completed and validated gate segment, commit its scoped changes and push
|
After each completed and validated gate segment, commit its scoped changes and push
|
||||||
to the configured Git remote. Preserve unrelated untracked work; never stage secrets.
|
to the configured Git remote. Preserve unrelated untracked work; never stage secrets.
|
||||||
|
Immediately before each push, refresh REGION_SESSION_WINDOW in
|
||||||
|
deploy/kubernetes/region/dev-session-route/listener.yaml with a unique activation
|
||||||
|
and absolute UTC expiry four hours ahead (ADR-0087). Include it in that push;
|
||||||
|
do not deploy or claim live reachability from a Git update alone.
|
||||||
|
|||||||
@@ -172,7 +172,9 @@ juveniles through adulthood and budding in the same raw/cohort kernel.
|
|||||||
retains both representations and their full recovery evidence.
|
retains both representations and their full recovery evidence.
|
||||||
[Rules-9 census](docs/adr/0159-maturing-cellular-census.md) observes exact growing
|
[Rules-9 census](docs/adr/0159-maturing-cellular-census.md) observes exact growing
|
||||||
stock through verified history and registered snapshots; mixed rule cuts fail.
|
stock through verified history and registered snapshots; mixed rule cuts fail.
|
||||||
Rules-9 migration and autonomous ecological qualification remain separate gates.
|
[Portable rules-9 transfers](schemas/cellular-migration-trace-v2.md) retain exact
|
||||||
|
growing bodies under a distinct replay version. Durable rules-9 migration and
|
||||||
|
autonomous ecological qualification remain separate gates.
|
||||||
The microscope client is the M11 playtest path.
|
The microscope client is the M11 playtest path.
|
||||||
`evo::simulation` remains
|
`evo::simulation` remains
|
||||||
graphics-, network- and database-independent.
|
graphics-, network- and database-independent.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- {name: REGION_SESSION, value: "dev"}
|
- {name: REGION_SESSION, value: "dev"}
|
||||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261017T183218-47482:1792272738"}
|
- {name: REGION_SESSION_WINDOW, value: "dev-20261019T130838-2a437d9d:1792429718"}
|
||||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||||
ports:
|
ports:
|
||||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
# Project status and next steps
|
# Project status and next steps
|
||||||
|
|
||||||
|
## Portable transfer of maturing wildlife - 2026-10-19
|
||||||
|
|
||||||
|
[ADR-0160](adr/0160-portable-maturing-wildlife-transfer.md) qualifies exact
|
||||||
|
portable rules-9 transfer and distinct trace 2 for raw/cohort owners. Real
|
||||||
|
juveniles grow before and after transfer while life fields remain exact at the
|
||||||
|
no-tick boundary. Mixed rules and cross-rule replay fail. Trace 1 retains rules 8;
|
||||||
|
durable adapters and SQL continue to refuse trace 2/bundle 11.
|
||||||
|
|
||||||
|
Native Release passes **81/81**, GCC transfer/restart **2/2**, ASan/UBSan **2/2**,
|
||||||
|
private Release/ASan matrices (**22/63 s**), analysis and formatting. Seven old
|
||||||
|
trace/result/continuation artifacts retain exact bytes. The DEV session window
|
||||||
|
is refreshed in the same commit and future pushes must refresh it; offline
|
||||||
|
rendered policy and all 46 policy self-tests pass. See
|
||||||
|
[validation](engineering/VALIDATION.md). Durable rules-9 migration and remaining
|
||||||
|
ecology/soak/product gates remain open.
|
||||||
|
|
||||||
## Census of funded maturing owners - 2026-10-19
|
## Census of funded maturing owners - 2026-10-19
|
||||||
|
|
||||||
[ADR-0159](adr/0159-maturing-cellular-census.md) admits rules-9/owner-7 retained
|
[ADR-0159](adr/0159-maturing-cellular-census.md) admits rules-9/owner-7 retained
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# ADR-0160: Portable transfer of funded maturing wildlife
|
||||||
|
|
||||||
|
## Status and scope
|
||||||
|
|
||||||
|
Accepted for the scoped M12 portable maturation-transfer prerequisite, 2026-10-19.
|
||||||
|
Extends ADR-0144/0157/0159. No new biological rule, SQL schema, durable migration
|
||||||
|
admission, automatic route, live upgrade or production enablement.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
Allow exact no-tick transfer candidates between owner-7 cuts with equal rules 9,
|
||||||
|
using the same complete group, eligibility, placement, history, identity, stock
|
||||||
|
and boundary-flow checks as rules 8. Raw and population envelope 2 use the same
|
||||||
|
biological operation. Preserve realized growth, body, reserve, damage, mutation
|
||||||
|
state, coordinates and every other life field exactly. Neither endpoint matures
|
||||||
|
at the transfer cut. Subsequent destination ticks apply their retained rules and
|
||||||
|
environment; source nonresident history never owns or grows a second copy.
|
||||||
|
|
||||||
|
Reject mixed rules 8/9 before deriving either result, even at otherwise equal
|
||||||
|
cuts. The existing format-upgrade API remains rules 8 only; moving a rules-9
|
||||||
|
owner does not repeat an upgrade or create another source of biological rules.
|
||||||
|
|
||||||
|
Add portable migration trace 2, magic `AEVMIG02`, version 2. Keep the same bounded
|
||||||
|
layout, request/endpoint/member/inventory fields, reserved zero, checksum and size
|
||||||
|
limit as trace 1. Version 2 means equal rules-9/owner-7 inputs; version 1 retains
|
||||||
|
equal rules-8/owner-7 inputs and its exact bytes. Population inputs use envelope 2.
|
||||||
|
Record selects the version from the supported predecessor rule. Replay requires
|
||||||
|
that exact version/rule pair in addition to the trusted request and complete
|
||||||
|
rederived candidates. Unknown versions, mixed magic/version and cross-rule trace
|
||||||
|
replay fail. No checksum or embedded request grants authority.
|
||||||
|
|
||||||
|
The durable adapter remains bundle 10/trace 1 only, including explicit portable
|
||||||
|
trace-version refusal. A later gate must admit bundle 11/trace 2 through source
|
||||||
|
freeze, destination staging, atomic paired publication and complete recovery,
|
||||||
|
including registered pending-handoff census evidence. Portable support alone
|
||||||
|
must not silently expand those SQL or activation contracts.
|
||||||
|
|
||||||
|
## Alternatives, costs and qualification
|
||||||
|
|
||||||
|
Reusing trace 1 would change a retained rule contract. Copying or re-deriving adult
|
||||||
|
bodies would change actual biomass. Treating transfer as a tick would progress
|
||||||
|
frozen life. A separate migration algorithm risks representation drift. Retain
|
||||||
|
one operation, require equal biological rules and distinguish replay evidence.
|
||||||
|
The additional version adds a small dispatch branch and a second qualification
|
||||||
|
matrix without increasing allocation bounds or dependencies.
|
||||||
|
|
||||||
|
Require real player-origin buds, growth before/after transfer, exact life equality
|
||||||
|
at the cut, raw/cohort equivalence, source nonresident/census exclusion, combined
|
||||||
|
channel conservation, repeated return trips, collision/capacity/eligibility
|
||||||
|
refusal, canonical codec attacks, old bytes, cross-rule refusal and independent
|
||||||
|
process replay/continuation. Run Release, ASan/UBSan, analysis and affected private
|
||||||
|
durable regressions. This does not qualify sustainable generations, linked
|
||||||
|
geometry/environmental budgets, cross-host partitions, actual days or M12 product
|
||||||
|
readiness.
|
||||||
@@ -4,8 +4,11 @@ ADR-0158/schema 53 admits the explicit same-profile bundle-10 -> 11 maturation
|
|||||||
upgrade through the existing immutable version journal and lease/head fence.
|
upgrade through the existing immutable version journal and lease/head fence.
|
||||||
Recovery rederives the complete retained transformation; raw trace 3 and population
|
Recovery rederives the complete retained transformation; raw trace 3 and population
|
||||||
batch 2 keep their layouts. Profile changes preserve the tuple. No new genesis,
|
batch 2 keep their layouts. Profile changes preserve the tuple. No new genesis,
|
||||||
automatic upgrade or default change. Biological migration for rules 9 remains
|
automatic upgrade or default change. Durable biological migration for rules 9
|
||||||
unsupported. [ADR-0159](../adr/0159-maturing-cellular-census.md) admits its exact
|
remains unsupported. [ADR-0160](../adr/0160-portable-maturing-wildlife-transfer.md)
|
||||||
|
adds portable equal-rules-9 transfer candidates and separately identified trace 2;
|
||||||
|
the durable adapter still admits only bundle 10/trace 1.
|
||||||
|
[ADR-0159](../adr/0159-maturing-cellular-census.md) admits its exact
|
||||||
retained stocks to census projection 1 and the existing verified history and
|
retained stocks to census projection 1 and the existing verified history and
|
||||||
registered snapshot readers. Mixed rules-8/rules-9 regional cuts fail the complete
|
registered snapshot readers. Mixed rules-8/rules-9 regional cuts fail the complete
|
||||||
query. Unavailable evidence cannot become zero life. See
|
query. Unavailable evidence cannot become zero life. See
|
||||||
|
|||||||
@@ -42,7 +42,13 @@ need an explicit versioned maturation contract and ecological qualification.
|
|||||||
|
|
||||||
ADR-0157 subsequently supplies opt-in portable rules-9 maturation with a funded
|
ADR-0157 subsequently supplies opt-in portable rules-9 maturation with a funded
|
||||||
multi-generation family proof. These transfer contracts and durable bundle 10
|
multi-generation family proof. These transfer contracts and durable bundle 10
|
||||||
remain rules 8; they refuse rules-9 migration until separately qualified.
|
originally remained rules 8. ADR-0160 subsequently qualifies portable owner-7
|
||||||
|
transfers between equal rules-9 cuts with distinct trace 2. It preserves every
|
||||||
|
realized growth/body/reserve field without a tick and rejects mixed rules.
|
||||||
|
Real juveniles grow before and after transfer with finite declared destination
|
||||||
|
food; raw/cohort biology and recorded continuation agree. Rules-8 trace 1 retains
|
||||||
|
its bytes and meaning. Durable bundle-11/trace-2 admission, pending freeze/staging,
|
||||||
|
atomic paired publication and complete recovery remain a separate gate.
|
||||||
|
|
||||||
This is not the durable escrow gate. No prepared candidate may become an active
|
This is not the durable escrow gate. No prepared candidate may become an active
|
||||||
destination owner before a future fenced transaction commits both heads and
|
destination owner before a future fenced transaction commits both heads and
|
||||||
|
|||||||
@@ -124,6 +124,14 @@ checked. Mixed rules 8/9, unavailable objects/builds and stale grants refuse the
|
|||||||
complete query. No new SQL schema, redundant census journal or biological rule.
|
complete query. No new SQL schema, redundant census journal or biological rule.
|
||||||
This does not close viable-store reconciliation, extinction or M12 ecology gates.
|
This does not close viable-store reconciliation, extinction or M12 ecology gates.
|
||||||
|
|
||||||
|
ADR-0160 qualifies portable transfer between equal rules-9/owner-7 cuts and
|
||||||
|
separately identified migration trace 2. No transfer tick, growth reset or stock
|
||||||
|
re-derivation is introduced; real pre/post-transfer growth, exact raw/cohort
|
||||||
|
biology, replay/process continuation and refusal matrices are checked. Trace 1
|
||||||
|
retains rules 8. The durable adapter still rejects trace 2/bundle 11: explicit
|
||||||
|
freeze/stage/paired publication/recovery and registered pending-handoff census
|
||||||
|
qualification are required before rules-9 durable migration is supported.
|
||||||
|
|
||||||
M12.6a's [regional census projection](../../schemas/ecology/regional-cellular-census-v1.md)
|
M12.6a's [regional census projection](../../schemas/ecology/regional-cellular-census-v1.md)
|
||||||
independently implements local current-genome and descendant-closure queries.
|
independently implements local current-genome and descendant-closure queries.
|
||||||
It keeps suspended stock and retained zero-carrier ancestry, separates exact cohort
|
It keeps suspended stock and retained zero-carrier ancestry, separates exact cohort
|
||||||
|
|||||||
@@ -1,5 +1,69 @@
|
|||||||
# Validation report
|
# Validation report
|
||||||
|
|
||||||
|
## 2026-10-19 - Portable transfer of maturing wildlife
|
||||||
|
|
||||||
|
[ADR-0160](../adr/0160-portable-maturing-wildlife-transfer.md) admits exact
|
||||||
|
portable transfer between equal rules-9/owner-7 cuts, raw or population envelope
|
||||||
|
2. Migration trace 2 has distinct magic/version and the existing bounded layout.
|
||||||
|
Trace 1 retains rules 8. Durable metadata/retry adapters explicitly refuse trace
|
||||||
|
2; SQL schema 53 and bundle-10 migration admission remain unchanged.
|
||||||
|
|
||||||
|
Executed locally:
|
||||||
|
|
||||||
|
- MSVC default Release full CTest **81/81 passed, 22.13 s**, with NDEBUG.
|
||||||
|
- GCC 14 Release migration contract/process restart **2/2 passed, 3.29 s**.
|
||||||
|
- Clang 19 ASan/UBSan migration contract/process restart **2/2 passed, 87.00 s**,
|
||||||
|
without sanitizer reports.
|
||||||
|
- The complete affected private PostgreSQL population/history/migration fault
|
||||||
|
matrix passed **exit 0, 22 s** (19 s population). The same ASan/UBSan matrix
|
||||||
|
passed **exit 0, 63 s** (60 s population), without reports.
|
||||||
|
- clang-tidy 19 passed on cellular lives, transfer, trace and durable migration
|
||||||
|
sources and both affected tests. Repository clang-format 19 and
|
||||||
|
`git diff --check` passed.
|
||||||
|
- Seven retained rules-8 restart artifacts from the preceding native run match
|
||||||
|
byte-for-byte: raw/cohort trace 1, both complete output pairs and the continued
|
||||||
|
population snapshot. No old golden or numbered SQL migration changed.
|
||||||
|
|
||||||
|
Rules-9 repeats the raw transfer/census/conservation matrix, 100 return trips,
|
||||||
|
imported death/decay, body-overlap refusal, whole-group capacity refusal and the
|
||||||
|
complete raw/cohort codec/replay matrix. Every transferred life field remains
|
||||||
|
equal at the no-tick cut. Cross-rule replay, mixed magic/version, unknown version,
|
||||||
|
malformed bounds, altered members/material and incompatible trusted requests
|
||||||
|
fail. Fresh processes restore/replay both rule versions in both representations,
|
||||||
|
then reproduce the exact recorded 64-tick destination continuation.
|
||||||
|
|
||||||
|
A separate real-bud fixture verifies funded growth before transfer, exact
|
||||||
|
raw/cohort candidate biology, and further funded growth after transfer. Finite
|
||||||
|
destination food is declared in its opening fixture; no reserve/body credit or
|
||||||
|
reusable boundary-flow stock is granted. Complete combined per-channel stock
|
||||||
|
closes and destination growth retains the unchanged transfer ledger. Mixed rules
|
||||||
|
in either raw direction and in cohorts fail; vulnerable controlled life remains
|
||||||
|
ineligible. Rules-9 cannot repeat the old format-upgrade API.
|
||||||
|
|
||||||
|
Private raw/cohort durable tests additionally submit canonical trace 2 to retry
|
||||||
|
freeze/stage, direct staging and SQL source preparation. C++ refuses it before
|
||||||
|
publication; SQL independently returns 22023 before duplicate lookup. Existing
|
||||||
|
rules-8 freeze/stage/commit and rules-9 census regressions continue to pass.
|
||||||
|
The initial new codec-tampering fixture triggered GCC's optimized bounds warning;
|
||||||
|
using checked vector access resolved it before the complete qualification above.
|
||||||
|
|
||||||
|
Per maintainer instruction, the DEV route's `REGION_SESSION_WINDOW` is refreshed
|
||||||
|
in this same scoped commit, with a unique UTC activation and a four-hour absolute
|
||||||
|
expiry. Rendered deployment policy passes **75 objects / 74 files, 138 rendered
|
||||||
|
objects / 17 overlays, 0 failures**. The working agreement now requires a refresh
|
||||||
|
before every push. Deployment-policy self-tests pass **46 cases, 0 failures**,
|
||||||
|
including rejection of overlong windows; the final fresh window also passes the
|
||||||
|
rendered policy check. This is desired Git configuration, not a live connectivity or
|
||||||
|
Argo application observation.
|
||||||
|
|
||||||
|
The full backup/DR, TLS relay and SQL privilege/checksum suite was not repeated;
|
||||||
|
no SQL, durable publication layout or transport algorithm changed. Temporary
|
||||||
|
private Unix-socket databases were used; no live database, deployment or World0
|
||||||
|
operation occurred. TSan was not rerun because shared-memory scheduling did not
|
||||||
|
change. Durable rules-9 migration, linked environmental resources/geometry,
|
||||||
|
autonomous generations, target-host costs, actual days and product gates remain
|
||||||
|
open; this portable prerequisite does not complete M12.
|
||||||
|
|
||||||
## 2026-10-19 - Census of funded maturing owners
|
## 2026-10-19 - Census of funded maturing owners
|
||||||
|
|
||||||
[ADR-0159](../adr/0159-maturing-cellular-census.md) admits rules 9/owner 7,
|
[ADR-0159](../adr/0159-maturing-cellular-census.md) admits rules 9/owner 7,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct CellularMigrationFailure {
|
|||||||
// Verify both complete cuts and the paired biology, retain a verified destination
|
// Verify both complete cuts and the paired biology, retain a verified destination
|
||||||
// replay capsule in the source namespace, then freeze the exact source head.
|
// replay capsule in the source namespace, then freeze the exact source head.
|
||||||
// Neither candidate is published or activated by this operation.
|
// Neither candidate is published or activated by this operation.
|
||||||
|
// Durable migration remains bundle 10/trace 1; portable trace 2 is refused.
|
||||||
[[nodiscard]] std::expected<CellularMigrationFreeze, CellularMigrationFailure>
|
[[nodiscard]] std::expected<CellularMigrationFreeze, CellularMigrationFailure>
|
||||||
prepare_cellular_migration_freeze(Postgres&, const FilesystemObjectStore& source_objects,
|
prepare_cellular_migration_freeze(Postgres&, const FilesystemObjectStore& source_objects,
|
||||||
const FilesystemObjectStore& destination_objects,
|
const FilesystemObjectStore& destination_objects,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ struct CellularPopulationMigrationExecution {
|
|||||||
// This chooses neither a route nor a movement. It preserves every coordinate and
|
// This chooses neither a route nor a movement. It preserves every coordinate and
|
||||||
// biological field, imports the complete genome ancestry and moves actual stock.
|
// biological field, imports the complete genome ancestry and moves actual stock.
|
||||||
// Publication must commit the pair under both current fences before activation.
|
// Publication must commit the pair under both current fences before activation.
|
||||||
|
// ADR-0160: owner 7, equal rules 8 or equal rules 9; mixed rules fail.
|
||||||
class CellularMigration {
|
class CellularMigration {
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static std::expected<CellularMigrationExecution, CellularMigrationError>
|
[[nodiscard]] static std::expected<CellularMigrationExecution, CellularMigrationError>
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ struct CellularMigrationTrace {
|
|||||||
CellularMigrationRequest request;
|
CellularMigrationRequest request;
|
||||||
accounting::Inventory transferred;
|
accounting::Inventory transferred;
|
||||||
std::vector<std::uint64_t> members;
|
std::vector<std::uint64_t> members;
|
||||||
|
// Trace 1 retains rules 8; trace 2 requires rules 9. Both require owner 7.
|
||||||
|
std::uint32_t format_version{1};
|
||||||
bool operator==(const CellularMigrationTrace&) const = default;
|
bool operator==(const CellularMigrationTrace&) const = default;
|
||||||
};
|
};
|
||||||
inline constexpr std::size_t migration_trace_header_bytes = 256;
|
inline constexpr std::size_t migration_trace_header_bytes = 256;
|
||||||
@@ -40,6 +42,7 @@ struct RecordedPopulationMigration {
|
|||||||
// Portable recorded pair, not a receipt or ownership grant. The I/O adapter must
|
// Portable recorded pair, not a receipt or ownership grant. The I/O adapter must
|
||||||
// establish the trusted request against BOTH immutable predecessor manifests and
|
// establish the trusted request against BOTH immutable predecessor manifests and
|
||||||
// digest-checked payloads, then fence/commit both results before activation.
|
// digest-checked payloads, then fence/commit both results before activation.
|
||||||
|
// Portable trace 2 does not extend the durable bundle-10/trace-1 allowlist.
|
||||||
[[nodiscard]] std::expected<RecordedCellularMigration, CellularMigrationError>
|
[[nodiscard]] std::expected<RecordedCellularMigration, CellularMigrationError>
|
||||||
prepare_migration_trace(const CellularLives&, const CellularLives&,
|
prepare_migration_trace(const CellularLives&, const CellularLives&,
|
||||||
const CellularMigrationRequest&);
|
const CellularMigrationRequest&);
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ allows only the existing fenced entry points. Earlier migration bytes are intact
|
|||||||
No live/default auto-upgrade or new provisioning mode. An explicitly upgraded
|
No live/default auto-upgrade or new provisioning mode. An explicitly upgraded
|
||||||
owner can recover and continue raw/cohort biology, including interval admission,
|
owner can recover and continue raw/cohort biology, including interval admission,
|
||||||
settlement and materialization before returning-player operations. Biological
|
settlement and materialization before returning-player operations. Biological
|
||||||
migration remains bundle 10 only. ADR-0159 subsequently admits rules-9 retained
|
durable migration remains bundle 10 only. ADR-0160 qualifies portable equal-rules-9
|
||||||
|
candidates/trace 2 without extending that admission. ADR-0159 admits rules-9 retained
|
||||||
body/reserve to census projection 1 and the verified history/registered snapshot
|
body/reserve to census projection 1 and the verified history/registered snapshot
|
||||||
readers. Mixed rule cuts or unavailable evidence prevent a complete result and
|
readers. Mixed rule cuts or unavailable evidence prevent a complete result and
|
||||||
cannot prove zero life or terminal extinction. Ecology/environment/actual-days/product
|
cannot prove zero life or terminal extinction. Ecology/environment/actual-days/product
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# Exact paired biological transfer trace 1
|
# Exact paired biological transfer trace 1
|
||||||
|
|
||||||
|
Follow-on [trace 2](cellular-migration-trace-v2.md) supports portable rules-9
|
||||||
|
transfers. Trace 1 remains rules 8 with the exact layout and bytes below.
|
||||||
|
|
||||||
Authority: ADR-0144. Portable replay evidence only; no durable manifest admission,
|
Authority: ADR-0144. Portable replay evidence only; no durable manifest admission,
|
||||||
ownership receipt or activation authority. This is separate from the M10 probe,
|
ownership receipt or activation authority. This is separate from the M10 probe,
|
||||||
normal cellular tick traces and population batch 1. It is not a migration route.
|
normal cellular tick traces and population batch 1. It is not a migration route.
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Exact paired biological transfer trace 2
|
||||||
|
|
||||||
|
Authority: [ADR-0160](../docs/adr/0160-portable-maturing-wildlife-transfer.md).
|
||||||
|
Portable replay only. Durable freeze/stage/paired publication remains bundle
|
||||||
|
10/trace 1 and explicitly refuses this version; no ownership grant is added.
|
||||||
|
|
||||||
|
Use the exact bounded [trace-1 layout](cellular-migration-trace-v1.md), with these
|
||||||
|
two changes:
|
||||||
|
|
||||||
|
| Offset | Bytes | Value |
|
||||||
|
|---:|---:|---|
|
||||||
|
| 0 | 8 | ASCII magic `AEVMIG02` |
|
||||||
|
| 8 | 4 | Version, exactly 2 |
|
||||||
|
|
||||||
|
Version 2 requires equal rules-9/owner-7 predecessors in both regions. Raw
|
||||||
|
representation 1 uses those owners directly; population representation 2 uses
|
||||||
|
envelope 2. Trace 1 retains equal rules 8 and its exact old bytes. Never infer the
|
||||||
|
rule from a current head, accept mixed predecessor rules, or pair one version's
|
||||||
|
magic with another version number. Unknown versions fail before allocation.
|
||||||
|
|
||||||
|
All other fields and bounds are unchanged: positive common completed cut, stable
|
||||||
|
trusted request, both endpoint predecessor digests/result identities, exact
|
||||||
|
whole-genome member set, transferred energy/C/N/P/other, zero reserved field,
|
||||||
|
canonical little-endian re-encoding and final FNV-1a64. Maximum size remains
|
||||||
|
2,312 bytes. The I/O layer still owes manifest/payload SHA-256 validation.
|
||||||
|
|
||||||
|
Preparation/replay preserves every realized growth/body/reserve/damage/choice
|
||||||
|
field at the no-tick cut. It neither spends food nor runs maturation. Ordinary
|
||||||
|
destination intervals continue the retained rules-9 kernel and boundary ledger.
|
||||||
|
Source nonresident history owns no inventory and never grows another copy.
|
||||||
|
Newly spent construction energy becomes heat under ADR-0157, not migration flow.
|
||||||
|
|
||||||
|
Qualification includes real growth before and after transfer, raw/cohort exact
|
||||||
|
biology, repeated returns, stock/census closure, placement/capacity/eligibility
|
||||||
|
refusals, codec tampering and independent-process raw/cohort pair and interval
|
||||||
|
continuation. A later durable gate must explicitly admit trace 2 with bundle 11,
|
||||||
|
source freeze, staged ghost, atomic paired receipt, recovery and pending-handoff
|
||||||
|
census evidence. Nothing here enables routing or claims sustainable ecology.
|
||||||
@@ -86,8 +86,8 @@ bool cuts(const CheckpointManifest& s, const CheckpointManifest& d,
|
|||||||
const auto profile = t.representation == server::CellularMigrationRepresentation::individual
|
const auto profile = t.representation == server::CellularMigrationRepresentation::individual
|
||||||
? CheckpointProfile::cellular_lives_v1
|
? CheckpointProfile::cellular_lives_v1
|
||||||
: CheckpointProfile::cellular_population_v1;
|
: CheckpointProfile::cellular_population_v1;
|
||||||
return supported(s) && supported(d) && encode_manifest(s) && encode_manifest(d) &&
|
return t.format_version == 1 && supported(s) && supported(d) && encode_manifest(s) &&
|
||||||
s.cellular_versions == cellular_v10_versions &&
|
encode_manifest(d) && s.cellular_versions == cellular_v10_versions &&
|
||||||
d.cellular_versions == cellular_v10_versions && s.profile == profile &&
|
d.cellular_versions == cellular_v10_versions && s.profile == profile &&
|
||||||
d.profile == profile && s.sequence > 0 && d.sequence > 0 &&
|
d.profile == profile && s.sequence > 0 && d.sequence > 0 &&
|
||||||
s.key == RegionKey{t.world, t.request.source.region} &&
|
s.key == RegionKey{t.world, t.request.source.region} &&
|
||||||
@@ -145,7 +145,8 @@ std::expected<CellularMigrationFreeze, CellularMigrationFailure>
|
|||||||
retry_cellular_migration_freeze(Postgres& db, const LeaseGrant& lease,
|
retry_cellular_migration_freeze(Postgres& db, const LeaseGrant& lease,
|
||||||
const CellularMigrationPrepared& prepared, milliseconds timeout) {
|
const CellularMigrationPrepared& prepared, milliseconds timeout) {
|
||||||
const auto trace = server::decode_migration_trace(prepared.trace);
|
const auto trace = server::decode_migration_trace(prepared.trace);
|
||||||
if (!trace || prepared.key != RegionKey{trace->world, trace->request.source.region} ||
|
if (!trace || trace->format_version != 1 ||
|
||||||
|
prepared.key != RegionKey{trace->world, trace->request.source.region} ||
|
||||||
lease.frame != trace->frame)
|
lease.frame != trace->frame)
|
||||||
return std::unexpected(failed(PublicationError::candidate));
|
return std::unexpected(failed(PublicationError::candidate));
|
||||||
const std::array<std::string, 5> args{std::to_string(prepared.key.world),
|
const std::array<std::string, 5> args{std::to_string(prepared.key.world),
|
||||||
@@ -340,7 +341,8 @@ retry_cellular_migration_stage(Postgres& db, const LeaseGrant& lease,
|
|||||||
const CellularMigrationStagePrepared& prepared,
|
const CellularMigrationStagePrepared& prepared,
|
||||||
milliseconds timeout) {
|
milliseconds timeout) {
|
||||||
const auto trace = server::decode_migration_trace(prepared.trace);
|
const auto trace = server::decode_migration_trace(prepared.trace);
|
||||||
if (!trace || prepared.key != RegionKey{trace->world, trace->request.destination.region} ||
|
if (!trace || trace->format_version != 1 ||
|
||||||
|
prepared.key != RegionKey{trace->world, trace->request.destination.region} ||
|
||||||
lease.frame != trace->frame || prepared.ghost.sha256 == Sha256Digest{} ||
|
lease.frame != trace->frame || prepared.ghost.sha256 == Sha256Digest{} ||
|
||||||
prepared.ghost.bytes == 0)
|
prepared.ghost.bytes == 0)
|
||||||
return std::unexpected(stage_failed(PublicationError::candidate));
|
return std::unexpected(stage_failed(PublicationError::candidate));
|
||||||
|
|||||||
@@ -679,7 +679,9 @@ std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
|||||||
CellularLives::migration_replacement(std::vector<CellularOwnedLife> living,
|
CellularLives::migration_replacement(std::vector<CellularOwnedLife> living,
|
||||||
const biology::LineageArchive& archive,
|
const biology::LineageArchive& archive,
|
||||||
CellularBoundaryLedger boundary) const {
|
CellularBoundaryLedger boundary) const {
|
||||||
if (state_->rules_version != cellular_lives_foraging_rules ||
|
if ((state_->rules_version != cellular_lives_foraging_rules &&
|
||||||
|
!(state_->rules_version == cellular_lives_maturation_rules &&
|
||||||
|
state_->format_version == cellular_lives_migration_format)) ||
|
||||||
(state_->format_version != cellular_lives_presence_format &&
|
(state_->format_version != cellular_lives_presence_format &&
|
||||||
state_->format_version != cellular_lives_migration_format))
|
state_->format_version != cellular_lives_migration_format))
|
||||||
return std::unexpected(CellularLivesError::version);
|
return std::unexpected(CellularLivesError::version);
|
||||||
@@ -709,6 +711,8 @@ CellularLives::migration_replacement(std::vector<CellularOwnedLife> living,
|
|||||||
|
|
||||||
std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
||||||
CellularLives::migration_upgrade_candidate() const {
|
CellularLives::migration_upgrade_candidate() const {
|
||||||
|
if (state_->rules_version != cellular_lives_foraging_rules)
|
||||||
|
return std::unexpected(CellularLivesError::version);
|
||||||
return migration_replacement(state_->lives, state_->archive, state_->boundary);
|
return migration_replacement(state_->lives, state_->archive, state_->boundary);
|
||||||
}
|
}
|
||||||
std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ CellularMigration::prepare(const CellularLives& source, const CellularLives& des
|
|||||||
std::uint64_t genome) {
|
std::uint64_t genome) {
|
||||||
if (source.format_version() != cellular_lives_migration_format ||
|
if (source.format_version() != cellular_lives_migration_format ||
|
||||||
destination.format_version() != cellular_lives_migration_format ||
|
destination.format_version() != cellular_lives_migration_format ||
|
||||||
source.rules_version() != cellular_lives_foraging_rules ||
|
(source.rules_version() != cellular_lives_foraging_rules &&
|
||||||
destination.rules_version() != cellular_lives_foraging_rules)
|
source.rules_version() != cellular_lives_maturation_rules) ||
|
||||||
|
destination.rules_version() != source.rules_version())
|
||||||
return std::unexpected(CellularMigrationError::version);
|
return std::unexpected(CellularMigrationError::version);
|
||||||
if (genome == 0 || source.world() != destination.world() ||
|
if (genome == 0 || source.world() != destination.world() ||
|
||||||
source.region() > cellular_bud_max_region ||
|
source.region() > cellular_bud_max_region ||
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
namespace evo::server {
|
namespace evo::server {
|
||||||
namespace {
|
namespace {
|
||||||
constexpr std::array<std::uint8_t, 8> magic{'A', 'E', 'V', 'M', 'I', 'G', '0', '1'};
|
constexpr std::array<std::uint8_t, 8> magic{'A', 'E', 'V', 'M', 'I', 'G', '0', '1'};
|
||||||
|
constexpr std::array<std::uint8_t, 8> maturing_magic{'A', 'E', 'V', 'M', 'I', 'G', '0', '2'};
|
||||||
template <typename T> bool zero(const T& bytes) {
|
template <typename T> bool zero(const T& bytes) {
|
||||||
return std::ranges::all_of(bytes, [](auto byte) { return byte == 0; });
|
return std::ranges::all_of(bytes, [](auto byte) { return byte == 0; });
|
||||||
}
|
}
|
||||||
@@ -23,7 +24,8 @@ bool valid_request(const CellularMigrationRequest& request) {
|
|||||||
return std::ranges::adjacent_find(ids) == ids.end();
|
return std::ranges::adjacent_find(ids) == ids.end();
|
||||||
}
|
}
|
||||||
bool shape(const CellularMigrationTrace& trace) {
|
bool shape(const CellularMigrationTrace& trace) {
|
||||||
if ((trace.representation != CellularMigrationRepresentation::individual &&
|
if ((trace.format_version != 1 && trace.format_version != 2) ||
|
||||||
|
(trace.representation != CellularMigrationRepresentation::individual &&
|
||||||
trace.representation != CellularMigrationRepresentation::population) ||
|
trace.representation != CellularMigrationRepresentation::population) ||
|
||||||
trace.world == 0 || trace.frame == 0 || trace.tick == 0 || !valid_request(trace.request) ||
|
trace.world == 0 || trace.frame == 0 || trace.tick == 0 || !valid_request(trace.request) ||
|
||||||
trace.transferred == accounting::Inventory{} || trace.members.empty() ||
|
trace.transferred == accounting::Inventory{} || trace.members.empty() ||
|
||||||
@@ -55,6 +57,8 @@ record(const Owner& source, const Owner& destination, const CellularMigrationReq
|
|||||||
CellularMigrationTrace trace{
|
CellularMigrationTrace trace{
|
||||||
representation, state(source)->world(), state(source)->frame(), state(source)->tick(),
|
representation, state(source)->world(), state(source)->frame(), state(source)->tick(),
|
||||||
request, execution->transferred, execution->members};
|
request, execution->transferred, execution->members};
|
||||||
|
trace.format_version =
|
||||||
|
state(source)->rules_version() == cellular_lives_maturation_rules ? 2 : 1;
|
||||||
if (!shape(trace))
|
if (!shape(trace))
|
||||||
return std::unexpected(CellularMigrationError::format);
|
return std::unexpected(CellularMigrationError::format);
|
||||||
return Recorded{std::move(trace), std::move(*execution)};
|
return Recorded{std::move(trace), std::move(*execution)};
|
||||||
@@ -65,6 +69,10 @@ auto replay(const Owner& source, const Owner& destination, const CellularMigrati
|
|||||||
-> decltype(CellularMigration::prepare(source, destination, trusted.genome)) {
|
-> decltype(CellularMigration::prepare(source, destination, trusted.genome)) {
|
||||||
if (!shape(trace))
|
if (!shape(trace))
|
||||||
return std::unexpected(CellularMigrationError::format);
|
return std::unexpected(CellularMigrationError::format);
|
||||||
|
const auto version =
|
||||||
|
state(source)->rules_version() == cellular_lives_maturation_rules ? 2U : 1U;
|
||||||
|
if (trace.format_version != version)
|
||||||
|
return std::unexpected(CellularMigrationError::version);
|
||||||
if (trace.request != trusted || trace.representation != representation ||
|
if (trace.request != trusted || trace.representation != representation ||
|
||||||
trace.world != state(source)->world() || trace.frame != state(source)->frame() ||
|
trace.world != state(source)->world() || trace.frame != state(source)->frame() ||
|
||||||
trace.tick != state(source)->tick() || trusted.source.region != state(source)->region() ||
|
trace.tick != state(source)->tick() || trusted.source.region != state(source)->region() ||
|
||||||
@@ -144,8 +152,8 @@ encode_migration_trace(const CellularMigrationTrace& trace) {
|
|||||||
return std::unexpected(CellularMigrationError::format);
|
return std::unexpected(CellularMigrationError::format);
|
||||||
std::vector<std::uint8_t> bytes;
|
std::vector<std::uint8_t> bytes;
|
||||||
bytes.reserve(migration_trace_header_bytes + 8 * trace.members.size() + 8);
|
bytes.reserve(migration_trace_header_bytes + 8 * trace.members.size() + 8);
|
||||||
append(bytes, magic);
|
append(bytes, trace.format_version == 1 ? magic : maturing_magic);
|
||||||
put(bytes, 1, 4);
|
put(bytes, trace.format_version, 4);
|
||||||
put(bytes, static_cast<std::uint32_t>(trace.representation), 4);
|
put(bytes, static_cast<std::uint32_t>(trace.representation), 4);
|
||||||
for (const auto value : {trace.world, trace.frame, trace.tick, trace.request.genome})
|
for (const auto value : {trace.world, trace.frame, trace.tick, trace.request.genome})
|
||||||
put(bytes, value);
|
put(bytes, value);
|
||||||
@@ -174,14 +182,17 @@ decode_migration_trace(std::span<const std::uint8_t> bytes) {
|
|||||||
if (end.get() != checksum(bytes.first(bytes.size() - 8)))
|
if (end.get() != checksum(bytes.first(bytes.size() - 8)))
|
||||||
return std::unexpected(CellularMigrationError::checksum);
|
return std::unexpected(CellularMigrationError::checksum);
|
||||||
Reader in(bytes);
|
Reader in(bytes);
|
||||||
if (in.array<8>() != magic)
|
const auto tag = in.array<8>();
|
||||||
|
if (tag != magic && tag != maturing_magic)
|
||||||
return std::unexpected(CellularMigrationError::format);
|
return std::unexpected(CellularMigrationError::format);
|
||||||
if (in.get(4) != 1)
|
const auto version = in.get(4);
|
||||||
|
if ((version != 1 && version != 2) || (version == 1 ? tag != magic : tag != maturing_magic))
|
||||||
return std::unexpected(CellularMigrationError::version);
|
return std::unexpected(CellularMigrationError::version);
|
||||||
const auto representation = in.get(4);
|
const auto representation = in.get(4);
|
||||||
if (representation != 1 && representation != 2)
|
if (representation != 1 && representation != 2)
|
||||||
return std::unexpected(CellularMigrationError::version);
|
return std::unexpected(CellularMigrationError::version);
|
||||||
CellularMigrationTrace trace;
|
CellularMigrationTrace trace;
|
||||||
|
trace.format_version = static_cast<std::uint32_t>(version);
|
||||||
trace.representation = static_cast<CellularMigrationRepresentation>(representation);
|
trace.representation = static_cast<CellularMigrationRepresentation>(representation);
|
||||||
trace.world = in.get();
|
trace.world = in.get();
|
||||||
trace.frame = in.get();
|
trace.frame = in.get();
|
||||||
|
|||||||
@@ -12,19 +12,26 @@ execute_process(COMMAND "${MIGRATION_TEST}" --replay "${prefix}" RESULT_VARIABLE
|
|||||||
if(NOT replayed EQUAL 0)
|
if(NOT replayed EQUAL 0)
|
||||||
message(FATAL_ERROR "Fresh-process migration replay failed: ${replayed}")
|
message(FATAL_ERROR "Fresh-process migration replay failed: ${replayed}")
|
||||||
endif()
|
endif()
|
||||||
foreach(representation raw pop)
|
foreach(variant legacy maturing)
|
||||||
|
if(variant STREQUAL "legacy")
|
||||||
|
set(pair "${prefix}")
|
||||||
|
else()
|
||||||
|
set(pair "${prefix}.maturing")
|
||||||
|
endif()
|
||||||
|
foreach(representation raw pop)
|
||||||
foreach(side source destination)
|
foreach(side source destination)
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files
|
||||||
"${prefix}.${representation}.${side}.expected"
|
"${pair}.${representation}.${side}.expected"
|
||||||
"${prefix}.${representation}.${side}.resumed" RESULT_VARIABLE compared)
|
"${pair}.${representation}.${side}.resumed" RESULT_VARIABLE compared)
|
||||||
if(NOT compared EQUAL 0)
|
if(NOT compared EQUAL 0)
|
||||||
message(FATAL_ERROR "Migration ${representation}/${side} diverged across process replay")
|
message(FATAL_ERROR "Migration ${variant}/${representation}/${side} diverged across process replay")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files
|
||||||
"${prefix}.pop.continuation.expected" "${prefix}.pop.continuation.resumed"
|
"${pair}.pop.continuation.expected" "${pair}.pop.continuation.resumed"
|
||||||
RESULT_VARIABLE continued)
|
RESULT_VARIABLE continued)
|
||||||
if(NOT continued EQUAL 0)
|
if(NOT continued EQUAL 0)
|
||||||
message(FATAL_ERROR "Transferred population interval diverged across process replay")
|
message(FATAL_ERROR "Transferred ${variant} population interval diverged across process replay")
|
||||||
endif()
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|||||||
@@ -162,9 +162,13 @@ CellularPopulationExecution continuation(const CellularPopulation& population) {
|
|||||||
auto inputs = checked(unattended_population_inputs(s, header), "transferred interval inputs");
|
auto inputs = checked(unattended_population_inputs(s, header), "transferred interval inputs");
|
||||||
return checked(prepare_population_batch(population, std::move(inputs)), "transferred interval");
|
return checked(prepare_population_batch(population, std::move(inputs)), "transferred interval");
|
||||||
}
|
}
|
||||||
void trace_contract() {
|
void trace_contract(bool maturing = false) {
|
||||||
auto source = checked(funded()->migration_upgrade_candidate(), "trace source");
|
auto source = checked(funded()->migration_upgrade_candidate(), "trace source");
|
||||||
auto target = checked(destination(*source, 1)->migration_upgrade_candidate(), "trace target");
|
auto target = checked(destination(*source, 1)->migration_upgrade_candidate(), "trace target");
|
||||||
|
if (maturing) {
|
||||||
|
source = checked(source->maturation_upgrade_candidate(), "trace maturing source");
|
||||||
|
target = checked(target->maturation_upgrade_candidate(), "trace maturing target");
|
||||||
|
}
|
||||||
const auto before = source->snapshot(), peer_before = target->snapshot();
|
const auto before = source->snapshot(), peer_before = target->snapshot();
|
||||||
const auto request = request_for(*source, *target);
|
const auto request = request_for(*source, *target);
|
||||||
auto recorded = checked(prepare_migration_trace(*source, *target, request), "record pair");
|
auto recorded = checked(prepare_migration_trace(*source, *target, request), "record pair");
|
||||||
@@ -172,7 +176,20 @@ void trace_contract() {
|
|||||||
require(bytes.size() == migration_trace_header_bytes + 8 * recorded.trace.members.size() + 8,
|
require(bytes.size() == migration_trace_header_bytes + 8 * recorded.trace.members.size() + 8,
|
||||||
"trace length changed");
|
"trace length changed");
|
||||||
const auto trace = checked(decode_migration_trace(bytes), "decode pair");
|
const auto trace = checked(decode_migration_trace(bytes), "decode pair");
|
||||||
require(trace == recorded.trace, "trace canonical roundtrip");
|
require(trace == recorded.trace && trace.format_version == (maturing ? 2U : 1U),
|
||||||
|
"trace canonical roundtrip or rule version");
|
||||||
|
auto wrong_version = trace;
|
||||||
|
wrong_version.format_version = maturing ? 1 : 2;
|
||||||
|
require(!replay_migration_trace(*source, *target, request, wrong_version),
|
||||||
|
"transfer trace reinterpreted under different biological rules");
|
||||||
|
wrong_version.format_version = 3;
|
||||||
|
require(!encode_migration_trace(wrong_version), "unknown transfer trace version");
|
||||||
|
for (const auto offset : {std::size_t{7}, std::size_t{8}}) {
|
||||||
|
auto mixed = bytes;
|
||||||
|
mixed.at(offset) = offset == 7 ? (maturing ? '1' : '2') : (maturing ? 1 : 2);
|
||||||
|
checksum(mixed);
|
||||||
|
require(!decode_migration_trace(mixed), "mixed transfer magic/version");
|
||||||
|
}
|
||||||
auto replayed =
|
auto replayed =
|
||||||
checked(replay_migration_trace(*source, *target, request, trace), "replay pair");
|
checked(replay_migration_trace(*source, *target, request, trace), "replay pair");
|
||||||
require(replayed.source->snapshot() == recorded.execution.source->snapshot() &&
|
require(replayed.source->snapshot() == recorded.execution.source->snapshot() &&
|
||||||
@@ -302,6 +319,85 @@ void trace_contract() {
|
|||||||
require(source->snapshot() == before && target->snapshot() == peer_before,
|
require(source->snapshot() == before && target->snapshot() == peer_before,
|
||||||
"trace validation changed its input");
|
"trace validation changed its input");
|
||||||
}
|
}
|
||||||
|
void maturing_growth_transfer() {
|
||||||
|
auto old = checked(funded()->migration_upgrade_candidate(), "growth migration source");
|
||||||
|
auto old_peer = checked(destination(*old)->migration_upgrade_candidate(), "growth old peer");
|
||||||
|
auto source = checked(old->maturation_upgrade_candidate(), "growth rules-9 source");
|
||||||
|
auto peer = checked(old_peer->maturation_upgrade_candidate(), "growth rules-9 peer");
|
||||||
|
const auto genome = wildlife_genome(*source);
|
||||||
|
const auto before = source->snapshot(), old_bytes = old->snapshot();
|
||||||
|
for (const auto& result : {CellularMigration::prepare(*source, *old_peer, genome),
|
||||||
|
CellularMigration::prepare(*old, *peer, genome)})
|
||||||
|
require(!result && result.error() == CellularMigrationError::version,
|
||||||
|
"mixed rules entered raw transfer");
|
||||||
|
auto population = checked(CellularPopulation::create(restore(*source)), "growth population");
|
||||||
|
auto old_population =
|
||||||
|
checked(CellularPopulation::create(restore(*old_peer)), "old population peer");
|
||||||
|
const auto mixed = CellularMigration::prepare(*population, *old_population, genome);
|
||||||
|
require(!mixed && mixed.error() == CellularMigrationError::version &&
|
||||||
|
source->snapshot() == before && old->snapshot() == old_bytes &&
|
||||||
|
!source->migration_upgrade_candidate(),
|
||||||
|
"mixed cohort transfer changed input or rules-9 repeated the format upgrade");
|
||||||
|
auto active = checked(funded(false)->migration_upgrade_candidate(), "active boundary owner");
|
||||||
|
auto active_peer = checked(destination(*active)->migration_upgrade_candidate(), "active peer");
|
||||||
|
active = checked(active->maturation_upgrade_candidate(), "active maturing owner");
|
||||||
|
active_peer = checked(active_peer->maturation_upgrade_candidate(), "active maturing peer");
|
||||||
|
const auto vulnerable =
|
||||||
|
CellularMigration::prepare(*active, *active_peer, wildlife_genome(*active));
|
||||||
|
require(!vulnerable && vulnerable.error() == CellularMigrationError::ineligible,
|
||||||
|
"rules-9 transfer bypassed vulnerable controlled life");
|
||||||
|
for (unsigned tick = 0; tick < 64; ++tick)
|
||||||
|
step(*source);
|
||||||
|
bool grew_before = false;
|
||||||
|
for (const auto& life : source->lives()) {
|
||||||
|
const auto prior = std::ranges::find(old->lives(), life.identity.life,
|
||||||
|
[](const auto& value) { return value.identity.life; });
|
||||||
|
grew_before |= prior != old->lives().end() &&
|
||||||
|
life.growth.realized_per_thousand > prior->growth.realized_per_thousand;
|
||||||
|
}
|
||||||
|
require(grew_before, "migration fixture never funded pre-transfer growth");
|
||||||
|
// Finite destination food is declared in its opening fixture, not credited
|
||||||
|
// to a migrant's reserve or copied from the source's spending ledger.
|
||||||
|
peer = checked(checked(destination(*source, 0, 0, true)->migration_upgrade_candidate(),
|
||||||
|
"funded destination boundary")
|
||||||
|
->maturation_upgrade_candidate(),
|
||||||
|
"funded destination maturation");
|
||||||
|
const auto request = request_for(*source, *peer);
|
||||||
|
auto raw = checked(prepare_migration_trace(*source, *peer, request), "growing raw transfer");
|
||||||
|
population = checked(CellularPopulation::create(restore(*source)), "growing source cohort");
|
||||||
|
auto destination_population =
|
||||||
|
checked(CellularPopulation::create(restore(*peer)), "growing destination cohort");
|
||||||
|
checked(population->collapse(genome), "growing cohort membership");
|
||||||
|
auto recorded = checked(prepare_migration_trace(*population, *destination_population, request),
|
||||||
|
"growing cohort transfer");
|
||||||
|
require(raw.execution.source->snapshot() == recorded.execution.source->state().snapshot() &&
|
||||||
|
raw.execution.destination->snapshot() ==
|
||||||
|
recorded.execution.destination->state().snapshot() &&
|
||||||
|
recorded.trace.format_version == 2,
|
||||||
|
"growing transfer changed biology across representations");
|
||||||
|
const auto total = plus(source->current_total(), peer->current_total());
|
||||||
|
const auto arrival = recorded.execution.destination->state().snapshot();
|
||||||
|
auto continued = continuation(*recorded.execution.destination);
|
||||||
|
bool grew_after = false;
|
||||||
|
for (const auto& life : continued.state->state().lives()) {
|
||||||
|
const auto prior = std::ranges::find(source->lives(), life.identity.life,
|
||||||
|
[](const auto& value) { return value.identity.life; });
|
||||||
|
grew_after |= prior != source->lives().end() &&
|
||||||
|
life.growth.realized_per_thousand > prior->growth.realized_per_thousand;
|
||||||
|
}
|
||||||
|
require(grew_after &&
|
||||||
|
plus(recorded.execution.source->state().current_total(),
|
||||||
|
continued.state->state().current_total()) == total &&
|
||||||
|
continued.state->state().boundary_ledger() ==
|
||||||
|
recorded.execution.destination->state().boundary_ledger() &&
|
||||||
|
recorded.execution.destination->state().snapshot() == arrival,
|
||||||
|
"imported juvenile failed funded growth or spent boundary flow as stock");
|
||||||
|
const auto replay =
|
||||||
|
checked(replay_population_batch(*recorded.execution.destination, continued.batch),
|
||||||
|
"growing destination interval replay");
|
||||||
|
require(replay->snapshot() == continued.state->snapshot(),
|
||||||
|
"post-transfer growth replay differs");
|
||||||
|
}
|
||||||
void write_bytes(const std::string& path, std::span<const std::uint8_t> bytes) {
|
void write_bytes(const std::string& path, std::span<const std::uint8_t> bytes) {
|
||||||
std::ofstream out(path, std::ios::binary | std::ios::trunc);
|
std::ofstream out(path, std::ios::binary | std::ios::trunc);
|
||||||
out.write(reinterpret_cast<const char*>(bytes.data()),
|
out.write(reinterpret_cast<const char*>(bytes.data()),
|
||||||
@@ -320,9 +416,13 @@ std::vector<std::uint8_t> read_bytes(const std::string& path) {
|
|||||||
require(in.good(), "restart fixture read");
|
require(in.good(), "restart fixture read");
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
void record_restart(const std::string& prefix) {
|
void record_restart(const std::string& prefix, bool maturing = false) {
|
||||||
auto source = checked(funded()->migration_upgrade_candidate(), "restart source");
|
auto source = checked(funded()->migration_upgrade_candidate(), "restart source");
|
||||||
auto target = checked(destination(*source, 1)->migration_upgrade_candidate(), "restart target");
|
auto target = checked(destination(*source, 1)->migration_upgrade_candidate(), "restart target");
|
||||||
|
if (maturing) {
|
||||||
|
source = checked(source->maturation_upgrade_candidate(), "restart maturing source");
|
||||||
|
target = checked(target->maturation_upgrade_candidate(), "restart maturing target");
|
||||||
|
}
|
||||||
const auto request = request_for(*source, *target);
|
const auto request = request_for(*source, *target);
|
||||||
auto recorded = checked(prepare_migration_trace(*source, *target, request), "restart raw pair");
|
auto recorded = checked(prepare_migration_trace(*source, *target, request), "restart raw pair");
|
||||||
write_bytes(prefix + ".raw.source", source->snapshot());
|
write_bytes(prefix + ".raw.source", source->snapshot());
|
||||||
@@ -381,7 +481,7 @@ void replay_restart(const std::string& prefix) {
|
|||||||
"fresh transferred continuation");
|
"fresh transferred continuation");
|
||||||
write_bytes(prefix + ".pop.continuation.resumed", continued->snapshot());
|
write_bytes(prefix + ".pop.continuation.resumed", continued->snapshot());
|
||||||
}
|
}
|
||||||
void upgrade_and_move() {
|
void upgrade_and_move(bool maturing = false) {
|
||||||
auto original = funded();
|
auto original = funded();
|
||||||
auto other = destination(*original, 1);
|
auto other = destination(*original, 1);
|
||||||
const auto original_bytes = original->snapshot();
|
const auto original_bytes = original->snapshot();
|
||||||
@@ -397,6 +497,10 @@ void upgrade_and_move() {
|
|||||||
source->boundary_ledger() == CellularBoundaryLedger{} &&
|
source->boundary_ledger() == CellularBoundaryLedger{} &&
|
||||||
original->snapshot() == original_bytes,
|
original->snapshot() == original_bytes,
|
||||||
"upgrade changed biology/funding");
|
"upgrade changed biology/funding");
|
||||||
|
if (maturing) {
|
||||||
|
source = checked(source->maturation_upgrade_candidate(), "moving maturing source");
|
||||||
|
target = checked(target->maturation_upgrade_candidate(), "moving maturing target");
|
||||||
|
}
|
||||||
const auto source_before = source->snapshot(), target_before = target->snapshot();
|
const auto source_before = source->snapshot(), target_before = target->snapshot();
|
||||||
const auto total = plus(source->current_total(), target->current_total());
|
const auto total = plus(source->current_total(), target->current_total());
|
||||||
const auto genome = wildlife_genome(*source);
|
const auto genome = wildlife_genome(*source);
|
||||||
@@ -597,7 +701,7 @@ void population_envelope() {
|
|||||||
}
|
}
|
||||||
checked(next->advance_tick(controlled), "new envelope continued biology");
|
checked(next->advance_tick(controlled), "new envelope continued biology");
|
||||||
}
|
}
|
||||||
void overlap_refusal() {
|
void overlap_refusal(bool maturing = false) {
|
||||||
auto raw = funded(false);
|
auto raw = funded(false);
|
||||||
for (unsigned i = 0; i < 128; ++i)
|
for (unsigned i = 0; i < 128; ++i)
|
||||||
step(*raw, false);
|
step(*raw, false);
|
||||||
@@ -605,6 +709,10 @@ void overlap_refusal() {
|
|||||||
step(*raw);
|
step(*raw);
|
||||||
auto source = checked(raw->migration_upgrade_candidate(), "overlap source upgrade");
|
auto source = checked(raw->migration_upgrade_candidate(), "overlap source upgrade");
|
||||||
auto target = checked(destination(*source)->migration_upgrade_candidate(), "overlap peer");
|
auto target = checked(destination(*source)->migration_upgrade_candidate(), "overlap peer");
|
||||||
|
if (maturing) {
|
||||||
|
source = checked(source->maturation_upgrade_candidate(), "overlap maturing source");
|
||||||
|
target = checked(target->maturation_upgrade_candidate(), "overlap maturing target");
|
||||||
|
}
|
||||||
const auto first = wildlife_genome(*source);
|
const auto first = wildlife_genome(*source);
|
||||||
auto initial =
|
auto initial =
|
||||||
checked(CellularMigration::prepare(*source, *target, first), "overlap first group");
|
checked(CellularMigration::prepare(*source, *target, first), "overlap first group");
|
||||||
@@ -710,11 +818,15 @@ void refusal_and_codec() {
|
|||||||
require(source->snapshot() == before && target->snapshot() == target_before,
|
require(source->snapshot() == before && target->snapshot() == target_before,
|
||||||
"rejection modified a peer");
|
"rejection modified a peer");
|
||||||
}
|
}
|
||||||
void capacity() {
|
void capacity(bool maturing = false) {
|
||||||
auto raw = funded(true, 1);
|
auto raw = funded(true, 1);
|
||||||
auto crowded = destination(*raw, 256);
|
auto crowded = destination(*raw, 256);
|
||||||
auto source = checked(raw->migration_upgrade_candidate(), "capacity source upgrade");
|
auto source = checked(raw->migration_upgrade_candidate(), "capacity source upgrade");
|
||||||
auto target = checked(crowded->migration_upgrade_candidate(), "capacity target upgrade");
|
auto target = checked(crowded->migration_upgrade_candidate(), "capacity target upgrade");
|
||||||
|
if (maturing) {
|
||||||
|
source = checked(source->maturation_upgrade_candidate(), "capacity maturing source");
|
||||||
|
target = checked(target->maturation_upgrade_candidate(), "capacity maturing target");
|
||||||
|
}
|
||||||
const auto before = source->snapshot(), other = target->snapshot();
|
const auto before = source->snapshot(), other = target->snapshot();
|
||||||
const auto result = CellularMigration::prepare(*source, *target, wildlife_genome(*source));
|
const auto result = CellularMigration::prepare(*source, *target, wildlife_genome(*source));
|
||||||
require(!result && result.error() == CellularMigrationError::capacity &&
|
require(!result && result.error() == CellularMigrationError::capacity &&
|
||||||
@@ -761,11 +873,13 @@ void local_budding_among_imports() {
|
|||||||
int main(int argc, char** argv) try {
|
int main(int argc, char** argv) try {
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
const std::string_view mode{argv[1]};
|
const std::string_view mode{argv[1]};
|
||||||
if (mode == "--record")
|
if (mode == "--record") {
|
||||||
record_restart(argv[2]);
|
record_restart(argv[2]);
|
||||||
else if (mode == "--replay")
|
record_restart(std::string{argv[2]} + ".maturing", true);
|
||||||
|
} else if (mode == "--replay") {
|
||||||
replay_restart(argv[2]);
|
replay_restart(argv[2]);
|
||||||
else
|
replay_restart(std::string{argv[2]} + ".maturing");
|
||||||
|
} else
|
||||||
throw std::runtime_error("unknown migration fixture mode");
|
throw std::runtime_error("unknown migration fixture mode");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -777,6 +891,11 @@ int main(int argc, char** argv) try {
|
|||||||
overlap_refusal();
|
overlap_refusal();
|
||||||
local_budding_among_imports();
|
local_budding_among_imports();
|
||||||
trace_contract();
|
trace_contract();
|
||||||
|
upgrade_and_move(true);
|
||||||
|
capacity(true);
|
||||||
|
overlap_refusal(true);
|
||||||
|
trace_contract(true);
|
||||||
|
maturing_growth_transfer();
|
||||||
return 0;
|
return 0;
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
std::cerr << error.what() << '\n';
|
std::cerr << error.what() << '\n';
|
||||||
|
|||||||
@@ -2688,6 +2688,29 @@ void migration_freezes(Fixture& f) {
|
|||||||
auto frozen = take(prepare(request), "durable source freeze");
|
auto frozen = take(prepare(request), "durable source freeze");
|
||||||
const CellularMigrationPrepared prepared{
|
const CellularMigrationPrepared prepared{
|
||||||
f.key, take(encode_migration_trace(frozen.trace), "frozen canonical trace")};
|
f.key, take(encode_migration_trace(frozen.trace), "frozen canonical trace")};
|
||||||
|
auto unsupported = frozen.trace;
|
||||||
|
unsupported.format_version = 2;
|
||||||
|
const auto unsupported_bytes =
|
||||||
|
take(encode_migration_trace(unsupported), "portable rules-9 trace");
|
||||||
|
const auto refused_freeze =
|
||||||
|
retry_cellular_migration_freeze(*f.db, f.lease, {f.key, unsupported_bytes}, 5s);
|
||||||
|
const auto refused_stage = retry_cellular_migration_stage(
|
||||||
|
*f.db, destination_lease, {destination_key, unsupported_bytes, {f.build, 1}}, 5s);
|
||||||
|
require(!refused_freeze && refused_freeze.error().kind == PublicationError::candidate &&
|
||||||
|
!refused_stage && refused_stage.error().kind == PublicationError::candidate &&
|
||||||
|
!stage_cellular_migration(*f.db, *f.objects, *destination_objects,
|
||||||
|
destination_lease, f.head, destination_head,
|
||||||
|
unsupported, 5s),
|
||||||
|
"portable rules-9 trace expanded durable migration admission");
|
||||||
|
const std::array<std::string, 3> unsupported_args{hexadecimal(f.lease.holder, false),
|
||||||
|
std::to_string(f.lease.epoch),
|
||||||
|
hexadecimal(unsupported_bytes)};
|
||||||
|
const auto refused_sql =
|
||||||
|
f.db->query("SELECT * FROM evolution.prepare_cellular_migration_freeze(30201,"
|
||||||
|
"1,$1::uuid,$2::evolution.u64,$3::bytea)",
|
||||||
|
unsupported_args, 5s);
|
||||||
|
require(!refused_sql && std::string(refused_sql.error().sqlstate.data(), 5) == "22023",
|
||||||
|
"SQL admitted portable trace 2 before duplicate lookup");
|
||||||
auto malformed = prepared.trace;
|
auto malformed = prepared.trace;
|
||||||
malformed.back() ^= 1;
|
malformed.back() ^= 1;
|
||||||
const std::array<std::string, 3> malformed_args{hexadecimal(f.lease.holder, false),
|
const std::array<std::string, 3> malformed_args{hexadecimal(f.lease.holder, false),
|
||||||
|
|||||||
Reference in New Issue
Block a user