Repository navigation
feat(#126): display showcase posts in fortnightly showcase-digest - #134
michal-skraburski wants to merge 29 commits into
Conversation
|
You should run the linter and formatter as well, to fix some smaller issues. 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". |
Co-authored-by: Wiktoria van Harneveldt <62669899+wiktoriavh@users.noreply.github.com>
| if (result.reason instanceof ShowcaseDigestValidationError) { | ||
| result.reason.logError(); | ||
| return []; | ||
| } else { |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
we discussed it in a call, and gave pointers there.
| console.log(`Successfully displayed showcase digest!`); | ||
| } catch (error) { | ||
| console.error(error); | ||
| } |
This PR closes #126.
Configuration
4 new configuration options were added:
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 intocurrentWeekIndex() % INTEVERAL_WEEKS. Seefeatures/showcase-digest/triggers.ts.Current state
A showcase digest currently looks like this:

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