Allow cellular births to bind published commits
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m58s
Foundation / checks (checks) (push) Failing after 4m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 7m42s
Foundation / checks (tsan) (push) Canceled after 7m44s

This commit is contained in:
dingo
2026-10-11 21:28:21 -04:00
parent 99f623e116
commit 703758c45c
6 changed files with 101 additions and 4 deletions
@@ -93,6 +93,14 @@ Recovery compares those bindings to the tail trace. The previous action-only
profile-4 SQL entry point is revoked from the runtime role, so deployments must
run a publisher version that supplies the trace before cellular commits resume.
The shared life-binding table accepts commits from either primitive profile 3
or cellular profile 4. Its commit foreign key is deferred to the common region
commit record, and a deferred constraint trigger requires matching, private
profile-specific publication evidence and an un-rejected reservation in the
same region. This lets the cellular publisher insert its binding before its
checkpoint core inserts publication evidence while preserving transaction
atomicity.
## Consequences
`evo-world-clone` creates empty profile-4 genesis only. The M11.3e gate remains
+11
View File
@@ -7026,3 +7026,14 @@ CI run #311 passed client, deploy, ECS, network and TSan, and compiled the Postg
CI run #312 passed client, deploy, ECS and network, but the PostgreSQL-enabled test build found that the new `checked_value` helper only accepted `std::optional`, while the SHA-256 helper returns `std::expected`. The test now provides the same explicit engagement check for `std::expected`; run #312 did not reach PostgreSQL tools or server-image/Harbor publication.
CI run #313 passed client, deploy, ECS, network and TSan; both PostgreSQL compilation configurations completed. The PostgreSQL integration run then failed its final runtime-role audit because the cellular profile-migration publisher and lookup are explicitly granted to the runtime role but were missing from the audit's fenced-function set. Those two lease-fenced functions are now listed, and the online migration test now expects the current schema version 29 after upgrading its v7 fixture. PostgreSQL tools and Harbor publication did not start.
CI run #314 passed client, deploy, ECS, network, TSan, PostgreSQL compilation,
and the runtime-role audit, then failed the first cellular birth publication
integration assertion. The shared life-binding table still had its original
foreign key to primitive-only publication evidence, so a profile-4 birth could
not reference its cellular publication. Schema migration 30 retargets that
foreign key to the common region commit and adds a deferred guard requiring
profile-specific publication evidence, matching region and a live reservation.
The migration test checks the deferred constraints; the cellular publication
integration exercises an actual birth. Run #314 did not start the PostgreSQL
tools or Harbor image jobs; CI validation of migration 30 is pending.
@@ -0,0 +1,50 @@
-- M11.4c playtest gate: player-life bindings may belong to primitive or
-- cellular publications. Both still reference one committed region head.
ALTER TABLE evolution.primitive_life_bindings
DROP CONSTRAINT primitive_life_bindings_commit_id_fkey;
ALTER TABLE evolution.primitive_life_bindings
ADD CONSTRAINT primitive_life_bindings_commit_id_fkey
FOREIGN KEY (commit_id) REFERENCES evolution.region_commits(commit_id)
DEFERRABLE INITIALLY DEFERRED;
-- The binding is inserted before the cellular publication core creates its
-- commit evidence, so validate the polymorphic publication link at transaction
-- end. Profile-specific publishers still validate the trace and birth record.
CREATE FUNCTION evolution.check_life_binding_publication()
RETURNS trigger LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog, pg_temp AS $$
DECLARE
profile integer;
valid_publication boolean;
BEGIN
SELECT evolution.manifest_uint(c.manifest, 12, 4) INTO profile
FROM evolution.region_commits c
JOIN evolution.life_reservations r ON r.world_id = NEW.world_id
AND r.account_id = NEW.account_id AND r.request_id = NEW.request_id
AND r.region_id = c.region_id AND r.rejection = 0 AND r.rules = 1
WHERE c.commit_id = NEW.commit_id AND c.world_id = NEW.world_id
AND c.commit_sequence > 0
AND NEW.born = evolution.manifest_uint(c.manifest, 120, 8);
IF NOT FOUND THEN
RAISE EXCEPTION 'life binding commit or reservation missing' USING ERRCODE = 'EVL06';
END IF;
IF profile = 3 THEN
SELECT EXISTS (SELECT 1 FROM evolution.primitive_publications p
WHERE p.commit_id = NEW.commit_id) INTO valid_publication;
ELSIF profile = 4 THEN
SELECT EXISTS (SELECT 1 FROM evolution.cellular_publications p
WHERE p.commit_id = NEW.commit_id) INTO valid_publication;
ELSE
valid_publication := false;
END IF;
IF NOT valid_publication THEN
RAISE EXCEPTION 'life binding publication evidence missing' USING ERRCODE = 'EVL06';
END IF;
RETURN NULL;
END $$;
REVOKE ALL ON FUNCTION evolution.check_life_binding_publication() FROM PUBLIC;
CREATE CONSTRAINT TRIGGER life_binding_publication_evidence
AFTER INSERT ON evolution.primitive_life_bindings
DEFERRABLE INITIALLY DEFERRED FOR EACH ROW
EXECUTE FUNCTION evolution.check_life_binding_publication();
INSERT INTO evolution.schema_migrations(version, sha256) VALUES (30, :'migration_sha_30');
+13 -3
View File
@@ -103,7 +103,9 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
SELECT right(:'history', length(',27:' || :'migration_sha_27')) = ',27:' || :'migration_sha_27' AS at_v27 \gset
SELECT right(:'history', length(',28:' || :'migration_sha_28')) = ',28:' || :'migration_sha_28' AS at_v28 \gset
SELECT right(:'history', length(',29:' || :'migration_sha_29')) = ',29:' || :'migration_sha_29' AS at_v29 \gset
\if :at_v29
SELECT right(:'history', length(',30:' || :'migration_sha_30')) = ',30:' || :'migration_sha_30' AS at_v30 \gset
\if :at_v30
\elif :at_v29
\elif :at_v28
\ir 0029_cellular_mutation_reservations.sql
\elif :at_v27
@@ -453,7 +455,8 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
coalesce(max(version), 0) = 26 AS at_v26,
coalesce(max(version), 0) = 27 AS at_v27,
coalesce(max(version), 0) = 28 AS at_v28,
coalesce(max(version), 0) = 29 AS at_v29
coalesce(max(version), 0) = 29 AS at_v29,
coalesce(max(version), 0) = 30 AS at_v30
FROM evolution.schema_migrations \gset
\if :at_v24
\ir 0025_cellular_v2_bundle.sql
@@ -461,23 +464,30 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
\ir 0027_cellular_v3_migration.sql
\ir 0028_cellular_v3_trace_bounds.sql
\ir 0029_cellular_mutation_reservations.sql
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v25
\ir 0026_cellular_profile_migration.sql
\ir 0027_cellular_v3_migration.sql
\ir 0028_cellular_v3_trace_bounds.sql
\ir 0029_cellular_mutation_reservations.sql
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v26
\ir 0027_cellular_v3_migration.sql
\ir 0028_cellular_v3_trace_bounds.sql
\ir 0029_cellular_mutation_reservations.sql
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v27
\ir 0028_cellular_v3_trace_bounds.sql
\ir 0029_cellular_mutation_reservations.sql
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v28
\ir 0029_cellular_mutation_reservations.sql
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v29
\ir 0030_cellular_birth_publication_binding.sql
\elif :at_v30
\else
\echo 'Unknown or changed migration history after v29'
\echo 'Unknown or changed migration history after v30'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
\endif
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
+16 -1
View File
@@ -192,6 +192,10 @@ void upgrade_across_migration_and_barrier() {
" -v migration_sha_24=$(s 0024_primitive_life_owner_lookup.sql)"
" -v migration_sha_25=$(s 0025_cellular_v2_bundle.sql)"
" -v migration_sha_26=$(s 0026_cellular_profile_migration.sql)"
" -v migration_sha_27=$(s 0027_cellular_v3_migration.sql)"
" -v migration_sha_28=$(s 0028_cellular_v3_trace_bounds.sql)"
" -v migration_sha_29=$(s 0029_cellular_mutation_reservations.sql)"
" -v migration_sha_30=$(s 0030_cellular_birth_publication_binding.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");
@@ -208,7 +212,18 @@ void upgrade_across_migration_and_barrier() {
" 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,18,19,20,21,22,23,24,25,26,27,28,29");
"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30");
CHECK(scalar(*owner_db,
"SELECT c.condeferrable AND c.condeferred AND "
"c.confrelid = 'evolution.region_commits'::regclass "
"FROM pg_catalog.pg_constraint c WHERE c.conrelid = "
"'evolution.primitive_life_bindings'::regclass AND "
"c.conname = 'primitive_life_bindings_commit_id_fkey'") == "true");
CHECK(scalar(*owner_db,
"SELECT t.tgdeferrable AND t.tginitdeferred FROM pg_catalog.pg_trigger t "
"WHERE t.tgrelid = 'evolution.primitive_life_bindings'::regclass AND "
"t.tgname = 'life_binding_publication_evidence' AND NOT t.tgisinternal") ==
"true");
CHECK(scalar(*owner_db,
"SELECT (to_regprocedure('evolution.primitive_life_owner("
"evolution.u64,evolution.u64,uuid,evolution.u64,uuid)') IS NOT NULL)::text") ==
+3
View File
@@ -70,6 +70,8 @@ digest_28="$(sha256sum "$root/migrations/0028_cellular_v3_trace_bounds.sql")"
digest_28="${digest_28%% *}"
digest_29="$(sha256sum "$root/migrations/0029_cellular_mutation_reservations.sql")"
digest_29="${digest_29%% *}"
digest_30="$(sha256sum "$root/migrations/0030_cellular_birth_publication_binding.sql")"
digest_30="${digest_30%% *}"
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" \
@@ -92,5 +94,6 @@ psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
--set="migration_sha_27=$digest_27" \
--set="migration_sha_28=$digest_28" \
--set="migration_sha_29=$digest_29" \
--set="migration_sha_30=$digest_30" \
--set="runtime_role=$runtime_role" \
--file="$root/migrations/apply.sql"