Repository navigation
ably: fix broken log format when presence history data fails to decode - #714
RaphaelFakhri wants to merge 1 commit into
Conversation
RESTPresence history logged the decode failure with %w, which the logger's Printf-style formatting renders as %!w(...). Use %v, as the message decoders in rest_channel.go do.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe presence-message decode-failure log now formats errors with ChangesPresence decode log
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change corrects presence-history decode-failure logs, and the added test checks the resulting diagnostic. No material merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the log at night, Comment |
Description
When
RESTChannel.Presence.Historyreceives a presence message whose data can't be decoded (for example, an unknownencoding), the SDK logs the failure with%w. The logger formats messages withfmt.Sprintf, which doesn't support%w, so the log line ends with%!w(*errors.errorString=&{unknown encoding nonsense})instead of the error text.This change uses
%v, which matches the equivalent messages inrest_channel.go.Testing
Adds
TestRESTPresence_HistoryLogsDecodeFailure. It serves a presence history page with an unknownencodingfrom a local HTTP server, records the log output throughWithLogHandler, and asserts that the decode failure is logged without a formatting error and includes the error text.Without the fix, the test fails with a log line that contains
%!w(. With the fix, it passes.Summary by CodeRabbit