Skip to content

fix(weekly-digest): trigger on Sunday and add new-guides RSS section - #1761

Merged
LucasSantana-Dev merged 6 commits into
mainfrom
feat/digest-sunday-rss
Jul 10, 2026
Merged

LucasSantana-Dev merged 6 commits into
mainfrom
feat/digest-sunday-rss

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

Closes the two real gaps found by gap analysis against web-app issue #131 (everything else already shipped in PR #1609): trigger moved Monday→Sunday 12:00 UTC (9h BRT) with the week-window + idempotency math re-anchored coherently, and a 'Novos guias da semana' section fed from the web-app guides feed (≤3 bullets, omitted when empty, fail-soft on fetch error — digest always sends). 29/29 spec tests; full bot suite 2637/0. Cross-repo: Criativaria-Projects/web-app#131.


Summary by cubic

Moves the weekly digest to Sunday 12:00 UTC and adds a “Novos guias da semana” section powered by the guides RSS feed. Re-anchors the week window to Sunday to keep idempotency correct and closes gaps in Criativaria-Projects/web-app#131.

  • New Features

    • Trigger now runs on Sunday at 12:00 UTC; week math anchored to Sunday.
    • Fetch up to 3 new guides from CRIATIVARIA_GUIDES_FEED_URL via rss-parser (last 7 days); render title + link.
    • Omit the guides section when empty and fail soft on fetch errors (digest still sends).
  • Bug Fixes

    • Validate RSS dates; skip undated, unparsable, future, and out-of-window items.
    • Handle unsorted feeds without dropping newer in-window items.
    • Enforce Discord embed limits: truncate titles to 80 chars with ellipsis and cap field value at 1024 chars; skip only the overlong bullet and keep later items.

Written for commit 12b484c. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Weekly digests are now sent on Sundays at 12:00 UTC.
    • Digests can include a “New guides this week” section (up to three RSS items), shown only when available.
    • Guide titles are trimmed to fit embed limits, with an overall guides field size cap.
  • Bug Fixes
    • RSS feed problems no longer block digests; the guides section is omitted and an error is logged.
    • Duplicate weekly digests prevention now aligns with the Sunday-anchored schedule.
  • Tests
    • Expanded coverage for RSS-guides inclusion/exclusion and fail-soft behavior.

…ction

- Change trigger from Monday to Sunday at 12:00 UTC (dayOfWeek 0)
- Adjust week-boundary math to Sunday-anchor (startOfThisWeek = day - dayOfUTC, not day - dayOfUTC + 1)
- Add getNewGuidesThisWeek() method to fetch RSS feed items from CRIATIVARIA_GUIDES_FEED_URL
- Filter feed items to this week's window, render ≤3 guides with title + link
- Omit guides section when zero items; fail soft on fetch error (digest sends without section)
- Extend WeeklyDigestService.spec.ts with tests: Sunday trigger, week-window correctness, RSS rendering, zero-items omission, fetch-failure fail-soft
- All 2637 bot suite tests pass; new_coverage ≥80%
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The weekly digest now runs on Sundays at 12:00 UTC with a Sunday-based idempotency window. It fetches recent RSS guides, adds up to three guide links to the digest, and continues sending when RSS retrieval fails.

Changes

Weekly digest

Layer / File(s) Summary
Sunday scheduling and idempotency
packages/bot/src/services/WeeklyDigestService.ts, packages/bot/src/services/WeeklyDigestService.spec.ts
The send window and weekly baseline move from Monday to Sunday, with updated timing, re-entrancy, recent-send, and snapshot tests.
RSS guide retrieval and embedding
packages/bot/src/services/WeeklyDigestService.ts, packages/bot/src/services/WeeklyDigestService.spec.ts
Recent RSS items are filtered, limited to three guides, and rendered as an optional embed field with title and field-size limits; empty feeds omit the field and fetch failures are logged while the digest is still sent.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WeeklyDigestService
  participant rss-parser
  participant buildDigestEmbed
  WeeklyDigestService->>rss-parser: parseURL RSS feed
  rss-parser-->>WeeklyDigestService: RSS items
  WeeklyDigestService->>WeeklyDigestService: filter recent items and limit to 3
  WeeklyDigestService->>buildDigestEmbed: pass newGuides
  buildDigestEmbed-->>WeeklyDigestService: optional guides field
  WeeklyDigestService->>WeeklyDigestService: send digest
Loading

Possibly related PRs

Suggested labels: dependencies, size/xl

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving the weekly digest to Sunday and adding an RSS-based new-guides section.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/digest-sunday-rss

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

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/bot/src/services/WeeklyDigestService.spec.ts
Comment thread packages/bot/src/services/WeeklyDigestService.spec.ts
Comment thread packages/bot/src/services/WeeklyDigestService.ts
Comment thread packages/bot/src/services/WeeklyDigestService.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bot/src/services/WeeklyDigestService.spec.ts`:
- Around line 543-581: Strengthen the RSS guide tests around
WeeklyDigestService.tick by inspecting the embed payload passed to
digestChannel.send, rather than only asserting that a message was sent. Verify
the sent embed includes the expected guide section and both guide titles/links
(and apply the same assertions to the related test around the second referenced
range), so the tests fail when guides are omitted or not rendered.

In `@packages/bot/src/services/WeeklyDigestService.ts`:
- Around line 489-498: Cap the formatted guide field before passing it to
embed.addFields in the newGuides handling block. Build the title/link entries
from getNewGuidesThisWeek(), ensure the combined guidesList does not exceed
Discord’s 1,024-character field limit (truncating entries or omitting additional
ones as needed), and then add the safely bounded value.
- Around line 395-404: Update the feed filtering logic in the weekly digest
item-processing method to parse and validate each publication date, accepting
only finite dates within the interval from oneWeekAgo through the current time;
skip items with missing, invalid, or future dates. Remove the early break based
on item ordering so unordered feeds continue being scanned for valid recent
items.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d09a6ede-5ff0-485a-987b-8497850aa024

📥 Commits

Reviewing files that changed from the base of the PR and between d271d77 and a17e6a5.

📒 Files selected for processing (2)
  • packages/bot/src/services/WeeklyDigestService.spec.ts
  • packages/bot/src/services/WeeklyDigestService.ts

Comment thread packages/bot/src/services/WeeklyDigestService.spec.ts
Comment thread packages/bot/src/services/WeeklyDigestService.ts Outdated
Comment thread packages/bot/src/services/WeeklyDigestService.ts
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) July 10, 2026 17:45
LucasSantana-Dev and others added 3 commits July 10, 2026 14:45
- date validation: only include items with valid parseable dates (skip
  undated, unparsable, future, and out-of-window items); use continue
  instead of break to handle unsorted feeds
- embed field cap: truncate titles to 80 chars + ellipsis and hard-cap
  field value at 1024 chars to avoid Discord rejection
- strengthen tests: assert embed field content and absence, not just
  send() call
- add 4 new tests: undated/future skipped, unsorted feed includes newer
  items, long title truncation keeps field under 1024 chars

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bot/src/services/WeeklyDigestService.spec.ts`:
- Around line 769-821: Update the test “truncates long titles and enforces field
value cap at 1024 chars” so its fixture content exceeds 1024 characters, using
sufficiently long links or additional feed items. Assert not only that
guidesField.value is at most 1024 characters, but also that content beyond the
cap is omitted, ensuring the field-cap logic is genuinely exercised.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11c97368-55d5-4563-8bdd-1a9bfae880d8

📥 Commits

Reviewing files that changed from the base of the PR and between a17e6a5 and 571d4a8.

📒 Files selected for processing (2)
  • packages/bot/src/services/WeeklyDigestService.spec.ts
  • packages/bot/src/services/WeeklyDigestService.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bot/src/services/WeeklyDigestService.ts

Comment thread packages/bot/src/services/WeeklyDigestService.spec.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/bot/src/services/WeeklyDigestService.ts Outdated
Comment thread packages/bot/src/services/WeeklyDigestService.spec.ts
An over-long single URL no longer suppresses later valid guides.
Cap test made non-vacuous: an overlong link forces the 1024 cap to
fire and asserts the following bullet still renders.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: Adds RSS feed feature and changes digest schedule; missing package.json dependency declaration for rss-parser.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit f429fc6 into main Jul 10, 2026
48 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the feat/digest-sunday-rss branch July 10, 2026 20:09
LucasSantana-Dev added a commit that referenced this pull request Jul 13, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>2.35.0</summary>

##
[2.35.0](v2.34.0...v2.35.0)
(2026-07-13)


### Features

* **bot:** /bulk-kick — proof-of-pattern for the bulk-* command family
([#1802](#1802))
([1c11f3e](1c11f3e))
* **bot:** add lucky_bot_gateway_connected zombie-detection gauge
([#1774](#1774))
([6cc5287](6cc5287))
* **bot:** playback progress bar in nowplaying/songinfo embed
([#1797](#1797))
([1138b59](1138b59))
* **bot:** post server-count stats to Top.gg for listing visibility
([#1789](#1789))
([e8ca6b9](e8ca6b9))
* **bot:** temporary support ticket channels (/ticket)
([#1803](#1803))
([49601a1](49601a1))
* **live-notif:** youtube polling, message ttl cleanup, api backoff
([#1762](#1762))
([a99b85a](a99b85a))
* **remind:** channel and role broadcast reminders
([#1767](#1767))
([#1807](#1807))
([83ade79](83ade79))


### Bug Fixes

* **backend:** artist suggestions 503 not 500 on upstream timeout
([#1787](#1787))
([eadc20e](eadc20e))
* **bot:** guard skipReason telemetry against null prisma client
([#1773](#1773))
([d73421e](d73421e))
* **ci:** stop auto-update workflow racing on merge push
([#1811](#1811))
([2ddd202](2ddd202))
* **csp:** allow Cloudflare Insights beacon in script-src/connect-src
([#1788](#1788))
([f20c4cf](f20c4cf))
* **deps:** bump eslint in lock to satisfy npm@12 ci (unblock release)
([#1809](#1809))
([68fd0be](68fd0be))
* paginate bulk-move message fetch to respect discord api limit
([#1776](#1776))
([5b5d2fc](5b5d2fc))
* **weekly-digest:** trigger on Sunday and add new-guides RSS section
([#1761](#1761))
([f429fc6](f429fc6))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
This was referenced Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant