Add M10.4b durable action records (schema v11)
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m47s
Foundation / checks (network) (push) Successful in 9m30s
Foundation / checks (client) (push) Successful in 12m19s
Foundation / checks (tsan) (push) Successful in 7m43s
Foundation / checks (checks) (push) Successful in 31m29s
Foundation / checks (postgres) (push) Successful in 36m39s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 2m15s
Foundation / server-image (push) Successful in 20m37s

Each batch's actions are recorded in the same statement as its checkpoint: one
region_actions row per (world, account, action id) and the block in an append-only
table, compared on exact retries and resolution. The region host attaches actions to
the ticks they ride and reports acknowledgements and drops, keeping unknown-outcome
batches unresolved. Outcomes come from the durable record via ActionLedger, so
crashes before or after a commit, unknown publications and cross-region moves all
resolve to one answer; a repeated id keeps its first record instead of stalling a
region. ADR-0092.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-03 22:53:38 -04:00
co-authored by Claude Opus 5.5
parent e2f6208433
commit 69f3ad7cf8
32 changed files with 1289 additions and 75 deletions
+3 -2
View File
@@ -522,8 +522,9 @@ hardware (10.9). 10.2 split: 10.2a selection, pins and build of msquic/OpenSSL d
10.3 split (ADR-0091): 10.3a account ids, ECDSA grants, identity adapter and region
session control done; 10.3b QUIC session login (schemas/network/session-v1.md) done;
10.3c durable per-world account control (schema v10) done. 10.4 split (ADR-0092):
10.4a intention/action protocol and admission done; 10.4b durable action records and
10.4c evo-server wiring with a headless client follow. 10.5-10.9 planned.
10.4a intention/action protocol and admission done; 10.4b durable action records
(schema v11, same transaction as the checkpoint) done; 10.4c evo-server wiring with a
headless client follows. 10.5-10.9 planned.
**Entry:** M9 client/session evidence and M7/M8 dev/stage durability. Read
NETWORK_ARCHITECTURE, PERSISTENCE_ARCHITECTURE and ADR-0017. The M9 transport is
+5 -2
View File
@@ -28,8 +28,11 @@ control is fenced or cannot be renewed. M10.4a (ADR-0092) adds
intentions (datagram receipts and a cumulative simulated watermark) and account-scoped
actions with stable ids, receipts and final outcomes to session-v1, with admission
(window, rate, sequence, duplicates, unresolved bound) and client support; intentions and
actions have no biological effect yet. Next: M10.4b durable action records (migration
v11) and M10.4c evo-server wiring.
actions have no biological effect yet. M10.4b makes
action outcomes durable: schema v11 records each batch's actions in the same statement as
its checkpoint, the host attaches actions to the ticks they ride, and outcomes are read
from the durable record after crashes before or after a commit, unknown publications and
cross-region moves. Next: M10.4c evo-server wiring with a headless client.
## Previous gate - 2026-10-02
@@ -59,3 +59,33 @@ the wire field must never be cast from it).
- The simulated watermark says the targeted tick ran while the intention was scheduled;
with no movement rule it changed nothing. 10.6 gives intentions an effect.
- Nothing is wired into evo-server yet (10.4c); nothing deploys M10 sessions.
## M10.4b durable action records (2026-10-03)
Schema v11 (`migrations/0011_region_actions.sql`, [region-actions-v1](../../schemas/region-actions-v1.md)):
- **Same transaction as the checkpoint.** The region host attaches each submitted action to
the first simulated tick at or after its scheduled tick and publishes the batch's action
block with the three-argument `publish_region_checkpoint`; the records exist exactly when
the checkpoint does. Committed history stays immutable: blocks live in their own
append-only table, and an exact retry or resolution must repeat the block.
- **Outcomes come from the record.** `find_region_action` (under the caller's exact region
lease) returns the committed record of (world, account, action id). Found: final
`committed_no_effect` with that record's tick and commit. Absent once this authority is
recovered and ready: never committed by any earlier epoch (its commits are final).
- **One record per id, without stalling a region.** Found during testing: an account that
moves regions while its action is pending in the old one can have the same id admitted by
the new region (the record does not exist yet). Refusing the second commit would have
quarantined a healthy region. The database instead keeps the first record and lets the
later batch commit; `IntentAdmission::committed` reports each outcome from the record, so
every region answers the same tick and commit for an id.
- **Host semantics.** `submit_action` (bounded: 256 queued plus riding), `ActionAck` per
committed action, `DroppedAction` with `final` = certainly never committed. Actions of a
batch whose publication outcome was unknown when authority was lost are not final; the
session layer keeps them pending until the record decides.
- **Session layer.** `ActionLedger` (interface) with `PostgresActionLedger`; admission
checks the record before admitting an id not in memory (`duplicate` with its outcome, or
`not_ready` when the record cannot be read); queries resolve unknown-outcome and evicted
actions from the record once ready. `RegionSessions::committed/dropped` take the host's
reports.
- Limits: action rows are retained (no pruning policy yet); clones (ADR-0067) do not copy
them; the two-argument publication of a commit that has an action block would still
return its receipt (the adapter never does this).
+39
View File
@@ -4237,3 +4237,42 @@ tests; format check; Windows MSVC 19.44 preset `quic` build and CTest 4/4 (binar
timestamps checked).
Not done: durable action records and crash resolution (10.4b), evo-server wiring and
process kill tests (10.4c).
## 2026-10-03 — M10.4b durable action records (ADR-0092, schema v11)
Implemented migration v11 (`region_actions`, `region_commit_actions`, `check_action_block`,
`commit_actions`, three-argument publication, six-argument resolution,
`find_region_action`; apply chain and audit), `encode_actions`, the store overloads,
actions in `PreparedCommit`/publication/resolution, host `submit_action` with
`ActionAck`/`DroppedAction`, `ActionLedger` in admission and `PostgresActionLedger`.
Database tests (`tests/region_action_tests.cpp`, regions 7/131-135, commit ids tagged 0xA7):
publication with actions and lookups (including another account's and an absent id);
exact retry and resolution with the block; a changed block conflicting (retry and
resolution); nine invalid blocks refused (tick outside, tick 0, kind, zero account, zero id,
unsorted, duplicate, one id at two ticks, wrong length) and the encoder refusing the same;
a later batch carrying an already recorded id committing with the first record kept; a
batch without actions; lookups fenced with an old lease; the PostgreSQL action ledger.
Host: acknowledgement with the tick each action rode, late action riding the next tick,
duplicate, invalid and full submissions, not ready; crash before the transaction (successor
finds no record), crash after the commit before any acknowledgement (record durable,
successor at commit 1); unknown publication outcome resolved by exact bytes including the
actions. Unit tests: duplicate from the record, unavailable record refusing admission,
refused attempts costing no lookup, exact commit tick, final and unknown drops, unknown
decided once ready (committed or not committed), evicted outcome found on record.
`postgres-check.sh`: history 1..11, future-version probe 12, v11 checksum drift, audit
refusing SELECT on both new tables and EXECUTE on `check_action_block`.
Found and fixed during development: updating `region_commits` with the block was refused by
the immutable-history trigger (blocks now live in their own append-only table); a repeated
action id would have failed the later commit and quarantined a healthy region (now the first
record is kept and outcomes come from it); the encoder and SQL accepted one id at two ticks
in one block; test fixtures colliding with other tests' world, commit ids and accounts.
Executed: Linux GCC 14 `tools/ci/postgres-check.sh` complete (18 integration and rehearsal
suites, migration and audit probes); clang-tidy 19 on the changed persistence, host,
ledger, session and test sources (Clang builds with network+PostgreSQL and with quic);
format check; GCC preset `quic` CTest 4/4, session tests 10/10 repeated; Clang 19 ASan/UBSan
session and network tests; Windows MSVC 19.44 preset `quic` build and CTest 4/4 (binaries
rebuilt, timestamps checked).
Not done: evo-server wiring, headless client and process kill tests with real sessions
(10.4c); ASan of the PostgreSQL suite; a real two-region move with a pending action.
+10
View File
@@ -190,6 +190,16 @@ renewal requires the same generation, region and epoch and an unexpired control
(`EVL12` otherwise). The privilege audit includes all three functions. Lock order: upgrade
lock (shared), region lease row, account control row.
## Action records (schema v11, ADR-0092)
`publish_region_checkpoint(manifest, decisions, actions)` records a batch's action block
([region-actions-v1](../../schemas/region-actions-v1.md)) in the same statement as its
checkpoint: one `evolution.region_actions` row per new (world, account, action id), and the
block in the append-only `region_commit_actions` (committed history itself is never
updated). Exact retries and `resolve_region_commit(..., actions)` compare the block.
`find_region_action` reads one record under the caller's exact region lease. The privilege
audit covers all three functions; the tables and `check_action_block` are owner-only.
## Host lease discipline
Hosts use `LeaseAuthority` with `LeasePolicy` defaults: 20 s lease, 5 s renewal