ADR-0062 adds a canonical LineageArchive codec (parents before children, organisms by id, FNV) that decodes by replaying admit/record_birth/ record_death and requires byte-identical re-encoding; it never overwrites an existing archive. LineageRegion binds the environmental producer and consumer accounts to archived organisms with identity high-waters, enforces closure (lifecycle vs deaths, exact living set, tick bounds) and records deaths in the tick that causes them. Checkpoint profile 2 (environmental-lineage-v1, history profile 1) publishes that container; schema v4 admits it with a 4,268,144-byte cap and requires each commit to keep its predecessor's profile, RNG, history and durability declarations. Linux adds provision/publish/recover for the profile on the shared publication path. Qualification found WSL2 stepping CLOCK_REALTIME back ~0.5 s every ~32 s, which made two 1 s-lease tests flaky under ASan. Tests now wait on database-time expiry; ADR-0060 records the slewed-clock requirement. Validated: Windows CTest 57/57; Linux GCC Debug/Release, clang-tidy and ASan/UBSan CTest 57/57 each; PostgreSQL suites 2x Release, 2x analysis, 5x ASan; SQL and C++ mutations each caught. No Docker/Gitea CI, remote store, process kill or deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.2 KiB
Bash
28 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# Operator-created NOLOGIN group role granted to the region runtime login (ADR-0060).
|
|
runtime_role="${EVO_PG_RUNTIME_ROLE:?set EVO_PG_RUNTIME_ROLE to the runtime group role}"
|
|
if [ -n "${EVO_PGPASS_SOURCE:-}" ]; then
|
|
umask 077
|
|
export PGPASSFILE
|
|
PGPASSFILE="$(mktemp /tmp/evo-pgpass.XXXXXXXX)"
|
|
trap 'rm -f -- "$PGPASSFILE"' EXIT
|
|
cat "$EVO_PGPASS_SOURCE" > "$PGPASSFILE"
|
|
fi
|
|
# Connection comes from PG* environment / mounted service and password files.
|
|
# Never print the connection or enable shell tracing here.
|
|
digest="$(sha256sum "$root/migrations/0001_region_bootstrap.sql")"
|
|
digest="${digest%% *}"
|
|
digest_2="$(sha256sum "$root/migrations/0002_region_fencing.sql")"
|
|
digest_2="${digest_2%% *}"
|
|
digest_3="$(sha256sum "$root/migrations/0003_region_checkpoints.sql")"
|
|
digest_3="${digest_3%% *}"
|
|
digest_4="$(sha256sum "$root/migrations/0004_lineage_profile.sql")"
|
|
digest_4="${digest_4%% *}"
|
|
psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
|
|
--set="migration_sha_2=$digest_2" --set="migration_sha_3=$digest_3" \
|
|
--set="migration_sha_4=$digest_4" \
|
|
--set="runtime_role=$runtime_role" \
|
|
--file="$root/migrations/apply.sql"
|