Complete M7.6 bounded authoritative region host

ADR-0064: RegionHost<State> (environmental and lineage profiles) is a
single-owner, single-threaded state machine advanced by step(now):
acquire the fenced lease and recover the verified head, run, resolve
ambiguous commits, drain and stop, or quarantine. Admission is
provisional and bounded (64 inputs, 64 KiB) with backpressure; FinalAck
and FinalOutcome are emitted only after a confirmed commit, and inputs
that will never be acknowledged are reported with a reason. Ticks follow
the caller's scheduling clock with bounded catch-up and measured tick
debt, never invented inputs. A death seals the batch and commits in the
same step, so no dependent tick uses an uncommitted outcome. Storage
outages pause and retry, unknown outcomes resolve by exact bytes,
fencing discards unconfirmed work and re-acquires; readiness fails
closed. Drain commits pending ticks and releases the lease.

evo-server hosts one region with a bounded stdin input feed, stdout
event lines, a readiness file and SIGTERM drain (exit 0/3/4).

Validated: Windows CTest 58/58; PostgreSQL suites under GCC Release,
clang-tidy and ASan/UBSan including real-process SIGTERM drain and
SIGKILL with successor recovery; four host mutations each caught. No
gateway, metrics, Docker/Gitea CI or deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-28 20:53:11 -04:00
co-authored by Claude Opus 5.5
parent ab4bf5355f
commit d6d0408aae
15 changed files with 1934 additions and 3 deletions
+43
View File
@@ -2296,3 +2296,46 @@ Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate
PostgreSQL suites, all passing, and the repository format check. The changes
are Linux-only persistence code, SQL and tests; the portable targets and
Windows are unchanged.
## M7.6 region host - 2026-09-28
- Windows MSVC Release CTest passed 58/58; this change touches only the Linux
PostgreSQL CMake section and Linux sources. The repository clang-format 19 check
passed.
- WSL Linux: GCC14 Release, clang19 analysis (clang-tidy) and clang19 ASan/UBSan
builds of `evo-postgres-tests` and `evo-server` passed the full PostgreSQL suite.
Final runs: Release 3, analysis 1, ASan 3 across both verification passes.
- The first analysis build flagged unchecked optional accesses and ignored release
results in the host and server, plus two test issues. These were fixed with
explicit local checks rather than suppressions, then rebuilt and rerun in all
three configurations.
- Host scenarios (real PostgreSQL, scaled scheduling clock, 4 s test lease):
- Admission: not_ready before recovery, 64-input cap (full), duplicate and
invalid refusals, byte accounting.
- Ticks 1–19 are provisional with no acks. Tick 20's death pauses and commits
in the same step: 20 acks and one outcome (consumer, organism 11, sequence 1).
The next batch flushed by interval at tick 41.
- Starvation: debt reached 10 without invented ticks, then catch-up of 8 per step.
- Storage outage: the sealed batch waits with nothing acknowledged and debt
growing, then commits when storage recovers.
- Lease row locked: the commit becomes unknown, the host is not ready and
refuses admission, and resolution adopts the receipt after release.
- Renewals blocked past the local deadline: fence, all 8 unconfirmed inputs
reported `fenced`, then re-acquisition at a newer epoch from the committed head.
- Drain (environmental profile): backlog dropped as drained, 6 pending ticks
committed, lease released, and a successor acquired immediately at epoch 2.
- Unrestorable build and foreign frame quarantine; an invalid configuration is
refused.
- Process tests (real `evo-server` via posix_spawn, stdin and stdout pipes):
- SIGTERM after 80 inputs: exit 0, 80 acks, head 80 at sequence 8, lease
released, readiness file removed, max_queued 64. The outcome line followed
tick 20's final ack.
- SIGKILL during running: every acked tick ≤ the committed head (11/11) and the
lease was left held. The successor was ready after 3.94–3.97 s at epoch 2 with
committed=11, then drained cleanly.
- Mutations (restored and rerun green), each caught: acknowledging at simulation
time, not committing a sealed death, reporting ready while resolving, and
draining without releasing the lease.
- Not executed: Docker/Gitea CI, TSan (the host is single-threaded; libpq is
uninstrumented), remote PostgreSQL/TLS, a production 20 s lease kill test,
durable client deduplication, and a network gateway.