fix(badges): make the unavailable-campaign warning readable in Sentry - #2647
Conversation
The warning logged an array of objects as its second console argument. Sentry's console integration serializes each argument, and an array of objects lands in the issue as the literal "[Object]" — so the two facts the warning exists to carry, which campaign and why, were both unreadable in production. Two users hit it since the badge release and neither event says which campaign failed. Pre-join the pairs into one string. The message itself stays constant so Sentry keeps grouping these into a single issue rather than opening one per campaign combination. Test asserts the payload is a string, names both campaigns and reasons, and pins the message constant. Verified non-vacuous: reinstating the object array fails it, restoring the join passes.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe registration warning for unavailable badge campaigns now uses readable ChangesCampaign warning output
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code-analysis diffPainscore total: 7133.95 → 7134.13 (+0.18) 🆕 New findings (7)
✅ Resolved (7)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
The problem
PEANUT-UI-SHW— "Campaign unavailable during registration" — has fired for 2 users since the badge platform release. The Sentry event body is:Sentry's console integration serializes each console argument. The second argument was an array of objects, which serializes to the literal
"[Object]". So the warning carries neither of the two facts it exists to report: which campaign and why.The behaviour itself is correct — this is the expected path when someone registers with a link to one of the four campaigns retired in the release, and registration still completes. But as shipped the warning is unactionable: you cannot tell a retired campaign from a genuinely broken active one.
The fix
Pre-join the pairs into a single string:
The Sentry event now reads
"irl-nomads=inactive, ethfloripa=unknown".The message stays constant on purpose. Interpolating campaign names into the message string would have been the obvious fix, but Sentry groups console issues by message — that would open a new issue per campaign combination and fragment a single low-volume warning into many. Keeping the message fixed and putting the detail in the argument gets readable data and stable grouping.
Test
Added to
useZeroDev-invite-onboarding.test.tsx. It asserts the payload is astring, that it names both campaigns and both reasons, and that the message is unchanged (the grouping guard).Verified non-vacuous — reinstating the object array fails the test, restoring the join passes:
Verification
tsc --noEmitcleanprettier— both files already conformantRisk
None to behaviour. This changes only what gets written to the console/Sentry on an already-correct branch. No control flow, no user-visible surface.
Follow-up to the badge platform release (#2613), found in the post-release Sentry sweep.
Summary by CodeRabbit