Repository navigation
Phase 2: deliveries, status callbacks, dedupe, log subscriber - #2
Merged
Merged
Conversation
Convert the Railtie to an isolated Smswire::Engine with an install migrations task and a smswire_deliveries table that follows the app's primary key type. Every send is claimed atomically as a Delivery row before the provider is called; transient errors release the claim so the retry reuses the row, and stale claims expire after two minutes. Identical messages inside dedupe_window return :duplicate. Status callbacks are verified with Twilio's HMAC-SHA1 signature, matched by delivery id or provider message id, and only move status forward. Bodies are stored per category, with otp excluded by default. A log subscriber reports deliveries, rejections, and status updates with masked numbers and no bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5SuBiSMN4r9qr5CXbKkHV
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Phase 2 of
docs/SPEC.md. Stacked on #1; merge that first and this PR will retarget tomain.What's included
Smswire::Enginereplaces the Railtie, withbin/rails smswire:install:migrationsand a status callback route atPOST <mount>/status/:provider.smswire_deliveriesrow per send, with provider id, status, segments, encoding, price, error, attempts, and timestamps. The primary key follows the app's generator setting, as Active Storage does.dedupe_window, 10 minutes by default, return:duplicate. An explicitidempotency_key:ontextoverrides what counts as identical. A unique index makes concurrent duplicates safe.callbacks_url, so TLS-terminating proxies don't break it. Callback URLs carry the delivery id, so a callback that beats the API response still finds its row. Status only moves forward, so late callbacks are ignored. Observers can implementsms_status_updated(delivery, update).otpcategory.Spec decisions settled
to_numberandfrom_number, sincetoandfromare reserved words in PostgreSQL and MySQL.callbacks_urlreplacescallbacks_host, because the engine mount path is part of the URL Twilio signs.reject.smswireand observers.Verification
StatusCallbackcarrying the delivery id. It replays signedsentanddeliveredcallbacks and checks the row moves from pending to queued, sent, and delivered, then ignores a latesent.🤖 Generated with Claude Code
https://claude.ai/code/session_01L5SuBiSMN4r9qr5CXbKkHV