Allow cellular profile in checkpoint parser
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (checks) (push) Failing after 38s
Foundation / checks (postgres) (push) Failing after 52s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / checks (ecs) (push) Successful in 2m3s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-10 22:49:09 -04:00
parent 3931fcfbe6
commit b25787f8e6
8 changed files with 189 additions and 7 deletions
+4
View File
@@ -167,6 +167,10 @@ scoped change before starting the next segment.
versions, applies the 16 MiB cap, restores through the owner codec, and
refuses profile-4 cloning. PostgreSQL admission and durable publication
remain open.
- 11.3d-3: PostgreSQL migration 18 recognizes the same profile-4 version bundle
and payload cap, rejects clone genesis, and fail-closes progressing profile-4
commits until their dedicated atomic publication path is installed. CI still
needs to execute the migration/parser checks.
## Exit boundary
+17
View File
@@ -6081,3 +6081,20 @@ and run, Debug CTest `region-checkpoint-contracts` (1/1 passed), and
focused target was compiled and linked directly with the available build
artifacts. `clang-format` and `clang-tidy` are not available on PATH. PostgreSQL
admission, durable publication/recovery, sanitizer and CI checks remain pending.
## 2026-10-10 — M11.3d-3 PostgreSQL profile-4 parser (CI pending)
Added append-only schema migration 18. The database parser now recognizes the
profile-4 version bundle and 16 MiB cap, validates the fixed 50 ms quantum,
preserves profile-3 rules, and refuses profile-4 clone genesis. A database
trigger refuses progressing profile-4 commits until the dedicated cellular
publisher can atomically record all tick evidence. PostgreSQL integration tests
check acceptance of the canonical bundle and rejection of an altered archive
version. Migration history/apply paths, checksum plumbing and CI expectations
now include version 18.
Executed locally: `git diff --check`. The local Bash/WSL launcher was denied by
the environment, MSVC cannot compile the POSIX PostgreSQL integration test
because `poll.h` is unavailable, and `psql` is not installed. The migration and
parser tests were therefore not run locally; per the agreed workflow they must
run in CI. Durable cellular publication remains blocked intentionally.
@@ -0,0 +1,114 @@
-- M11.3d-3, ADR-0108/0110: parse profile 4 and enforce its bounded version bundle.
-- Tick publication remains blocked until the dedicated cellular transaction lands.
CREATE OR REPLACE FUNCTION evolution.parse_checkpoint_manifest(m bytea)
RETURNS evolution.checkpoint_manifest LANGUAGE plpgsql IMMUTABLE
SET search_path = pg_catalog, pg_temp AS $$
DECLARE
r evolution.checkpoint_manifest;
zero16 constant bytea := '\x00000000000000000000000000000000';
zero32 constant bytea := decode(repeat('00', 32), 'hex');
history numeric;
cap numeric;
BEGIN
IF m IS NULL OR octet_length(m) < 12 OR substring(m FROM 1 FOR 8) <> '\x4145564f52434d31' THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
IF evolution.manifest_uint(m, 8, 4) <> 2 THEN
RAISE EXCEPTION 'unsupported checkpoint manifest' USING ERRCODE = 'EVL06';
END IF;
IF octet_length(m) <> 360 THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
r.profile := evolution.manifest_uint(m, 12, 4);
history := evolution.manifest_uint(m, 232, 4);
IF NOT (
(((r.profile = 1 AND history = 0) OR (r.profile = 2 AND history = 1))
AND substring(m FROM 161 FOR 36) = '\x020000000200000001000000010000000100000001000000010000000100000001000000')
OR (r.profile = 3 AND history = 2
AND substring(m FROM 161 FOR 36) = '\x010000000100000001000000000000000000000001000000010000000100000001000000')
OR (r.profile = 4 AND history = 3
AND substring(m FROM 161 FOR 36) = '\x010000000100000001000000010000000100000002000000010000000100000000000000')
)
OR evolution.manifest_uint(m, 228, 4) <> 0 OR evolution.manifest_uint(m, 236, 4) <> 1 THEN
RAISE EXCEPTION 'unsupported checkpoint manifest' USING ERRCODE = 'EVL06';
END IF;
-- Per-profile payload caps; profile 4 is a complete cellular owner snapshot.
cap := CASE r.profile WHEN 1 THEN 1048576 WHEN 2 THEN 4268144
WHEN 4 THEN 16777216 ELSE 3266800 END;
r.world_id := evolution.manifest_uint(m, 16, 8);
r.region_id := evolution.manifest_uint(m, 24, 8);
r.frame_id := evolution.manifest_uint(m, 32, 8);
r.commit_id := encode(substring(m FROM 41 FOR 16), 'hex')::uuid;
r.commit_sequence := evolution.manifest_uint(m, 56, 8);
r.predecessor_commit := encode(substring(m FROM 65 FOR 16), 'hex')::uuid;
r.predecessor_digest := substring(m FROM 81 FOR 32);
r.begin_tick := evolution.manifest_uint(m, 112, 8);
r.end_tick := evolution.manifest_uint(m, 120, 8);
r.holder := encode(substring(m FROM 129 FOR 16), 'hex')::uuid;
r.epoch := evolution.manifest_uint(m, 144, 8);
r.tick_microseconds := evolution.manifest_uint(m, 152, 8);
r.versions := substring(m FROM 161 FOR 36);
r.build_identity := substring(m FROM 197 FOR 32);
r.payload_bytes := evolution.manifest_uint(m, 240, 8);
r.payload_sha256 := substring(m FROM 249 FOR 32);
r.trace_bytes := evolution.manifest_uint(m, 280, 8);
r.trace_sha256 := substring(m FROM 289 FOR 32);
r.decision_count := evolution.manifest_uint(m, 320, 4);
r.decisions_sha256 := substring(m FROM 329 FOR 32);
IF r.world_id = 0 OR r.region_id = 0 OR r.frame_id = 0
OR substring(m FROM 41 FOR 16) = zero16 OR r.tick_microseconds = 0
OR r.build_identity = zero32 OR r.payload_bytes < 1 OR r.payload_bytes > cap
OR r.payload_sha256 = zero32 OR evolution.manifest_uint(m, 324, 4) <> 0 THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
IF r.profile IN (3, 4) AND (r.tick_microseconds <> 50000 OR
(r.profile = 3 AND (r.decision_count <> 0 OR r.decisions_sha256 <> zero32)) OR
(r.commit_sequence = 0 AND
(substring(m FROM 65 FOR 16) <> zero16 OR r.predecessor_digest <> zero32))) THEN
RAISE EXCEPTION 'invalid lifecycle checkpoint' USING ERRCODE = '22023';
END IF;
IF r.commit_sequence = 0 THEN
IF substring(m FROM 129 FOR 16) <> zero16 OR r.epoch <> 0 OR r.begin_tick <> r.end_tick
OR r.trace_bytes <> 0 OR r.trace_sha256 <> zero32 THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
IF substring(m FROM 65 FOR 16) = zero16 AND r.predecessor_digest = zero32 THEN
IF r.end_tick <> 0 OR r.decision_count <> 0 OR r.decisions_sha256 <> zero32 THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
r.predecessor_commit := NULL;
ELSIF substring(m FROM 65 FOR 16) = zero16 OR r.predecessor_digest = zero32
OR r.predecessor_commit = r.commit_id OR r.profile IN (3, 4)
OR r.decision_count > 8
OR (r.decision_count = 0) <> (r.decisions_sha256 = zero32) THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
r.holder := NULL;
ELSIF substring(m FROM 65 FOR 16) = zero16 OR r.predecessor_commit = r.commit_id
OR r.predecessor_digest = zero32 OR substring(m FROM 129 FOR 16) = zero16
OR r.epoch = 0 OR r.end_tick <= r.begin_tick OR r.end_tick - r.begin_tick > 64
OR (r.profile <> 3 AND r.trace_bytes <> 96 + 304 * (r.end_tick - r.begin_tick))
OR (r.profile = 3 AND (r.trace_bytes < 112 OR r.trace_bytes > 12400
OR mod(r.trace_bytes - 112, 48) <> 0))
OR r.trace_sha256 = zero32
OR r.decision_count > 8 OR (r.decision_count = 0) <> (r.decisions_sha256 = zero32) THEN
RAISE EXCEPTION 'malformed checkpoint manifest' USING ERRCODE = '22023';
END IF;
RETURN r;
END $$;
-- Generic publication has no cellular intent/outcome closure yet. Reject every
-- progressing profile-4 head until the dedicated atomic publisher is installed.
CREATE FUNCTION evolution.refuse_unpublished_cellular() RETURNS trigger
LANGUAGE plpgsql SECURITY INVOKER SET search_path = pg_catalog, pg_temp AS $$
BEGIN
IF evolution.manifest_uint(NEW.manifest, 12, 4) = 4 AND NEW.commit_sequence > 0 THEN
RAISE EXCEPTION 'cellular publication path unavailable' USING ERRCODE = 'EVL06';
END IF;
RETURN NEW;
END $$;
REVOKE ALL ON FUNCTION evolution.refuse_unpublished_cellular() FROM PUBLIC;
CREATE TRIGGER region_cellular_publication_gate BEFORE INSERT ON evolution.region_commits
FOR EACH ROW EXECUTE FUNCTION evolution.refuse_unpublished_cellular();
INSERT INTO evolution.schema_migrations(version, sha256) VALUES (18, :'migration_sha_18');
+22 -2
View File
@@ -90,28 +90,36 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|| ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14'
|| ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' AS at_v16,
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' AS at_v17 \gset
\if :at_v17
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' AS at_v17,
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' AS at_v18 \gset
\if :at_v18
\elif :at_v17
\ir 0018_cellular_profile_admission.sql
\elif :at_v16
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v15
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v14
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v13
\ir 0014_probe_overdue.sql
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v12
\ir 0013_probe_incoming.sql
\ir 0014_probe_overdue.sql
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v11
\ir 0012_probe_handoff.sql
\ir 0013_probe_incoming.sql
@@ -119,6 +127,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v10
\ir 0011_region_actions.sql
\ir 0012_probe_handoff.sql
@@ -127,6 +136,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v9
\ir 0010_account_control.sql
\ir 0011_region_actions.sql
@@ -136,6 +146,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v8
\ir 0009_serialized_authority.sql
\ir 0010_account_control.sql
@@ -146,6 +157,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v7
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
@@ -157,6 +169,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v6
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
@@ -169,6 +182,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v5
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
@@ -182,6 +196,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v4
\ir pre_v5_guard.sql
\ir 0005_batch_decisions.sql
@@ -197,6 +212,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v3
\ir 0004_lineage_profile.sql
\ir pre_v5_guard.sql
@@ -213,6 +229,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v2
\ir 0003_region_checkpoints.sql
\ir 0004_lineage_profile.sql
@@ -230,6 +247,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\elif :at_v1
\ir 0002_region_fencing.sql
\ir 0003_region_checkpoints.sql
@@ -248,6 +266,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\else
\echo 'Unknown or changed migration history'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
@@ -271,6 +290,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0015_life_reservations.sql
\ir 0016_primitive_publication.sql
\ir 0017_life_request_outcomes.sql
\ir 0018_cellular_profile_admission.sql
\endif
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC
+4 -1
View File
@@ -49,7 +49,10 @@ founder/archive as eight u32s, with the ninth version word zero. Its tick
quantum is 50,000 μs; its v2 trace retains the standard 96 + 304·tick encoding,
and its decision block is transactionally bound like other progressing profiles.
Profile 4 clone genesis is unsupported until cellular identity remapping is
specified. Profile 3 retains its creation-only trace and zero-decision rules.
specified. Migration 18 accepts and classifies this profile, but a database
trigger currently rejects every progressing profile-4 commit until the dedicated
cellular publisher atomically records its tick evidence. Profile 3 retains its
creation-only trace and zero-decision rules.
Profile 2 payloads are schemas/environmental-lineage-v1.md containers. A region
never changes profile, history, RNG or durability declarations; schema v4
enforces this against the predecessor. For profile 1, the payload is the exact
+22 -1
View File
@@ -183,6 +183,7 @@ void upgrade_across_migration_and_barrier() {
" -v migration_sha_15=$(s 0015_life_reservations.sql)"
" -v migration_sha_16=$(s 0016_primitive_publication.sql)"
" -v migration_sha_17=$(s 0017_life_request_outcomes.sql)"
" -v migration_sha_18=$(s 0018_cellular_profile_admission.sql)"
" -v runtime_role=evo_runtime_test -f migrations/apply.sql"
" > /dev/null 2>&1") != 0);
CHECK(history(*owner_db) == "1,2,3,4,5,6,7");
@@ -198,7 +199,7 @@ void upgrade_across_migration_and_barrier() {
CHECK(shell("PGDATABASE=" + database +
" EVO_PG_RUNTIME_ROLE=evo_runtime_test bash \"$EVO_SOURCE_ROOT/"
"tools/migrate-postgres.sh\" > /dev/null") == 0);
CHECK(history(*owner_db) == "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
CHECK(history(*owner_db) == "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
CHECK(renew_region_lease(*runtime, r.key, *lease, 20000ms, 5s));
confirm(publish_next(20)); // 41..60, now v8.
CHECK(head.head.end_tick == 60);
@@ -494,6 +495,26 @@ void concurrent_authority_and_classification() {
" EVO_PG_RUNTIME_ROLE=evo_runtime_test bash \"$EVO_SOURCE_ROOT/"
"tools/migrate-postgres.sh\" > /dev/null") == 0);
auto owner_db = connect_to(database, env("PGUSER"));
auto cellular = genesis_manifest({7, 90}, 9, filled<16>(0x70), 50000, digest_of(0xC4),
100, filled<32>(0xA9),
CheckpointProfile::cellular_lives_v1);
CHECK(cellular);
const auto cellular_bytes = encode_manifest(*cellular);
CHECK(cellular_bytes);
const std::array cellular_parameter{bytea_of(*cellular_bytes)};
const auto parsed_cellular = owner_db->query(
"SELECT (evolution.parse_checkpoint_manifest($1::bytea)).profile::text",
cellular_parameter, 5s);
CHECK(parsed_cellular && parsed_cellular->size() == 1 &&
(*parsed_cellular)[0][0].value_or("") == "4");
auto wrong_cellular_versions = *cellular;
++wrong_cellular_versions.cellular_versions.archive;
const auto wrong_cellular_bytes = encode_manifest(wrong_cellular_versions);
CHECK(wrong_cellular_bytes);
const std::array wrong_cellular_parameter{bytea_of(*wrong_cellular_bytes)};
const auto refused_cellular = owner_db->query(
"SELECT evolution.parse_checkpoint_manifest($1::bytea)", wrong_cellular_parameter, 5s);
CHECK(!refused_cellular && sqlstate(refused_cellular.error()) == "EVL06");
CHECK(owner_db->query("INSERT INTO evolution.retained_builds(build_identity) SELECT "
"decode(repeat(b, 32), 'hex') FROM unnest(ARRAY['c1', 'c2', 'c3', "
"'c4']) AS b",
+3 -3
View File
@@ -69,7 +69,7 @@ PGDATABASE=upgrade_path psql -X -v ON_ERROR_STOP=1 -1 -v "migration_sha=$v1_sha"
-f "$root/migrations/0001_region_bootstrap.sql" > /dev/null
test "$(PGDATABASE=upgrade_path psql -XAtc "SELECT string_agg(version::text, ',') FROM evolution.schema_migrations")" = 1
PGDATABASE=upgrade_path bash "$root/tools/migrate-postgres.sh"
test "$(PGDATABASE=upgrade_path psql -XAtc "SELECT string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
test "$(PGDATABASE=upgrade_path psql -XAtc "SELECT string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
# v2 heads have no payload binding: v2->v3 fails closed and leaves history at v2.
v2_sha="$(sha256sum "$root/migrations/0002_region_fencing.sql")"
v2_sha="${v2_sha%% *}"
@@ -90,7 +90,7 @@ PGDATABASE=v3_commits psql -X -v ON_ERROR_STOP=1 \
-c "INSERT INTO evolution.retained_builds VALUES (decode(repeat('b1', 32), 'hex'))" \
-c "SELECT evolution.provision_region_checkpoint(decode('4145564f52434d31' || '01000000' || '01000000' || '0100000000000000' || '0100000000000000' || '0900000000000000' || repeat('11', 16) || repeat('00', 8) || repeat('00', 16) || repeat('00', 32) || repeat('00', 16) || repeat('00', 16) || repeat('00', 8) || '50c3000000000000' || '020000000200000001000000010000000100000001000000010000000100000001000000' || repeat('b1', 32) || '00000000' || '00000000' || '01000000' || '6400000000000000' || repeat('a0', 32), 'hex'))" > /dev/null
PGDATABASE=v3_commits bash "$root/tools/migrate-postgres.sh"
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) || ':' || string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 17:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) || ':' || string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 18:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) FROM evolution.region_commits")" = 1
# Review P1: a v4 database holding a published (possibly terminal) checkpoint has
# no durable decisions for it. The v5 upgrade must refuse before changing anything.
@@ -144,7 +144,7 @@ PGDATABASE=v6_populated psql -X -v ON_ERROR_STOP=1 \
-c "INSERT INTO evolution.retained_builds VALUES (decode(repeat('b1', 32), 'hex'))" \
-c "SELECT evolution.provision_region_checkpoint(decode('4145564f52434d31' || '02000000' || '01000000' || '0100000000000000' || '0100000000000000' || '0900000000000000' || repeat('11', 16) || repeat('00', 8) || repeat('00', 16) || repeat('00', 32) || repeat('00', 16) || repeat('00', 16) || repeat('00', 8) || '50c3000000000000' || '020000000200000001000000010000000100000001000000010000000100000001000000' || repeat('b1', 32) || '00000000' || '00000000' || '01000000' || '6400000000000000' || repeat('a0', 32) || repeat('00', 80), 'hex'))" > /dev/null
PGDATABASE=v6_populated bash "$root/tools/migrate-postgres.sh"
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT count(*) FROM evolution.region_commits c, LATERAL evolution.parse_checkpoint_manifest(c.manifest) m WHERE m.commit_sequence = 0 AND m.predecessor_commit IS NULL")" = 1
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT string_agg(conname, ',') FROM pg_constraint WHERE conrelid = 'evolution.region_heads'::regclass AND contype = 'c' AND pg_get_constraintdef(oid) LIKE '%end_tick%'")" = region_heads_published_tick
# Inherited privileges bypass fencing, so every migrate run audits effective rights.
+3
View File
@@ -46,6 +46,8 @@ digest_16="$(sha256sum "$root/migrations/0016_primitive_publication.sql")"
digest_16="${digest_16%% *}"
digest_17="$(sha256sum "$root/migrations/0017_life_request_outcomes.sql")"
digest_17="${digest_17%% *}"
digest_18="$(sha256sum "$root/migrations/0018_cellular_profile_admission.sql")"
digest_18="${digest_18%% *}"
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="migration_sha_5=$digest_5" \
@@ -56,5 +58,6 @@ psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
--set="migration_sha_15=$digest_15" \
--set="migration_sha_16=$digest_16" \
--set="migration_sha_17=$digest_17" \
--set="migration_sha_18=$digest_18" \
--set="runtime_role=$runtime_role" \
--file="$root/migrations/apply.sql"