Skip to content

[codex] Publish social backfill hardening#154

Merged
therealityreport merged 5 commits into
mainfrom
codex/publish/trr-backend/20260705-174033-clean3
Jul 5, 2026
Merged

[codex] Publish social backfill hardening#154
therealityreport merged 5 commits into
mainfrom
codex/publish/trr-backend/20260705-174033-clean3

Conversation

@therealityreport

Copy link
Copy Markdown
Owner

Summary

  • Publish Social Backfill hardening for Instagram comments, shared catalog ingestion, SocialBlade repair, proxy-budget handling, and related migrations/tests.
  • Reject unsupported platform-scoped hashtag writes instead of silently widening them to global writes.
  • Align SocialBlade repair defaults with the live non-sticky Decodo runtime defaults.
  • Preserve existing job metadata when touching dispatch metadata and fail closed on non-local Modal maintenance ownership.
  • Refresh requirements.lock.txt with the CI --python-version 3.11 command and remove large generated .plan-work tool-finder dumps.

Validation

  • git diff --check origin/main...HEAD
  • git diff --name-only --diff-filter=ACMR origin/main...HEAD -- '*.py' | xargs -r uvx ruff@0.14.4 check
  • git diff --name-only --diff-filter=ACMR origin/main...HEAD -- '*.py' | xargs -r uvx ruff@0.14.4 format --check
  • cp requirements.lock.txt /tmp/requirements.lock.before-ci-check.txt && uv pip compile requirements.in --python-version 3.11 -o requirements.lock.txt && diff -u /tmp/requirements.lock.before-ci-check.txt requirements.lock.txt
  • .venv/bin/python -m pytest tests/api -q (1086 passed)
  • .venv/bin/python -m pytest tests/test_modal_jobs.py tests/test_startup_config.py tests/repositories/test_social_dispatch_metadata.py -q
  • Focused social backfill test set covering route shape, hashtag writes, SocialBlade repair/business API, admin comments, classifier, Scrapling async client, deploy health, media guard, proxy budget, catalog ingest, direct catalog, and SocialBlade auth/business repair.

Runtime follow-through

  • Modal trr-backend-jobs deploy/readiness follow-through was completed before PR prep.
  • Health canary returned 200 and readiness checks passed.

Notes

Copilot AI review requested due to automatic review settings July 5, 2026 23:07
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@therealityreport, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 401ca4fd-439b-4e27-a708-ab31208e19d5

📥 Commits

Reviewing files that changed from the base of the PR and between bc9aeae and 8ea7aa1.

📒 Files selected for processing (143)
  • .env.example
  • .github/workflows/ci.yml
  • CONTEXT.md
  • api/main.py
  • api/routers/admin_show_reads.py
  • api/routers/admin_show_sync.py
  • api/routers/admin_social_posts.py
  • api/routers/admin_socialblade.py
  • api/routers/shows.py
  • api/routers/socials/__init__.py
  • docs/observability/modal-v439-v440-serve-backend-api-crash-loop-2026-05-28.md
  • docs/workspace/instagram-comments-scrapling.md
  • docs/workspace/instagram-posts-scrapling.md
  • docs/workspace/scrapling-social-jobs.md
  • requirements.in
  • requirements.lock.txt
  • requirements.modal.browser.lock.txt
  • requirements.modal.lean.lock.txt
  • requirements.modal.vision.lock.txt
  • scripts/db/index_advisor_social_hot_paths.py
  • scripts/db/verify_socialblade_snapshot_fk_indexes.sql
  • scripts/modal/prepare_named_secrets.py
  • scripts/socials/instagram/backfill_progress.py
  • scripts/socials/instagram/bravo_straggler_recovery.py
  • scripts/socials/instagram/classify_approval_blocked_comments.py
  • scripts/socials/instagram/enqueue_comments_audit_cursor_retries.py
  • scripts/socials/reddit/repair_media_urls.py
  • scripts/socials/repair_socialblade_auth.py
  • supabase/migrations/20260625172000_tiktok_post_comment_rollups.sql
  • supabase/migrations/20260629140000_instagram_comments_public_proxy_budget_ledger.sql
  • supabase/migrations/20260629143025_supabase_security_advisor_rpc_and_vector_hardening.sql
  • supabase/migrations/20260629144346_socialblade_snapshot_fk_indexes.sql
  • supabase/migrations/20260629190000_canonical_social_hashtag_assignments.sql
  • supabase/migrations/20260702174000_hashtag_assignments_season_fk_index.sql
  • supabase/migrations/20260702181000_youtube_post_comment_rollups.sql
  • supabase/migrations/20260702184229_social_rollup_function_and_rate_pace_security.sql
  • supabase/migrations/20260702185000_drop_social_unused_index_wave1.sql
  • tests/api/routers/test_admin_show_images.py
  • tests/api/routers/test_admin_show_sync.py
  • tests/api/routers/test_shows.py
  • tests/api/routers/test_socials_season_analytics.py
  • tests/api/test_admin_show_reads.py
  • tests/api/test_admin_social_comments.py
  • tests/api/test_admin_social_posts.py
  • tests/api/test_admin_socialblade.py
  • tests/api/test_startup_validation.py
  • tests/db/test_advisor_remediation_sql.py
  • tests/db/test_index_advisor_social_hot_paths.py
  • tests/fixtures/admin_socials_route_shape.json
  • tests/fixtures/instagram/scrapling/comments_polaris_container_first_page.json
  • tests/fixtures/instagram/scrapling/ig_direct_badge_count_off_msys.json
  • tests/fixtures/instagram/scrapling/post_fetch_xdt_media_dict.json
  • tests/fixtures/instagram/scrapling/post_fetch_xdt_media_dict_null_fb.json
  • tests/repositories/test_admin_show_reads_repository.py
  • tests/repositories/test_reddit_refresh.py
  • tests/repositories/test_social_account_catalog_backfill_integration.py
  • tests/repositories/test_social_control_plane_dispatch_runtime.py
  • tests/repositories/test_social_dispatch_metadata.py
  • tests/repositories/test_social_posts_repository.py
  • tests/repositories/test_social_queue_status.py
  • tests/repositories/test_social_run_lifecycle_repository.py
  • tests/repositories/test_social_season_analytics.py
  • tests/repositories/test_socialblade_growth.py
  • tests/repositories/test_youtube_catalog_backfill_diagnostics.py
  • tests/scripts/test_bravo_straggler_recovery.py
  • tests/scripts/test_classify_approval_blocked_comments.py
  • tests/scripts/test_enqueue_comments_audit_cursor_retries.py
  • tests/scripts/test_prepare_named_secrets.py
  • tests/socials/facebook/test_facebook_posts_catalog.py
  • tests/socials/instagram/comments_scrapling/test_async_http_client.py
  • tests/socials/instagram/comments_scrapling/test_comments_lane_deploy_health.py
  • tests/socials/instagram/comments_scrapling/test_fetcher_status_only.py
  • tests/socials/instagram/comments_scrapling/test_job_runner_cancellation.py
  • tests/socials/instagram/comments_scrapling/test_job_runner_reply_only.py
  • tests/socials/instagram/comments_scrapling/test_media_direct_guard.py
  • tests/socials/instagram/comments_scrapling/test_proxy.py
  • tests/socials/instagram/comments_scrapling/test_proxy_budget.py
  • tests/socials/instagram/comments_scrapling/test_public_blocked_pause.py
  • tests/socials/instagram/comments_scrapling/test_public_decodo_isolation.py
  • tests/socials/instagram/comments_scrapling/test_public_relay_env_knobs.py
  • tests/socials/instagram/test_catalog_ingest_worker_b.py
  • tests/socials/instagram/test_instagram_direct_catalog.py
  • tests/socials/test_instagram_comments_progress_payload.py
  • tests/socials/test_instagram_comments_scrapling_retry.py
  • tests/socials/test_instagram_permalink_metadata.py
  • tests/socials/test_instagram_scraper_public_graphql.py
  • tests/socials/test_profile_dashboard.py
  • tests/socials/test_repair_socialblade_auth.py
  • tests/socials/test_scrapling_transport.py
  • tests/socials/test_socialblade_auth.py
  • tests/socials/test_socialblade_business_api.py
  • tests/socials/test_socialblade_fetcher.py
  • tests/socials/threads/posts_scrapling/test_persistence.py
  • tests/socials/threads/test_threads_posts_catalog.py
  • tests/socials/tiktok/posts_scrapling/test_job_runner.py
  • tests/socials/tiktok/posts_scrapling/test_persistence.py
  • tests/socials/twitter/test_twitter_posts_catalog.py
  • tests/socials/youtube/test_scraper.py
  • tests/test_modal_jobs.py
  • tests/test_startup_config.py
  • trr_backend/db/show_images.py
  • trr_backend/modal_jobs.py
  • trr_backend/repositories/admin_show_reads.py
  • trr_backend/repositories/reddit_refresh.py
  • trr_backend/repositories/social_posts.py
  • trr_backend/repositories/socialblade_growth.py
  • trr_backend/socials/analytics/read_models.py
  • trr_backend/socials/api/handlers/profile_reads.py
  • trr_backend/socials/control_plane/dispatch_runtime.py
  • trr_backend/socials/control_plane/queue_status.py
  • trr_backend/socials/control_plane/run_lifecycle.py
  • trr_backend/socials/facebook/posts_catalog/catalog.py
  • trr_backend/socials/instagram/catalog_ingest.py
  • trr_backend/socials/instagram/comments_scrapling/async_http_client.py
  • trr_backend/socials/instagram/comments_scrapling/fetcher.py
  • trr_backend/socials/instagram/comments_scrapling/job_runner.py
  • trr_backend/socials/instagram/comments_scrapling/proxy.py
  • trr_backend/socials/instagram/comments_scrapling/proxy_budget.py
  • trr_backend/socials/instagram/comments_scrapling/public_mode.py
  • trr_backend/socials/instagram/permalink_metadata.py
  • trr_backend/socials/instagram/posts_scrapling/fetcher.py
  • trr_backend/socials/instagram/scraper.py
  • trr_backend/socials/media_url_safety.py
  • trr_backend/socials/ops/instagram_direct_catalog.py
  • trr_backend/socials/pipelines/account_catalog/launch.py
  • trr_backend/socials/pipelines/account_catalog/progress.py
  • trr_backend/socials/pipelines/comments/__init__.py
  • trr_backend/socials/pipelines/comments/instagram.py
  • trr_backend/socials/read_models/account_profile/common.py
  • trr_backend/socials/scrapling_transport.py
  • trr_backend/socials/social_season_analytics_impl.py
  • trr_backend/socials/socialblade/auth.py
  • trr_backend/socials/socialblade/business_api.py
  • trr_backend/socials/socialblade/fetcher.py
  • trr_backend/socials/threads/posts_catalog/catalog.py
  • trr_backend/socials/threads/posts_scrapling/fetcher.py
  • trr_backend/socials/threads/posts_scrapling/persistence.py
  • trr_backend/socials/tiktok/posts_scrapling/fetcher.py
  • trr_backend/socials/tiktok/posts_scrapling/job_runner.py
  • trr_backend/socials/tiktok/posts_scrapling/persistence.py
  • trr_backend/socials/twitter/posts_catalog/catalog.py
  • trr_backend/socials/youtube/posts_catalog/catalog.py
  • trr_backend/socials/youtube/scraper.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/publish/trr-backend/20260705-174033-clean3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens multiple “social backfill” lanes (Instagram comments/public proxy budget controls, shared catalog ingestion, SocialBlade repair + preflight, and rollup/security migrations), while expanding YouTube catalog scraping to include community posts and tightening several operational defaults and diagnostics.

Changes:

  • Add proxy-budgeted public-lane controls for Instagram comments (opt-in proxy enablement, spend guardrails/ledger, and stronger isolation proofing) plus related job/metadata/test coverage.
  • Expand shared-account catalog ingestion/hardening across platforms (YouTube surfaces incl. posts, TikTok/Threads per-post savepoints + shared catalog writes, soft-block empty-result classification).
  • Add/refresh Supabase migrations and operational tooling (rollup tables/functions, RLS/grants hardening, FK indexes, unused-index drop wave, lockfile refresh, and verification scripts).

Skill completion contract (senior-backend):

  • backend_surface: FastAPI routes/handlers, scraping workers/fetchers, repositories, scripts, and Supabase migrations.
  • contracts_changed: Yes (new admin SocialBlade cookie health endpoint; hashtags read handler adds assignment_status; additional admin socials route shapes/tests).
  • migrations_added: Yes (multiple new supabase/migrations/*.sql).
  • downstream_updates: Not included in this PR (no TRR-APP/screenalytics changes visible here).
  • validation_run: Per PR description: ruff check/format, pytest (tests/api suite + targeted tests), lockfile regen diff, plus focused social backfill test set.

Reviewed changes

Copilot reviewed 119 out of 122 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
trr_backend/socials/youtube/posts_catalog/catalog.py Add requested surfaces incl. posts
trr_backend/socials/twitter/posts_catalog/catalog.py Treat explicit 0 limits as unlimited
trr_backend/socials/tiktok/posts_scrapling/persistence.py Per-post savepoints + shared catalog upsert
trr_backend/socials/tiktok/posts_scrapling/job_runner.py Track/persist catalog upsert counters
trr_backend/socials/tiktok/posts_scrapling/fetcher.py Scrapling tuning opts + proxy metadata
trr_backend/socials/threads/posts_scrapling/persistence.py Per-post savepoints + shared catalog upsert
trr_backend/socials/threads/posts_scrapling/fetcher.py Scrapling tuning opts + proxy metadata
trr_backend/socials/threads/posts_catalog/catalog.py Classify empty soft-block results
trr_backend/socials/socialblade/fetcher.py Scrapling tuning opts + proxy handling
trr_backend/socials/pipelines/comments/init.py Export new pipeline helper
trr_backend/socials/media_url_safety.py Allow ggpht.com; formatting
trr_backend/socials/instagram/posts_scrapling/fetcher.py Scrapling tuning opts + metadata
trr_backend/socials/instagram/permalink_metadata.py Parse fetch__XDTMediaDict + exclude payloads
trr_backend/socials/instagram/comments_scrapling/public_mode.py Public lane proxy opt-in + isolation proof
trr_backend/socials/instagram/comments_scrapling/proxy.py Budgeted public proxy fingerprinting
trr_backend/socials/instagram/comments_scrapling/proxy_budget.py New per-run proxy budget math + ledger write
trr_backend/socials/facebook/posts_catalog/catalog.py Classify empty soft-block results
trr_backend/socials/control_plane/run_lifecycle.py CAS followup state + safer retry launch
trr_backend/socials/api/handlers/profile_reads.py Add hashtag assignment_status filter
trr_backend/repositories/reddit_refresh.py Extract/sanitize Reddit media URLs
tests/test_startup_config.py Modal maintenance owner fail-closed tests
tests/socials/youtube/test_scraper.py Add posts surface + schema.org tests
tests/socials/twitter/test_twitter_posts_catalog.py Explicit 0 max_posts => unlimited pages
tests/socials/tiktok/posts_scrapling/test_job_runner.py Assert shared mode passes ingest mode
tests/socials/threads/test_threads_posts_catalog.py Empty soft-block retryable classification
tests/socials/threads/posts_scrapling/test_persistence.py Savepoint behavior tests
tests/socials/test_socialblade_fetcher.py Proxy plumbing expectation update
tests/socials/test_socialblade_business_api.py New business API unit tests
tests/socials/test_socialblade_auth.py Cookie health report redaction/loader tests
tests/socials/test_scrapling_transport.py New helpers: tuning options + proxy metadata
tests/socials/test_repair_socialblade_auth.py New cookie repair CLI control-flow tests
tests/socials/test_profile_dashboard.py Catalog progress/skip reason semantics tests
tests/socials/test_instagram_permalink_metadata.py Fixture-based XDT + exclude payload tests
tests/socials/instagram/test_instagram_direct_catalog.py New direct catalog backfill tests
tests/socials/instagram/comments_scrapling/test_public_relay_env_knobs.py New env knob + rate scope tests
tests/socials/instagram/comments_scrapling/test_public_decodo_isolation.py Public proxy flag + allow_proxy tests
tests/socials/instagram/comments_scrapling/test_public_blocked_pause.py Update pause threshold assertions
tests/socials/instagram/comments_scrapling/test_proxy.py Public proxy flag + per-egress fingerprint test
tests/socials/instagram/comments_scrapling/test_proxy_budget.py New proxy budget math tests
tests/socials/instagram/comments_scrapling/test_media_direct_guard.py New CDN leak + budget kill-switch tests
tests/socials/instagram/comments_scrapling/test_job_runner_reply_only.py Pin authenticated cursor strategy in test
tests/socials/instagram/comments_scrapling/test_job_runner_cancellation.py Stub now_utc + audit-cursor read conn
tests/socials/instagram/comments_scrapling/test_comments_lane_deploy_health.py Import-time deploy drift guard
tests/socials/instagram/comments_scrapling/test_async_http_client.py Async transport factory tests
tests/socials/facebook/test_facebook_posts_catalog.py Empty soft-block retryable classification
tests/scripts/test_prepare_named_secrets.py New modal/social defaults assertions
tests/scripts/test_enqueue_comments_audit_cursor_retries.py Add date bounds + strategy payload asserts
tests/scripts/test_classify_approval_blocked_comments.py New approval-gap classification tests
tests/scripts/test_bravo_straggler_recovery.py Delegate argv carries date bounds + strategy
tests/repositories/test_youtube_catalog_backfill_diagnostics.py Profile snapshot merge precedence test
tests/repositories/test_social_run_lifecycle_repository.py CAS retry semantics + lock release behavior
tests/repositories/test_social_dispatch_metadata.py New dispatch metadata touch test
tests/repositories/test_social_account_catalog_backfill_integration.py Streaming comments enablement assertions
tests/repositories/test_reddit_refresh.py Reddit media URL sanitization tests
tests/fixtures/instagram/scrapling/post_fetch_xdt_media_dict.json New Instagram fixture
tests/fixtures/instagram/scrapling/post_fetch_xdt_media_dict_null_fb.json New Instagram fixture
tests/fixtures/instagram/scrapling/ig_direct_badge_count_off_msys.json New IG excluded payload fixture
tests/fixtures/admin_socials_route_shape.json Add new admin socials routes
tests/db/test_index_advisor_social_hot_paths.py Surface nested advisor errors in report
tests/db/test_advisor_remediation_sql.py Assert new security migrations content
tests/api/test_admin_socialblade.py Batch refresh preflight health gating tests
tests/api/test_admin_social_comments.py New dry-run comments scrape handler test
supabase/migrations/20260702185000_drop_social_unused_index_wave1.sql Drop unused indexes (wave 1)
supabase/migrations/20260702184229_social_rollup_function_and_rate_pace_security.sql Rollup function hardening + RLS
supabase/migrations/20260702181000_youtube_post_comment_rollups.sql YouTube comment rollups + triggers
supabase/migrations/20260702174000_hashtag_assignments_season_fk_index.sql Add FK index for season_id
supabase/migrations/20260629190000_canonical_social_hashtag_assignments.sql New canonical hashtag assignments tables
supabase/migrations/20260629144346_socialblade_snapshot_fk_indexes.sql Add SocialBlade snapshot FK indexes
supabase/migrations/20260629143025_supabase_security_advisor_rpc_and_vector_hardening.sql Security advisor RPC/vector hardening
supabase/migrations/20260629140000_instagram_comments_public_proxy_budget_ledger.sql Proxy budget ledger table + RLS
supabase/migrations/20260625172000_tiktok_post_comment_rollups.sql TikTok comment rollups + triggers
scripts/socials/reddit/repair_media_urls.py New Reddit media URL repair tool
scripts/socials/instagram/enqueue_comments_audit_cursor_retries.py Add date bounds + default strategy
scripts/socials/instagram/bravo_straggler_recovery.py Add date bounds + default strategy
scripts/modal/prepare_named_secrets.py Add SocialBlade + concurrency defaults
scripts/db/verify_socialblade_snapshot_fk_indexes.sql New index verification SQL
scripts/db/index_advisor_social_hot_paths.py Capture advisor recommendation errors
requirements.modal.vision.lock.txt Refresh pinned deps (modal vision)
requirements.modal.lean.lock.txt Refresh pinned deps (modal lean)
requirements.modal.browser.lock.txt Refresh pinned deps (modal browser)
requirements.lock.txt Refresh lockfile (py 3.11 compile)
requirements.in Pin numpy/sympy/opencv
docs/workspace/scrapling-social-jobs.md New shared Scrapling practices doc
docs/workspace/instagram-posts-scrapling.md Link to shared Scrapling doc
docs/workspace/instagram-comments-scrapling.md Link to shared Scrapling doc
docs/observability/modal-v439-v440-serve-backend-api-crash-loop-2026-05-28.md Update deploy history stamp
CONTEXT.md New domain language glossary
api/routers/admin_socialblade.py Cookie health endpoint + batch preflight
api/main.py Fail-closed Modal owner requirement
.env.example Add SocialBlade business API envs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +7
For shared Scrapling process rules, optional browser tuning envs, and
redaction-safe metadata expectations across social lanes, see
[Scrapling Social Jobs](/Users/thomashulihan/Projects/TRR/TRR-Backend/docs/workspace/scrapling-social-jobs.md).
Comment on lines +11 to +13
For shared Scrapling process rules and redaction-safe metadata expectations
across social lanes, see
[Scrapling Social Jobs](/Users/thomashulihan/Projects/TRR/TRR-Backend/docs/workspace/scrapling-social-jobs.md).
Comment on lines +25 to +30
create or replace function social.refresh_youtube_post_comment_rollup(target_video_id uuid)
returns void
language plpgsql
security definer
set search_path = social, public
as $$
Comment on lines +59 to +64
create or replace function social.refresh_youtube_post_comment_rollup_tg()
returns trigger
language plpgsql
security definer
set search_path = social, public
as $$
Comment on lines +25 to +30
create or replace function social.refresh_tiktok_post_comment_rollup(target_post_id uuid)
returns void
language plpgsql
security definer
set search_path = social, public
as $$
Comment on lines +59 to +64
create or replace function social.refresh_tiktok_post_comment_rollup_tg()
returns trigger
language plpgsql
security definer
set search_path = social, public
as $$
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Codex Exhaustive Code Review

Findings

  1. High: account-scoped hashtag PUT can delete global assignments for the same hashtag.
    api/routers/socials/init.py still exposes PUT /profiles/{platform}/{account_handle}/hashtags, but the implementation now deletes from the canonical global table by normalized_hashtag only: trr_backend/socials/social_season_analytics_impl.py. A caller updating #rhoa for one profile with only the assignments it is editing will remove every other social.hashtag_assignments row for #rhoa that was not included in that payload.
    Impact: admin edits can silently remove cross-show/global hashtag mappings and change profile/show attribution elsewhere.
    Smallest fix: do not perform a whole-hashtag global replace from the account-scoped route unless the request carries an explicit “replace global set” contract/confirmation. Prefer a separate global-assignment endpoint, or merge against existing rows and require explicit deletion targets for removals.

  2. Medium: PR drops the remaining YouTube comments (season_id, created_at) hot-path index while current analytics still query that shape.
    The cleanup migration drops both YouTube season-created indexes: supabase/migrations/20260702185000_drop_social_unused_index_wave1.sql. Current season analytics still reads social.youtube_comments with c.season_id = %s plus c.created_at >= %s / <= %s: trr_backend/socials/social_season_analytics_impl.py. The prior hot-path migration explicitly added idx_social_youtube_comments_season_created_at for this access pattern: supabase/migrations/0141_social_analytics_hot_path_indexes.sql, and there is no later migration recreating it.
    Impact: YouTube season analytics/week windows can regress to less selective scans or bitmap combinations on large comment tables.
    Smallest fix: keep one composite YouTube comments index, preferably on social.youtube_comments (season_id, created_at desc) with the same partial predicate style used elsewhere if desired, and add a final-schema/index-advisor check for this query.

Residual Risks

  • The new SocialBlade Business API env/config and adapter are not wired into the actual admin or Modal refresh paths; those still load cookies and call the browser scraper. If the PR expects API-backed refresh, this needs integration coverage.
  • The new TikTok/YouTube rollup migrations backfill entire comment tables in one statement. Validate production row counts and migration timing before applying.

Validation

  • git diff --check bc9ae...66c55: clean.
  • Parsed all 96 changed Python files with ast.parse: OK.
  • Could not run pytest: pytest is not installed and import pytest fails with ModuleNotFoundError.

@therealityreport therealityreport merged commit 8d68797 into main Jul 5, 2026
6 of 9 checks passed
@therealityreport therealityreport deleted the codex/publish/trr-backend/20260705-174033-clean3 branch July 6, 2026 00:57
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