Skip to content

feat(#126): display showcase posts in fortnightly showcase-digest - #134

Open
michal-skraburski wants to merge 29 commits into
r-webdev:mainfrom
michal-skraburski:showcase-digest
Open

michal-skraburski wants to merge 29 commits into
r-webdev:mainfrom
michal-skraburski:showcase-digest

Conversation

@michal-skraburski

Copy link
Copy Markdown
Contributor

This PR closes #126.

Configuration

4 new configuration options were added:

  • Pingable role "Showcase Digest Role". (Non-optional)
  • Showcase Digest output channel. (Non-optional)
  • Showcase Emoji. (Optional, needs identifier, defaults to thumbsup emoji) 1.
  • Showcase Lookback (LOOKBACK_N) in Days (Optional, defaults to 14)

1. %F0%9F%91%8D is what the thumbsup emoji looks like, this is due to the way we currently grab identifiers

Showcase triggers

This feature runs a cron job exactly 16:00 UTC+0 every fortnight Friday, as well as permitting only moderators to run a manual digest:
This is achieved statelessly (survives restarts) by using the week index since epoch time, the cron job technically fires every week but it checks whether but this week should fire based on INTERVAL_WEEKS=Math.Round(LOOKBACK_N / 7) plugged into currentWeekIndex() % INTEVERAL_WEEKS. See features/showcase-digest/triggers.ts.

Current state

A showcase digest currently looks like this:
image

Following this definition of the issue: #126 (comment)

@michal-skraburski michal-skraburski changed the title Showcase digest: display showcase posts feat: display showcase posts in fortnightly showcase-digest Oct 15, 2026
@wiktoriavh wiktoriavh changed the title feat: display showcase posts in fortnightly showcase-digest feat(#126): display showcase posts in fortnightly showcase-digest Oct 18, 2026
@wiktoriavh
wiktoriavh self-requested a review October 18, 2026 10:03
Comment thread src/features/ready/index.ts Outdated
Comment thread src/features/showcase-digest/handlers.ts Outdated
Comment thread src/features/showcase-digest/handlers.ts Outdated
Comment thread src/features/showcase-digest/handlers.ts Outdated
Comment thread src/features/showcase-digest/handlers.ts Outdated
Comment thread src/features/showcase-digest/util.ts Outdated
Comment thread src/features/showcase/create-showcase.ts
Comment thread src/env.ts Outdated
Comment thread src/env.ts Outdated
Comment thread .env.example Outdated
@wiktoriavh

wiktoriavh commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

You should run the linter and formatter as well, to fix some smaller issues.
We have a pre-commit in the repo, make sure it is properly installed, maybe it didn't run when you committed.

I can also suggest to use AI for a simple code-review beforehand, it is good at pattern finding and would find some issues, like the misspelled emoji, the shortend variable names and such, since it is described in the agents file. On claude you can do /code-review low, here is an output example on your branch:

src/features/showcase-digest/config.ts:6 — Number.parseInt never throws, so the try/catch is dead. A non-numeric SHOWCASE_DIGEST_LOOKBACK_DAYS (e.g. abc) yields NaN, and filterPostsByCreationTime then never matches, so every run reports "no valid posts".
src/features/showcase-digest/config.ts:6 — the fallback warning is logged even when a value was set but failed to parse, so the log misreports the configuration.
src/common/commands/index.ts:14 — the new createDigestCommand is registered as digest-force in triggers.ts, but the import comes from triggers.js, which also starts the cron scheduler at import time. Worth confirming that importing this module from the command map does not start the scheduler twice alongside initializeShowcaseDigestScheduler() in ready.
src/features/showcase/create-showcase.ts:88 — an unrelated blank line was removed. This is cosmetic drift outside the feature and should be dropped from the diff.

if (result.reason instanceof ShowcaseDigestValidationError) {
result.reason.logError();
return [];
} else {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I feel very weird about how this is handled in particular, this seems unoptimal. This custom error I wrote is biting me in the ass, and it's not playing nice with other errors. The idea here is to drop any posts that fail the validation check but propagate errors that are fatal.

@wiktoriavh wiktoriavh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we discussed it in a call, and gave pointers there.

Comment thread src/features/showcase-digest/util.ts Outdated
console.log(`Successfully displayed showcase digest!`);
} catch (error) {
console.error(error);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

beautiful

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.

Showcase digest: recent posts sorted by thumbs up, with comment count

2 participants