Skip to content

fix(db): define the legacy purge without running it - #78

Merged
Programcode merged 1 commit into
mainfrom
fix/defer-legacy-purge
Sep 30, 2026
Merged

Programcode merged 1 commit into
mainfrom
fix/defer-legacy-purge

Conversation

@Programcode

@Programcode Programcode commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Outcome

20260926090100_legacy_debate_cleanup.sql now defines private.purge_legacy_debate_material but no longer calls it. Applying the migration deletes nothing, so supabase db push is safe on production and staging.

Why

Production never applied this migration. Because migrations apply in order, it also blocked 20260927170000_debate_context_pins.sql. Vercel already serves the pins UI from main, but production has no debate_context_pins table, so those requests fail with PGRST205.

Adam decided on 2026-09-30 to keep production's legacy material. Legacy rows stay in the Unsorted view. The purge is still available as a separate, explicitly authorized call. The migration header shows the exact statement.

Changes

  • The migration drops the SELECT private.purge_legacy_debate_material(...) call. The function body, the revokes and the pgTAP coverage are unchanged.
  • supabase/README.md describes the migration as non-destructive and says the purge needs separate authorization.

Verification

  • ./.superset/db-gate.sh: see the comment below.
  • GitHub Actions is blocked by billing, so the hosted checks can't run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Behavior Changes
    • Applying the migration no longer automatically deletes legacy debate material. Existing legacy entries remain in the Unsorted view unless a separate, explicitly authorized purge is run.
  • Documentation
    • Clarified that the migration defines the purge operation but does not execute it. The documented 30-day inactivity cutoff, rollout-time reference, and exclusion of work created after rollout remain unchanged.

The legacy cleanup migration deleted legacy results, chats, flowcharts,
sparring rounds and sources the moment it was applied. Production never
applied it, and the pins migration that follows it is blocked behind it.

Adam decided on 2026-09-30 to keep production's legacy material. The
migration now only defines private.purge_legacy_debate_material, so
db push is safe on every project. Running the purge is a separate call
that needs explicit authorization. The pgTAP tests still call the
function directly, so its behavior stays covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:38
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Sep 30, 2026 1:39pm UTC

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

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).

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 9d33dd8e-e164-4fc9-9f22-be38a2961798

📥 Commits

Reviewing files that changed from the base of the PR and between f98624f and 582209d.

📒 Files selected for processing (2)
  • supabase/README.md
  • supabase/migrations/20260926090100_legacy_debate_cleanup.sql
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: a83fe4d5-edcb-487e-9aa6-589da04d8140

📥 Commits

Reviewing files that changed from the base of the PR and between f98624f and 582209d.

📒 Files selected for processing (2)
  • supabase/README.md
  • supabase/migrations/20260926090100_legacy_debate_cleanup.sql

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The migration defines the legacy purge function without invoking it. Applying the migration no longer deletes legacy rows. The README documents that a remote purge requires a separate, explicitly authorized call and retains the documented deletion criteria.

Changes

Legacy cleanup

Layer / File(s) Summary
Define cleanup without automatic execution
supabase/migrations/20260926090100_legacy_debate_cleanup.sql, supabase/README.md
The migration comments describe the purge function and show a separate authorized call. The automatic function call is removed. The README states that applying the migration performs no deletions and documents the purge scope.

Estimated code review effort: 2 (Simple) | ~8 minutes

Architecture Summary

Architecture risk: 🔵 Low · up to 58220

The change affects 1 system.

Changed systems: supabase

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — supabase (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in supabase/README.md: The migration description now says the migration defines the cleanup function without calling it, so migration application performs no deletions and legacy rows remain in the Unsorted view. It identifies a remote purge as a separate destructive action requiring explicit authorization. The documented deletion scope still covers specified legacy material belonging to no debate and inactive during the 30 days before rollout; post-rollout work remains excluded.
  • observed — Modified behavior in supabase/migrations/20260926090100_legacy_debate_cleanup.sql: The comments now describe the migration as defining—but not executing—the purge function, state that production legacy material remains in the Unsorted view until an explicitly authorized call, and show that call as an example.
  • observed — Modified behavior in supabase/migrations/20260926090100_legacy_debate_cleanup.sql: The migration’s call to private.purge_legacy_debate_material with the rollout start time was removed.

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

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

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 56 minutes.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode
Programcode merged commit 2d57b2e into main Sep 30, 2026
5 of 8 checks passed
@Programcode
Programcode deleted the fix/defer-legacy-purge branch September 30, 2026 14:05

This branch was successfully deployed

1 active deployment
Preview — 582209dc Deployed Sep 30, 2026 by vercel[bot]
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