Skip to content

Development SMS test adapter

The development adapter is a real, persistent simulated transport implementing submit and returning Channels::Sms::AdapterResult. It never connects to a network, sends SMS, or posts a webhook. It only runs in Rails development and test; its constructor and submit method both reject other environments. A receipt records the destination, message, simulated outcome and attempt number in PostgreSQL, separately from the Core handoff status. The message and number are sensitive; use fictional data. Receipts are tenant-scoped with forced RLS, and the development/test-only staff view requires an authenticated admin or manager and disables caching. No retention/deletion policy is implemented.

In the trusted development .env set NOTIFI_TEST_ADAPTER=development, NOTIFI_TEST_ADAPTER_OUTCOME=accepted (or rejected / timeout) and set NOTIFI_TEST_HANDOFF_TENANT_IDS to a comma-separated list of explicitly operator-authorized development tenant IDs. The default configuration remains the in-memory adapter and no tenants are polled. Recreate the worker after changing Compose environment variables: docker compose up -d worker. Do not put real phone numbers or incident text into development tests.

For a local manual experiment, identify an authorized development tenant ID, then use the Rails console to prepare a test handoff with fictional values:

TenantContext.with(tenant_id) do
DeliveryTesting::DeliveryHandoffs.prepare_test!(
tenant_id: tenant_id,
request_key: SecureRandom.hex(16),
destination: "+46700000000",
message: "Testmeddelande"
)
end

Once committed, the opt-in worker finds the pending test handoff and records one receipt for each adapter invocation. Log in as a manager or admin of that organization and open Incidenter → Testmeddelanden to inspect the most recent 100 receipts. The application does not currently expose a UI to create test handoffs, nor does the incident simulation submit them. Changing the configured outcome affects subsequent attempts after the worker is recreated.

An accepted result means only that this local test adapter recorded the submission. A rejected result is simulated; a timeout deliberately records a receipt and then produces an indeterminate Core state, never an automatic resubmission. Database persistence failure may leave a submitting/indeterminate handoff and must not be interpreted as acceptance. The request key, destination and message are not emitted in worker logs. A real provider adapter, webhook, callback processing, durable production dispatch, retention and production worker discovery remain future work.