Skip to content

Add inbound reply simulation - #1

Merged
rreinhardt9 merged 1 commit into
mainfrom
cp-15686-inbound-reply-simulation
Sep 21, 2026
Merged

rreinhardt9 merged 1 commit into
mainfrom
cp-15686-inbound-reply-simulation

Conversation

@rreinhardt9

@rreinhardt9 rreinhardt9 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Phase 1 (outbound interception + viewing UI) shipped and is in use; this is phase 2, deliberately deferred until phase 1 had real usage.
  • Adds SmsTrap.reply_handler — a bare callable (#call(from:, to:, text:)) the host app configures in a dev-only initializer to trigger its real inbound-webhook path when a dev submits a reply in the UI. Kept provider-agnostic and symmetric with Connector's outbound shape — sms_trap never knows what's inside the callable.
  • The reply form on the conversation show page only renders when SmsTrap.reply_handler? is true — apps that never need inbound simulation see no dead/disabled UI. Reading reply_handler unset raises SmsTrap::ReplyHandlerNotConfigured (loud, immediate, no silent no-op — matches the gem's existing style).
  • README's "Roadmap" section replaced with a real "Simulating inbound replies" section documenting the contract and a wiring example.

Incidental fix

test/dummy/config/environments/test.rb had config.action_dispatch.show_exceptions = false (a boolean). Rails 7.2's ExceptionWrapper#show? only treats the literal symbol :none as "raise instead of render" — the boolean silently fell through to the render branch, swallowing exceptions that integration tests expect to propagate via assert_raises. Fixed to :none, matching the file's own comment ("Raise exceptions instead of rendering exception templates").

Test plan

  • bin/rails test — 18 runs, 0 failures
  • bundle exec rubocop — clean
  • Manually exercised the full flow against the running dummy app via curl (browser extension wasn't available in this session): empty state → send outbound → conversation list/show render it → reply form present (dummy initializer configures a stand-in handler) → submit reply → inbound bubble appears → dummy handler's log line confirms it was invoked with the correctly-derived from/to (their_number → our_number)

Lets a dev type a reply in the SmsTrap UI and trigger the host app's real
inbound-webhook path via SmsTrap.reply_handler, a bare callable the host app
configures (mirrors Connector's provider-agnostic shape on the outbound
side). The reply form only renders when a handler is configured, so
outbound-only apps see no dead UI; reading reply_handler unset raises
ReplyHandlerNotConfigured.

Also fixes test/dummy's show_exceptions config: Rails 7.2 only treats the
symbol :none as "raise instead of render" — the generated boolean false
was silently swallowing exceptions in integration tests.
@rreinhardt9
rreinhardt9 force-pushed the cp-15686-inbound-reply-simulation branch from a73aa5e to 36ced27 Compare September 21, 2026 20:12
@rreinhardt9 rreinhardt9 changed the title Add inbound reply simulation (CP-15686 phase 2) Add inbound reply simulation Sep 21, 2026
@rreinhardt9
rreinhardt9 merged commit e1d8626 into main Sep 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant