mirror of
https://github.com/block/buzz.git
synced 2026-11-27 19:52:31 +00:00
## Summary Two follow-ups to the call-site stacks that escaped relay errors carry: - **Trim:** Sentry parses a whole stack synchronously and has no cap, so a call-site stack is now cut to its innermost 64 lines (async gap lines included). When the kept lines hold no `<asynchronous suspension>` line, one is added after them, so Sentry's stack parser still reads it as a VM stack directly instead of first scanning it for other formats. The cut is made when the stack is first formatted, so an error its caller discards costs no formatting. One `completeErrorAt` helper next to the error types applies it at every completion site, and query timeouts throw with the cut stack too. - **Capture at entry:** `publish`, `fetchHistory` and `SignedEventRelay.submit` took their call site after the rate-limit wait, `mayPublish` or `onSigned`. A caller that doesn't await the call was already gone from the stack by then, so its frame was missing. The call site is now taken before the first `await`. `submit` re-stacks relay call errors from `publish` with its own entry stack, since `publish` only starts after `onSigned`. ### Validation Added tests: [stack trimming](https://github.com/block/buzz/blob/tomb/mobile-relay-stack-trim/mobile/test/shared/relay/relay_call_error_test.dart) (a deep stack is cut to the cap and keeps the frames nearest the call; a short one is kept whole; a cut stack keeps exactly one async gap wherever its first gap falls; the stack is formatted only when read, and only once), and [capture before the wait](https://github.com/block/buzz/blob/tomb/mobile-relay-stack-trim/mobile/test/shared/relay/relay_session_test.dart) for a publish and a history request held by the rate limit and a submit held by `onSigned`, each checking that the caller's frame is on the completed error's stack. Full-app check on an iOS simulator signed in to a Builderlab community: the channel list loads, opening two channels fetches their history, and a sent message publishes and shows as sent. No relay call errors logged. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>