chore: turn off tweet aggregation#72
Conversation
n13
left a comment
There was a problem hiding this comment.
Review
The intent (turning off tweet aggregation) is fine, but the change as-is breaks CI and leaves half-removed code behind.
Blocking
1. CI fails on clippy (failed run) — main is green, so this is introduced by the PR. CI runs cargo clippy --all-targets --all-features -- -D warnings, and removing only the select! arm makes the whole tweet-sync call graph dead code from the binary's perspective:
unused variable: tweet_synchronizerinmain.rs— the service is still constructed but never used- Dead-code errors cascade from there:
get_tweet_sync_interval,AppError::Telegram,extract_sdk_error_type,track_twitter_api_call,track_tweets_pulled,NewTweetPayload,TweetPullUsage, repository methods (get_newest_tweet_id,upsert_many,get_whitelist), and more
2. Decide whether this is a removal or a toggle, and finish accordingly:
- If it's a permanent removal: also delete the now-dead construction in
main.rs(tweet_synchronizer,telegram_service, andalert_servicewhich is only consumed by the synchronizer) and the dead code clippy flags. - If it's a temporary operational off-switch: prefer a config flag (e.g.
tweet_sync.enabled) that skips spawning the synchronizer. That keeps the code alive (no dead-code cascade) and lets ops re-enable it without a code change.
Minor
- With one branch left,
tokio::select!is unnecessary —server_task.await??does the same thing.
Non-blocking observation
The /relevant-tweets and /tweet-authors endpoints stay live but will serve stale data, and the Telegram usage alerts driven by the sync loop stop firing. Presumably intended, just flagging it.
Verdict
Request changes — CI must pass; pick removal-or-toggle and complete it.
n13
left a comment
There was a problem hiding this comment.
Re-review
The previous blocking issues are resolved — the author went with the permanent-removal route and completed it. CI is now green (formatting, clippy with -D warnings --all-targets --all-features, migrations, and tests all pass; run).
What was removed (clean)
- Services:
tweet_synchronizer_service,alert_service,telegram_service(deleted entirely) - Models/repos:
tweet_pull_usagemodel + repository,TweetPullUsagefield onDbPersistence - Config:
TweetSyncConfig,TelegramBotConfig,AlertConfigstructs + their[tweet_sync]/[tg_bot]/[alert]sections in all three toml files, andget_tweet_sync_interval - Errors:
AppError::Telegramvariant + itsIntoResponsearm - Metrics:
track_twitter_api_call,track_tweets_pulled,extract_sdk_error_type, and the twitter metric counters/registrations - Repo methods only used by the sync loop:
get_whitelist,get_newest_tweet_id utils/x_url::build_x_status_url
Nice touches
- Correctly gated test-only code behind
#[cfg(test)]instead of deleting it:NewTweetPayload,RaidQuestRepository::{find_active, create_select_base_query}, and theupsert_manymethods on the tweet/author repos. Keeps the integration tests working without leaving dead production code. main.rsnow passesNonefor the rusx api key. Verified safe — the HTTP server's only gateway use isusers().get_by_username(...)(OAuth viax_oauth), andtest_app_statealready passedNone, so this is consistent.test_db.rsTRUNCATE list updated to droptweet_pull_usage. Matches the removal.- Grep across
src/confirms zero dangling references to any removed symbol.
Non-blocking notes (optional)
- Orphan migration —
migrations/009_tweet_pull_usage_table.sqlstill creates thetweet_pull_usagetable on every fresh DB. Leaving applied migrations alone is the right default, but the table is now dead schema. If you want a clean DB, add a follow-up migration (e.g.011_drop_tweet_pull_usage_table.sql) to drop it; otherwise harmless clutter. - PR title — "turn off tweet aggregation" undersells it; this is now a full removal. Consider retitling to "chore: remove tweet aggregation" so history is accurate.
/relevant-tweetsand/tweet-authorsendpoints stay live (the latter still calls the Twitter users API on POST to look up authors). Only the background pull, Telegram raid notifications, and usage-limit alerts are gone — presumably the intent.
Verdict
Approve. Removal is clean and complete, CI passes, no dangling references.
Note
Medium Risk
Operational change: background tweet sync and its alerts stop running, which may break tweet-dependent features even though the HTTP API still starts.
Overview
Disables the background tweet sync loop by removing it from the process’s
tokio::select!inmain.rs. On startup, TaskMaster now only waits on the HTTP server task instead of racing the server against the tweet synchronizer.The periodic tweet aggregation path (
spawn_tweet_synchronizer) is no longer started, so in-process Twitter pull/sync, related DB updates, and downstream alerting driven by that worker will not run while the API keeps serving.Reviewed by Cursor Bugbot for commit a6dd967. Configure here.