Skip to content

chore: turn off tweet aggregation#72

Merged
dewabisma merged 3 commits into
mainfrom
beast/remove-tweet-aggregation
Jul 7, 2026
Merged

chore: turn off tweet aggregation#72
dewabisma merged 3 commits into
mainfrom
beast/remove-tweet-aggregation

Conversation

@dewabisma

@dewabisma dewabisma commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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! in main.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.

@dewabisma dewabisma requested a review from n13 July 6, 2026 10:21

@n13 n13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_synchronizer in main.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, and alert_service which 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 n13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_usage model + repository, TweetPullUsage field on DbPersistence
  • Config: TweetSyncConfig, TelegramBotConfig, AlertConfig structs + their [tweet_sync]/[tg_bot]/[alert] sections in all three toml files, and get_tweet_sync_interval
  • Errors: AppError::Telegram variant + its IntoResponse arm
  • 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 the upsert_many methods on the tweet/author repos. Keeps the integration tests working without leaving dead production code.
  • main.rs now passes None for the rusx api key. Verified safe — the HTTP server's only gateway use is users().get_by_username(...) (OAuth via x_oauth), and test_app_state already passed None, so this is consistent.
  • test_db.rs TRUNCATE list updated to drop tweet_pull_usage. Matches the removal.
  • Grep across src/ confirms zero dangling references to any removed symbol.

Non-blocking notes (optional)

  1. Orphan migrationmigrations/009_tweet_pull_usage_table.sql still creates the tweet_pull_usage table 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.
  2. 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.
  3. /relevant-tweets and /tweet-authors endpoints 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.

@dewabisma dewabisma merged commit d039160 into main Jul 7, 2026
1 check passed
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.

2 participants