Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m25s
Foundation / postgres-tools (push) Successful in 1m12s
Foundation / server-image (push) Successful in 4m20s
Foundation / image (push) Successful in 4m54s
ADR-0178. Bundle 14 (rules 12 on owner format 10) is admitted by schema 58 through parser-local normalization to bundle 13, with an exact fenced 13 -> 14 upgrade whose only input, the liquid rules, recovery reads from the target. Schema 58 also widens the canonical action input: byte 13 bit 0 is brake. evo-world-clone gains the cellular-v9 opening: cellular-v8 followed by the liquid upgrade from --tuning FILE (region size must match) and an optional --current-seed; resumable and idempotent at bundle 14. Session v13 adds the owner's velocity, heading and the region's current configuration to its perception, each deposit's world velocity, and a brake on cellular actions; older sessions keep their layouts. A rules-12 server lists every pool and the nearest 256 moving bubbles. The client speaks v13, brakes on Space (rebindable; older controls files take the default), draws currents as drifting streaks and carries bubbles along their velocities between perceptions. Tests: protocol v13 round trips and refusals, action-input brake, controls files, and a PostgreSQL cellular-v9 provisioning test whose player is born, swims and brakes through the live host. Full local PostgreSQL qualification, the Linux debug suite and the Windows client suite pass. Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
133 lines
10 KiB
Bash
133 lines
10 KiB
Bash
#!/usr/bin/env bash
|
|
# Private postgres-check cluster only. No deployed database or biological rules.
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
createdb evo_history_domain
|
|
export PGDATABASE=evo_history_domain
|
|
bash "$root/tools/migrate-postgres.sh" > /dev/null
|
|
sql() { psql -XAt --no-password -v ON_ERROR_STOP=1 "$@"; }
|
|
fail() { echo "history-domain qualification FAILED: $*" >&2; exit 1; }
|
|
original="$(sql -c 'SELECT evolution.load_history_domain_v1()')"
|
|
[ -n "$original" ] || fail 'missing adoption domain'
|
|
bash "$root/tools/migrate-postgres.sh" > /dev/null
|
|
[ "$(sql -c 'SELECT evolution.load_history_domain_v1()')" = "$original" ] || fail 'no-op changed domain'
|
|
work="$(mktemp -d /tmp/evo-history-domain.XXXXXXXX)"
|
|
objects="$work/objects"
|
|
mkdir -m 700 "$objects"
|
|
trap 'rm -rf -- "$work"' EXIT
|
|
"${EVO_WORLD_CLONE_BIN:?private fixture tool}" provision --world 70201 --region 1 \
|
|
--opening development-v1 --pg-host "$PGHOST" --pg-port "$PGPORT" \
|
|
--pg-database "$PGDATABASE" --pg-user "$PGUSER" --objects "$objects" \
|
|
--build "$(printf 'cd%.0s' {1..32})" --retain-build true > /dev/null
|
|
request=51515151-5151-5151-5151-515151515151
|
|
if sql -c "SELECT evolution.fork_restored_history_v1('$request')" > /dev/null 2>&1; then
|
|
fail 'fork accepted a current build'
|
|
fi
|
|
[ "$(sql -c 'SELECT evolution.load_history_domain_v1()')" = "$original" ] || fail 'refusal mutated domain'
|
|
sql -c 'UPDATE evolution.retained_builds SET retired_at=clock_timestamp()' > /dev/null
|
|
if PGUSER="$EVO_PG_RUNTIME_USER" sql -c "SELECT evolution.fork_restored_history_v1('$request')" > /dev/null 2>&1; then
|
|
fail 'runtime can fork history'
|
|
fi
|
|
if PGUSER="$EVO_PG_RUNTIME_USER" sql -c 'SELECT * FROM evolution.current_history_domain' > /dev/null 2>&1; then
|
|
fail 'runtime can access context tables'
|
|
fi
|
|
sql -c "UPDATE evolution.region_leases SET epoch=1, holder=pg_catalog.gen_random_uuid(), expires_at=clock_timestamp()+interval '1 hour'" > /dev/null
|
|
if sql -c "SELECT evolution.fork_restored_history_v1('$request')" > /dev/null 2>&1; then
|
|
fail 'fork accepted a held lease'
|
|
fi
|
|
sql -c 'UPDATE evolution.region_leases SET holder=NULL, expires_at=NULL' > /dev/null
|
|
# An aborted transaction leaves both the namespace and provenance unchanged.
|
|
sql -c "BEGIN; SELECT evolution.fork_restored_history_v1('$request'); ROLLBACK" > /dev/null
|
|
[ "$(sql -c 'SELECT count(*) FROM evolution.history_domains')" = 1 ] &&
|
|
[ "$(sql -c 'SELECT count(*) FROM evolution.history_domain_cuts')" = 0 ] || fail 'rollback retained fork evidence'
|
|
fork="$(sql -c "SELECT evolution.fork_restored_history_v1('$request')")"
|
|
[ "$fork" != "$original" ] && [ -n "$fork" ] || fail 'fork reused parent domain'
|
|
[ "$(sql -c "SELECT evolution.fork_restored_history_v1('$request')")" = "$fork" ] &&
|
|
[ "$(sql -c 'SELECT count(*) FROM evolution.history_domains')" = 2 ] || fail 'retry duplicated fork'
|
|
[ "$(PGUSER="$EVO_PG_RUNTIME_USER" sql -c 'SELECT evolution.load_history_domain_v1()')" = "$fork" ] || fail 'runtime context read'
|
|
[ "$(sql -c "SELECT parent::text||':'||kind FROM evolution.history_domains WHERE domain='$fork'")" = "$original:restore" ] || fail 'parent provenance'
|
|
[ "$(sql -c "SELECT count(*) FROM evolution.history_domain_cuts d JOIN evolution.region_heads h USING(world_id,region_id) JOIN evolution.region_leases l USING(world_id,region_id) WHERE d.domain='$fork' AND d.frame_id=l.frame_id AND d.commit_sequence=h.commit_sequence AND d.commit_id=h.commit_id AND d.digest=h.digest AND d.end_tick=h.end_tick")" = 1 ] || fail 'exact fork cuts'
|
|
sql -c "SELECT evolution.fork_restored_history_v1('52525252-5252-5252-5252-525252525252')" > /dev/null
|
|
if sql -c "SELECT evolution.fork_restored_history_v1('$request')" > /dev/null 2>&1; then
|
|
fail 'stale request switched context backwards'
|
|
fi
|
|
for invalid in NULL "'00000000-0000-0000-0000-000000000000'"; do
|
|
if sql -c "SELECT evolution.fork_restored_history_v1($invalid)" > /dev/null 2>&1; then
|
|
fail 'invalid request accepted'
|
|
fi
|
|
done
|
|
# Reconstruct the exact pre-context metadata schema in this disposable database.
|
|
# Restore the resulting real legacy backup through both supported workflows.
|
|
# Undo schema 58's bundle-14 wrappers, schema 57's bundle-13 wrappers, schema 56's joint profile, schema 55's plan validators, schema 54's three
|
|
# replacements and schema 53; the backup must contain the actual pre-context
|
|
# function contracts and privileges.
|
|
awk '/^CREATE FUNCTION evolution\.admit_population_interval\(/ {capture=1; sub(/^CREATE FUNCTION/,"CREATE OR REPLACE FUNCTION")} capture {print} capture && /^END \$\$;/ {capture=0}' \
|
|
"$root/migrations/0045_owned_population_intervals.sql" | sql > /dev/null
|
|
awk '/^CREATE FUNCTION evolution\.(check_cellular_migration_trace|prepare_cellular_migration_freeze|publish_cellular_migration)\(/ {capture=1; sub(/^CREATE FUNCTION/,"CREATE OR REPLACE FUNCTION")} capture {print} capture && /^END \$\$;/ {capture=0}' \
|
|
"$root/migrations/0047_cellular_migration_freeze.sql" \
|
|
"$root/migrations/0049_cellular_migration_publication.sql" | sql > /dev/null
|
|
awk '/^CREATE OR REPLACE FUNCTION evolution\.(cellular_mutation_selections|check_cellular_mutation_block)\(/ {capture=1} capture {print} capture && /^END \$\$;/ {capture=0}' \
|
|
"$root/migrations/0040_cellular_mutation_decline.sql" | sql > /dev/null
|
|
# Schema 58 widened the canonical action input; restore schema 36's validator.
|
|
awk '/^CREATE OR REPLACE FUNCTION evolution\.valid_cellular_action_input\(/ {capture=1} capture {print} capture && /^END \$\$;/ {capture=0}' \
|
|
"$root/migrations/0036_cellular_v5_budding_bundle.sql" | sql > /dev/null
|
|
sql -v runtime_role="$EVO_PG_RUNTIME_ROLE" > /dev/null <<'SQL'
|
|
DROP FUNCTION evolution.publish_cellular_profile_migration(bytea);
|
|
ALTER FUNCTION evolution.publish_cellular_profile_migration_v57(bytea) RENAME TO publish_cellular_profile_migration;
|
|
DROP FUNCTION evolution.cellular_births(bytea,bytea);
|
|
ALTER FUNCTION evolution.cellular_births_v57(bytea,bytea) RENAME TO cellular_births;
|
|
DROP FUNCTION evolution.parse_checkpoint_manifest(bytea);
|
|
ALTER FUNCTION evolution.parse_checkpoint_manifest_v57(bytea) RENAME TO parse_checkpoint_manifest;
|
|
DROP FUNCTION evolution.publish_cellular_profile_migration(bytea);
|
|
ALTER FUNCTION evolution.publish_cellular_profile_migration_v56(bytea) RENAME TO publish_cellular_profile_migration;
|
|
DROP FUNCTION evolution.cellular_births(bytea,bytea);
|
|
ALTER FUNCTION evolution.cellular_births_v56(bytea,bytea) RENAME TO cellular_births;
|
|
DROP FUNCTION evolution.parse_checkpoint_manifest(bytea);
|
|
ALTER FUNCTION evolution.parse_checkpoint_manifest_v56(bytea) RENAME TO parse_checkpoint_manifest;
|
|
DROP TRIGGER region_environment_evidence ON evolution.region_commits;
|
|
DROP FUNCTION evolution.refuse_unpublished_environment();
|
|
DROP FUNCTION evolution.load_environment_evidence(evolution.u64,evolution.u64,uuid,evolution.u64,uuid);
|
|
DROP FUNCTION evolution.resolve_environment_commit(evolution.u64,evolution.u64,uuid,bytea,bytea);
|
|
DROP FUNCTION evolution.publish_environment_profile_transition(bytea);
|
|
DROP FUNCTION evolution.publish_environment_checkpoint(bytea,bytea);
|
|
DROP FUNCTION evolution.check_environment_trace(bytea,bytea);
|
|
DROP TABLE evolution.environment_publications, evolution.environment_profile_transitions;
|
|
DROP FUNCTION evolution.parse_checkpoint_manifest(bytea);
|
|
DROP FUNCTION evolution.parse_checkpoint_manifest_v55(bytea);
|
|
DROP FUNCTION evolution.parse_checkpoint_manifest_v54(bytea);
|
|
ALTER FUNCTION evolution.parse_checkpoint_manifest_v52(bytea) RENAME TO parse_checkpoint_manifest;
|
|
DROP FUNCTION evolution.cellular_births(bytea,bytea);
|
|
DROP FUNCTION evolution.cellular_births_v54(bytea,bytea);
|
|
ALTER FUNCTION evolution.cellular_births_v52(bytea,bytea) RENAME TO cellular_births;
|
|
DROP FUNCTION evolution.check_population_trace(bytea,bytea);
|
|
ALTER FUNCTION evolution.check_population_trace_v52(bytea,bytea) RENAME TO check_population_trace;
|
|
DROP FUNCTION evolution.publish_cellular_profile_migration(bytea);
|
|
DROP FUNCTION evolution.publish_cellular_profile_migration_v54(bytea);
|
|
ALTER FUNCTION evolution.publish_cellular_profile_migration_v52(bytea) RENAME TO publish_cellular_profile_migration;
|
|
GRANT EXECUTE ON FUNCTION evolution.publish_cellular_profile_migration(bytea) TO :"runtime_role";
|
|
DROP FUNCTION evolution.publish_population_profile_transition_v44(bytea);
|
|
ALTER FUNCTION evolution.publish_population_profile_transition_v52(bytea) RENAME TO publish_population_profile_transition_v44;
|
|
DROP FUNCTION evolution.fork_restored_history_v1(uuid);
|
|
DROP FUNCTION evolution.load_world_cellular_migrations_v1(evolution.u64);
|
|
DROP FUNCTION evolution.load_history_domain_v1();
|
|
DROP TABLE evolution.history_domain_cuts, evolution.current_history_domain, evolution.history_domains;
|
|
ALTER TABLE evolution.cellular_mutation_action_publications DROP CONSTRAINT cellular_mutation_action_publications_result_check;
|
|
ALTER TABLE evolution.cellular_mutation_action_publications ADD CONSTRAINT cellular_mutation_action_publications_result_check CHECK(result BETWEEN 0 AND 3);
|
|
DELETE FROM evolution.schema_migrations WHERE version>=51;
|
|
UPDATE evolution.retained_builds SET retired_at=NULL;
|
|
SQL
|
|
bash "$root/tools/backup/backup-world.sh" --objects "$objects" --out "$work/legacy" --label legacy-context > /dev/null
|
|
createdb evo_history_legacy_isolated
|
|
PGDATABASE=evo_history_legacy_isolated bash "$root/tools/backup/restore-world.sh" \
|
|
--bundle "$work/legacy" --objects "$work/isolated" > "$work/isolated.log" 2>&1 ||
|
|
{ cat "$work/isolated.log" >&2; fail 'legacy isolated restore'; }
|
|
[ "$(PGDATABASE=evo_history_legacy_isolated sql -c "SELECT to_regprocedure('evolution.load_history_domain_v1()') IS NULL")" = t ] || fail 'invented legacy source context'
|
|
createdb evo_history_legacy_inplace
|
|
PGDATABASE=evo_history_legacy_inplace bash "$root/tools/backup/restore-world.sh" \
|
|
--bundle "$work/legacy" --objects "$work/inplace" --in-place \
|
|
--runtime-role "$EVO_PG_RUNTIME_ROLE" --accept-rewind > "$work/inplace.log" 2>&1 ||
|
|
{ cat "$work/inplace.log" >&2; fail 'legacy in-place restore'; }
|
|
[ "$(PGDATABASE=evo_history_legacy_inplace sql -c "SELECT count(*) FROM evolution.history_domains WHERE kind='adoption' AND parent IS NULL AND request IS NULL")" = 1 ] &&
|
|
[ "$(PGDATABASE=evo_history_legacy_inplace sql -c 'SELECT count(*) FROM evolution.history_domain_cuts')" = 0 ] || fail 'invented legacy branch provenance'
|
|
echo 'history-domain adoption, quarantine, rollback, exact cuts, retries, privileges and legacy restores passed'
|