Repository navigation
feat: GSC property mapping and daily query-stats sync - #647
Merged
Merged
Conversation
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
GSC integration phase 2 on top of #643: per-brand property mapping and the daily query-stats pull. Two commits, one per issue.
Phase 2a — property mapping (#642)
GET /api/integrations/google-search-console/properties— lists the connected account's properties via the ComposioGOOGLE_SEARCH_CONSOLE_LIST_SITEStool (pinned toolkit version, env-overridable viaCOMPOSIO_GSC_TOOLKIT_VERSION).brands.gsc_propertycolumn (migration00046) — connection is org-level, property choice is brand-level; kept on disconnect.sc-domain:covers apex + subdomains, URL-prefix matches by host — unit-tested matcher inweb/src/lib/gsc.ts), "N of M brands mapped" counter, optimistic saves with rollback. Writes go through the existing brands RLS (admin/manager).Phase 2b — query stats pull (#644)
gsc_query_statstable (migration00047): per-query daily rows, unique(brand_id, query, date), org-member read.server/src/lib/gsc-sync.js— for every active brand with a mapped property in a connected org: last 28 days,dimensions: ['query','date'], fully deterministic parameters (no LLM), paginated in 5k pages up to a logged 25k/brand ceiling, chunked upserts (idempotent). Per-brand failures are logged and skipped.runDailyTrackingas a non-blocking follow-up (both cloud cron and self-host cron get it); silent no-op without Composio env.POST /api/integrations/google-search-console/sync(admin/manager) for manual runs/backfill.Orgs without the integration are untouched at every layer: no connection → the sync selects zero brands; no Composio env → immediate no-op; no product surface reads the new table yet.
Related issue
Closes #642
Closes #644
Type of change
feat— New featureHow to test
POST .../syncor the daily cycle):gsc_query_statsfills with up to 28 days of per-query rows; re-running produces no duplicates.Manually tested end-to-end against a live GSC account: 3 properties listed, mapping saved, sync wrote 17,434 rows (3,268 distinct queries, 28-day window), verified idempotent with zero duplicate keys.
Checklist
feature/)yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)