Repository navigation
fix(weekly-digest): trigger on Sunday and add new-guides RSS section - #1761
Conversation
…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%
📝 WalkthroughWalkthroughThe 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. ChangesWeekly digest
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
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
packages/bot/src/services/WeeklyDigestService.spec.tspackages/bot/src/services/WeeklyDigestService.ts
- 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
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
packages/bot/src/services/WeeklyDigestService.spec.tspackages/bot/src/services/WeeklyDigestService.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bot/src/services/WeeklyDigestService.ts
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.
There was a problem hiding this comment.
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
|
🤖 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).



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
CRIATIVARIA_GUIDES_FEED_URLviarss-parser(last 7 days); render title + link.Bug Fixes
Written for commit 12b484c. Summary will update on new commits.
Summary by CodeRabbit