Schedule poll notifications with Fedify tasks - #649
Conversation
Enqueue expiry tasks after committed poll creation, votes, and remote expiry changes. Reload current recipients and expiry under database locks so stale messages cannot notify early or inflate groups. Recover missed dispatches in bounded cursor passes and remove the polling worker. Cover retries, shutdown, backlog, and shared recovery registration, and update the deployment guides. Fixes fedify-dev#639 Assisted-by: Codex:gpt-6.1-sol Assisted-by: Claude Code:claude-fable-5-1
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (26)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughPoll-expiry notifications now use delayed tasks on the shared Fedify queue. Task handlers reload poll state and recipients, while bounded recovery scans schedule missing work. Poll creation, voting, and federation updates enqueue tasks, and worker configuration and documentation reflect the shared queue. ChangesPoll expiry notifications
Priority: ⬇️ Low Estimated code review effort: 4 (Complex) | ~60 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant PollProducer
participant enqueuePollNotification
participant FedifyTaskQueue
participant notifyExpiredPoll
participant Database
PollProducer->>enqueuePollNotification: poll ID and base URL
enqueuePollNotification->>FedifyTaskQueue: dispatch poll task
FedifyTaskQueue->>notifyExpiredPoll: run task with poll ID
notifyExpiredPoll->>Database: reload poll, post, and recipients
Database-->>notifyExpiredPoll: current expiry and local recipients
notifyExpiredPoll->>FedifyTaskQueue: reschedule if expiry is in the future
notifyExpiredPoll->>Database: create notifications if poll has expired
Merge Risk: ⚪ Minimal · up to No identified issue blocks merging the poll-notification task change after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Current-state reloads and database deduplication protect notification correctness. However, user-driven poll activity now feeds a queue shared with other background operations, without the recovery scanner’s admission check. Queue containment and rollback compatibility remain unresolved. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 14 files. (11 skipped: 11 unsupported.)
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. Comment |
Poll expiry notifications now use the shared Fedify task queue. Tasks are scheduled after database commits and carry only the poll ID. Handlers lock and reload the poll before notifying, so expiry changes and repeated delivery cannot cause early notifications or inflate notification groups.
Recovery scans fill the gap between committing a poll or vote and enqueueing its task. They page through missing notifications, pause when the queue is busy, and advance past failures so the oldest poll cannot stall the backlog. This replaces the dedicated polling worker.
Fixes #639.
Summary by CodeRabbit