Files
aevolution/migrations/0013_probe_incoming.sql
T
dingoandClaude Opus 5.5 a7a3d12283
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
Wire M10.8c-1 region handoff: protocol v4, durable probes, crossing, ghosts
ADR-0096. Session protocol v4 (v3 is deployed and frozen) adds HandoffOffer,
SessionRedirect, close reasons handed_off and moved, and ghost marker records.
Sessions use the durable probe record: logins open it where it was saved
(redirected when it lives elsewhere), and session ends save it. A marker
crossing into a neighbour's area is frozen, prepared, its control released
and a signed ticket offered; uncommitted transfers are aborted after the
ticket's lifetime. The destination shows arriving probes as ghosts (schema
v13 incoming_probe_transfers) and opens the marker where it crossed.

Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 21:24:42 -04:00

28 lines
1.4 KiB
PL/PgSQL

-- M10.8c incoming probe transfers (ADR-0096). A destination region shows a probe that is
-- being handed to it as a read-only ghost before the switch; there is no region-to-region
-- channel, so it reads the open transfers addressed to it. Read-only, under the caller's
-- exact unexpired region lease like every runtime function. At most 256 rows, oldest first.
CREATE FUNCTION evolution.incoming_probe_transfers(p_world evolution.u64, p_region evolution.u64,
p_holder uuid, p_epoch evolution.u64)
RETURNS TABLE (transfer_id uuid, account_id uuid, source_region evolution.u64, x bigint,
y bigint, z bigint)
LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog, pg_temp AS $$
BEGIN
PERFORM evolution.check_region_lease(p_world, p_region, p_holder, p_epoch);
RETURN QUERY
SELECT t.transfer_id, t.account_id, t.source_region, t.x, t.y, t.z
FROM evolution.probe_transfers t
WHERE t.world_id = p_world AND t.destination_region = p_region
AND t.state IN ('prepared', 'staged')
ORDER BY t.prepared_at, t.transfer_id
LIMIT 256;
END $$;
REVOKE ALL ON FUNCTION
evolution.incoming_probe_transfers(evolution.u64, evolution.u64, uuid, evolution.u64)
FROM PUBLIC;
GRANT EXECUTE ON FUNCTION
evolution.incoming_probe_transfers(evolution.u64, evolution.u64, uuid, evolution.u64)
TO :"runtime_role";
INSERT INTO evolution.schema_migrations(version, sha256) VALUES (13, :'migration_sha_13');