Files
accounted/lib/support
Jakob Wennberg de461c2cf8 feat(support): report both channel outcomes on the feedback breadcrumb (#1252)
* feat(support): report both channel outcomes on the feedback breadcrumb

support_feedback_submitted recorded only whether the email delivered, so
"did the PostHog ticket actually open?" was unanswerable from PostHog.
The first time Support shipped, the only way to check was to reproduce
the submission with devtools open.

Both channels fail silently from the user's side, which is why this is
worth instrumenting: email is the delivery guarantee, so the UI shows
success even when the ticket failed, and a ticket that never opened
leaves nothing in PostHog Support to look at either.

Adds `email`, `ticket` and a derived `lost` to the event. `delivered` is
kept as-is so any existing insight filtering on it keeps working.

ticket: 'unavailable' is deliberately distinct from 'failed'.
Unavailable is the expected steady state (Support disabled, analytics
disabled, self-hosted); failed means conversations were live and the
call still did not land. Collapsing them would make the useful signal
unalertable. `lost` is true only when the message reached neither
channel, which is the one property worth an alert.

Still carries no message body: a test pins that free text never appears
in event properties.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(support): run the ticket call concurrently and cap it

Addresses CodeRabbit's three findings on #1252.

The real one: submitFeedback awaited submitViaTicket AFTER the email,
so a hung sendMessage would hold the confirmation dialog open for as
long as it hung. The code comment claimed a slow ticket "must never
delay" the user while the code did exactly that.

Both channels now start together, so the user waits max(email, ticket)
rather than the sum, and the ticket is additionally capped at 4s. On
expiry it resolves to a new 'timeout' outcome rather than being rounded
to 'failed', keeping "conversations were live but slow" distinguishable
from "conversations errored". Email still decides ok either way.

Also: renamed the lost-state test, which claimed both channels failed
while configuring ticket: 'unavailable', and added the genuinely-failed
case alongside it plus coverage for the hanging-call path. Reformatted
the decision-log entry to the required [date] <decision>: <why> shape.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 19:30:34 +02:00
..