fix(stats): preserve completed global stats shards on dispatcher retries#2581
fix(stats): preserve completed global stats shards on dispatcher retries#2581riderx wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughAdds two helpers ( ChangesLogsnag Insights Missing-Shard Retry Dispatch
knip.json Playwright Config Ignore
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Dispatcher retries were resetting completed_shards and re-queuing every shard, wiping partial daily snapshot progress introduced by the June sharded logsnag pipeline. Co-authored-by: Cursor <cursoragent@cursor.com>
The visual diff routes are loaded dynamically after git checkout, so knip cannot trace their usage and was failing the dead code check on main. Co-authored-by: Cursor <cursoragent@cursor.com>
a8f9d9a to
8c028cf
Compare
|





Summary
resetGlobalStatsCompletedShards()and re-queue every shard; they now queue only missing shards and keep existingcompleted_shardsprogress.Root cause
Cloudflare Workers logs (via GraphQL analytics) show no elevated worker error rates, but code review of the new sharded pipeline shows this failure mode:
logsnag_insightsdispatcher queues shard jobs and reserves a delayed retry message.global_stats.completed_shards.completed_shardsto[]and re-queued all shards.completed_shards @> required), so partial snapshots never appear.Test plan
bun test tests/logsnag-insights-revenue.unit.test.tsglobal_statsrows after 2026-06-17 get all required shards and appear in admin global stats trendMade with Cursor
Summary by CodeRabbit
Refactor
Tests
Chores