caelum0x 1bbce8d338 fix(bridge): the signed message id names its route and a late orgs sync never flips an entitlement (P-Y1)
Contract scribase-bridge version 2:
- webhook-id is msg_<route>_<24 hex>; the id is inside the Standard Webhooks
  signed content, so a signature made for one route is refused on another
  (401, fixture wrong_route). ai and ai_usage cannot be confused.
- every orgs request carries addon.as_of (Scribase's epoch ms of the state).
  Railyard stores it (migration 0004, addon_as_of) and applies a sync only
  when no newer state is stored: one guarded PATCH through PostgREST. An older
  sync answers 200 with stale: true and changes nothing.
- RAILYARD_BRIDGE_ACCEPT_LEGACY=1 (default off) accepts the P1 sender for the
  minutes between the console and control-api deploys; it never lets an id
  that names another route through.

Tests: bridge 15/15 (3 new), contract 3/3 with the new cases, postgrest-repo
and migration 11/11 (0004 applied twice on a scratch cluster, guarded update
proven in SQL), console suite 66/66, bundle 3/3, tsc clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 23:33:47 +03:00
..