perf: sync protocol and core hardening updates

This commit is contained in:
A 2026-07-11 19:48:26 +08:00
parent 152fed3b87
commit 4390ebf5a9
283 changed files with 29231 additions and 2295 deletions

View file

@ -0,0 +1,16 @@
-- Persist the immutable client intent beside a channel random_id receipt.
--
-- The empty default is intentional for rolling deploys: binaries that predate
-- this migration can continue to insert channel/service messages. Empty
-- fingerprints are legacy/unknown receipts and the replay path rejects them;
-- it never guesses intent from an editable message projection.
ALTER TABLE public.channel_messages
ADD COLUMN request_fingerprint bytea NOT NULL DEFAULT '\x';
ALTER TABLE public.channel_messages
ADD CONSTRAINT channel_messages_request_fingerprint_size
CHECK (octet_length(request_fingerprint) IN (0, 32)) NOT VALID;
-- NOT VALID avoids a blocking historical-table validation scan during the
-- rolling migration while PostgreSQL still enforces the check for every new
-- or updated row. A later maintenance window may validate it online.