Skip to content

Dispatch storage foundation

The CreateDispatchStorageFoundation migration adds six inert tables under notifi_dispatch: dispatches, recipients, selection reasons, assessments, logical deliveries and their contributions. They are separate from DeliveryTesting. The app has no table or sequence privileges, and there is no creation routine, worker handoff, activation path or provider integration. These tables must not be used for real dispatch data yet.

Each table has forced tenant RLS. Composite foreign keys keep child rows and contributions in the same tenant and dispatch. Basic checks distinguish eligible, excluded and missing assessment shapes. The app cannot read or write these tables; RLS is a separate defense for appropriately privileged roles. The migration is irreversible because deletion of possible future data requires an explicit retention procedure.

This is not a sealed or complete dispatch implementation. In particular, the database does not yet enforce destination/policy matching, one delivery per logical grouping key, graph completeness, frozen-after-commit writes, validation of source identifiers against their source tables, product authorization, idempotency, signed keys, exclusion policy or durable work handoff. Source IDs are currently stored as identifiers without foreign keys; their validation and deletion semantics remain to be designed. Content, actor/audit fields, policy versions and retention requirements remain unfinished. The privileged migration owner can write the tables; withholding app privileges does not make records immutable. No rows should be treated as sendable or as a production snapshot based solely on these tables.

tests/dispatch_storage_migration_test.sh runs the full migration history as notifi_migrator in a disposable PostgreSQL database, dumps/restores into a second provisioned database, reruns provisioning and tests app privilege denial, RLS and representative structural constraints. It does not prove the missing invariants above. Development migrations use ./bin/dev-migrate as required by AGENTS.md; never run the isolated fixture against a real database.