Repository navigation
fix(content): drop content_plan_pages' unused overlaps from the Plan's read - #1343
Merged
gkhngyk merged 2 commits intoOct 22, 2026
Merged
Conversation
…s read 00238 redefines content_plan_pages without cur_answers, page_prompts, competing and page_overlaps, and without the pages' `overlaps` key, which nothing reads since the Plan shows the brand's cited pages as an Overview. They were the only part of the read that walked prompt_results and prompt_result_citations row by row: a cold 30-day call on the largest brand took 8.7–9.5 s, over the 8 s statement timeout. Same signature, so the grants and comment carry over. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
gkhngyk
approved these changes
Oct 22, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Two small follow-ups (reviewed 00b448e9):
supabase/migrations/00238_content_plan_pages_no_overlaps.sql:202:create or replacekeeps the function's comment, and that comment (from 00221) still ends "...AI visits and how many of its other pages compete for the same prompts". Add acomment on function public.content_plan_pages(uuid, integer) is ...after the function without that clause, and update the header at:12-13, which says the comment carries over.web/src/lib/actions/content-plan.test.ts:64-65: the fixture still saysoverlapsis "Still in the RPC (00220)", which stops being true with 00238. Drop theoverlaps: 1line and its comment, or reword the comment to say an extra key is ignored. The #1321 stack also edits this file, so a later PR is fine for this one.
Checked on prod as authenticated with the largest brand. I ran a pg_temp copy of 00238 next to the live function in a transaction that was rolled back:
| window | new, first call | live, first call | new, warm | live, warm |
|---|---|---|---|---|
| 30 days | 1.7 s | 7.4 s | 0.33 s | 0.46 s |
| 90 days | 1.1 s | 1.0 s* | 0.53 s | 0.76 s |
*The 90-day run came after the 30-day one, so the live function's prompt_results / prompt_result_citations pages were already cached.
- Output: the same as the live function's, minus each page's
overlapskey, at both windows (83 and 90 pages). - Function body: the only text changes from 00226, and from the live definition, are the four CTEs, the
overlapskey and its join. Grants,security definer,search_pathandplan_cache_modeare unchanged. - Readers: nothing else reads
content_plan_pages, in SQL or in code. schema.sqlmatches a rebuild.
Tested on top of the current main together with #1343, #1344, #1321, #1329, #1332, #1334 and #1342: web and server tests, tsc, lint and Prettier pass, and schema.sql matches a rebuild. 00229, 00234 and 00238 are applied on production.
This was referenced Oct 22, 2026
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
Follow-up you asked for on #1320:
content_plan_pagesstill computedoverlaps, which nothing reads since the Plan shows the brand's cited pages as an Overview (content-plan.tsno longer maps it).content_plan_pagesas 00226 has it, minus:cur_answers,page_prompts,competingandpage_overlaps;overlapskey and itsleft join.prompt_resultsandprompt_result_citationsrow by row. Your timing on the largest brand, asauthenticated:create or replacewith the same signature, so the grants and the comment carry over. Everything else in the function is unchanged: a text diff against 00226's definition shows only those lines removed.SQL only.
Related issue
None. Follow-up from the #1320 review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
select pg_get_functiondef('public.content_plan_pages(uuid,integer)'::regprocedure)has nooverlaps, andauthenticatedcan still execute it.overlaps./dashboard/content/planand switch periods: the cards and the list are as before.On the dev DB it's applied, the grant is kept, and the Plan loads at 7/30/90 days. The dev DB has no brand with cited own pages, so the timing is yours from prod.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/) — no web changeyarn typecheckpasses (run fromweb/) — no web changeyarn format:checkpasses (run fromweb/) — no web changebash supabase/build-schema.shwas run (00238 sits after 00236), and the migration is re-runnable.🤖 Generated with Claude Code