Skip to content

fix: do not send duplicate report before 15m#99

Merged
lorenzocorallo merged 2 commits intomainfrom
report-duplicates
Apr 11, 2026
Merged

fix: do not send duplicate report before 15m#99
lorenzocorallo merged 2 commits intomainfrom
report-duplicates

Conversation

@lorenzocorallo
Copy link
Copy Markdown
Member

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The report functionality is refactored to introduce Redis-backed deduplication preventing duplicate submissions. The TgLogger.report method now returns status strings ("SENT", "ALREADY_SENT", "ERROR") instead of booleans. The command handler uses these statuses to conditionally make replies ephemeral for non-successful outcomes.

Changes

Cohort / File(s) Summary
Report Deduplication Logic
src/modules/tg-logger/index.ts
Added Redis-backed deduplication using RedisFallbackAdapter with deterministic key generation (${chat.id}_${message_id}). Changed report() return type from Promise<boolean> to Promise<REPORT_RESULT> with three explicit statuses: "SENT", "ALREADY_SENT", and "ERROR". Enhanced error handling to return specific status strings instead of boolean values.
Command Integration
src/commands/report.ts
Updated logReport() to import and use ephemeral() function. Changed from ternary boolean reply logic to explicit status-based message construction. Replies from non-successful reports ("ALREADY_SENT" and "ERROR") are now marked as ephemeral, while successful "SENT" replies remain persistent.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preventing duplicate reports within a 15-minute window using Redis-backed de-duplication with a 900-second TTL.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lorenzocorallo lorenzocorallo merged commit 5fc72c3 into main Apr 11, 2026
1 check passed
@lorenzocorallo lorenzocorallo deleted the report-duplicates branch April 11, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants