Admin social progress timing and handle indexes#148
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds ChangesLanding Rollup Timing Instrumentation
Normalized Handle Expression Indexes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codex Exhaustive Code ReviewFindings
Validation I reviewed only the requested diff range. Review Metadata
|
There was a problem hiding this comment.
Pull request overview
Adds timing telemetry to the admin social landing progress rollup response (including cached responses) and introduces new normalized-handle expression indexes intended to speed up the rollup’s platform/table lookups, with tests extended to validate the timing payload.
Changes:
- Add
timingfields (database_ms,backend_ms,total_ms) to/socials/landing-progress-rollupresponses and ensure cached payloads preserve timing. - Add expression indexes to match the rollup query’s normalized-handle predicates across multiple
social.*tables andpipeline.socialblade_growth_data. - Extend landing progress rollup tests to assert timing behavior on bypass/miss/hit flows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
api/routers/socials/__init__.py |
Adds timing measurements and includes timing payload in rollup responses + logging. |
supabase/migrations/20260618170000_social_landing_progress_normalized_handle_indexes.sql |
Adds normalized-handle expression indexes to support rollup query filters/joins. |
tests/api/test_admin_socials_landing_summary.py |
Expands tests to validate timing fields and cache-hit timing preservation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| db_ms = int((perf_counter() - db_started_at) * 1000) | ||
| total_ms = int((perf_counter() - started_at) * 1000) | ||
| generated_at = datetime.now(tz=UTC).isoformat() | ||
| payload_out = { | ||
| "rows": jsonable_encoder(rows), |
| BEGIN; | ||
|
|
| CREATE INDEX IF NOT EXISTS idx_social_instagram_posts_landing_account_norm | ||
| ON social.instagram_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_tiktok_posts_landing_account_norm | ||
| ON social.tiktok_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); |
| CREATE INDEX IF NOT EXISTS idx_social_twitter_tweets_landing_account_norm | ||
| ON social.twitter_tweets ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_youtube_videos_landing_account_norm | ||
| ON social.youtube_videos ((ltrim(lower(coalesce(source_account, '')), '@'))); |
| CREATE INDEX IF NOT EXISTS idx_social_facebook_posts_landing_account_norm | ||
| ON social.facebook_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_threads_posts_landing_account_norm | ||
| ON social.meta_threads_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); |
| CREATE INDEX IF NOT EXISTS idx_social_ig_catalog_posts_landing_account_norm | ||
| ON social.instagram_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_tiktok_catalog_posts_landing_account_norm | ||
| ON social.tiktok_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); |
| CREATE INDEX IF NOT EXISTS idx_social_twitter_catalog_posts_landing_account_norm | ||
| ON social.twitter_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_youtube_catalog_posts_landing_account_norm | ||
| ON social.youtube_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); |
| CREATE INDEX IF NOT EXISTS idx_social_facebook_catalog_posts_landing_account_norm | ||
| ON social.facebook_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_social_threads_catalog_posts_landing_account_norm | ||
| ON social.threads_account_catalog_posts ((ltrim(lower(coalesce(source_account, '')), '@'))); |
Summary
Validation
/Users/thomashulihan/Projects/TRR/TRR-Backend/.venv/bin/pytest -q tests/api/test_admin_socials_landing_summary.pygit diff --checkSummary by CodeRabbit
Performance
Tests