feat(reviews): per-user review opt-out with /reviews command - #110
Merged
Conversation
Adds a singleton review_preferences table to the per-tenant migration set and a ReviewPreferenceRepository to read/write it. Absence of a row means reviews are enabled, so the default is ON for every user without requiring a backfill.
Wires ReviewPreferenceRepository into JournalService and adds JournalCommand::ReviewsStatus/ReviewsSet/ReviewsUsage so a user can check or change their opt-out state through the per-tenant journal service, independent of the Telegram adapter.
Parses "/reviews", "/reviews on", and "/reviews off" into the corresponding JournalCommand and lists the command in /help, alongside the other bot commands.
…-out Threads ReviewPreferenceRepository through DailyReviewDelivery and WeeklyReviewDelivery so their targets() returns no conversations (and triggers no generation) for a tenant who has turned reviews off, without touching the on-demand /day_review and /week_review commands. Wires the repository through app.rs's per-tenant worker construction and documents the /reviews command and its relationship to the existing global enable flags in the README.
CI runs clippy with warnings denied; chunks_exact with a constant chunk size fails there. Switch to as_chunks::<4>() which removes the try_into().unwrap().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each user can now turn their own review delivery on or off, without touching other tenants or the deployment:
/reviewsshows the current state,/reviews on//reviews offtoggles it, and the command is listed in/helpreview_preferencestable (migration0016) in each tenant's own SQLite database, where an absent row means enabled — so no backfill is needed for existing or new users/day_reviewand/week_reviewremain availableFROID_DAILY_REVIEW_DELIVERY_ENABLED,FROID_WEEK_REVIEW_WORKER_ENABLED) keep working as master switches layered above the per-user preferenceTest Plan
JournalServicecommand handling, Telegram parsing (incl.@botsuffix and/helplisting), and worker tests asserting an opted-out user receives zero attempted deliveries and no generated review recordcargo fmt --checkclean;clippyclean except one pre-existing lint onmain(chunks_exactinsrc/journal/embedding/types.rs), untouched by this branch