Repository navigation
chore(db): mirror the review ai points migration - #1600
Conversation
DOS.Me applied 20261106120000_rate_review_ai_points.sql to production (DOS.Me#1553, merge 069105a7). The file is copied byte for byte from DOS.Me main, and database.types.ts is regenerated: review_ai_batches, review_ai_extractions and the three functions. Refs #1531 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Refs #1531
Mirrors the review AI points migration, which DOS.Me applied to production through DOS.Me#1553 (merge
069105a7).supabase/migrations/20261106120000_rate_review_ai_points.sqlis copied byte for byte from DOS.Me main (30336 bytes).packages/shared-data/src/database.types.tsis regenerated withpnpm gen:db-types. It addsreview_ai_batches,review_ai_extractions,store_review_ai_points,purge_review_ai_pointsandreview_ai_text_hash.scripts/test-review-ai-points-proposal.mjsalready rolls the migration back first when the reference stack has it, so the proposal replay keeps running on the mirrored stack.The local Docker replays were not waited on; CI runs the same replays.
🤖 Generated with Claude Code
📌 TL;DR
This PR introduces the database schema and logic for the AI Review Points feature, adding tables to track AI batch processing costs and extraction markers, along with secure RPC functions to validate, store, and purge AI-generated review insights.
🎯 Type of Change
🔍 Changes Walkthrough
packages/shared-data/src/database.types.tsreview_ai_batchesandreview_ai_extractionstables, including their row structures, relationships, and the newpurge_review_ai_points,review_ai_text_hash, andstore_review_ai_pointsfunctions.supabase/migrations/20261106120000_rate_review_ai_points.sql1. Tables: Creates
review_ai_batches(cost tracking/manifests) andreview_ai_extractions(process-once markers per review).2. Security: Configures RLS policies restricting writes to
service_roleandrate_worker.3. Functions: Adds
review_ai_text_hash(NFC-normalized SHA256),store_review_ai_points(validates AI output against strict criteria like length, duplicates, and evidence quotes before writing), andpurge_review_ai_points(removes AI lines/markers by version).📊 Architectural Flow
sequenceDiagram participant Job as AI Job (rate_worker) participant DB as Supabase DB participant Batches as review_ai_batches participant Extractions as review_ai_extractions participant Points as review_points Note over Job, DB: 1. Batch Submission Job->>Batches: INSERT batch record (id, manifest, reserved_cost) Note over Job, DB: 2. Processing & Validation Job->>DB: Call store_review_ai_points(p_rows) activate DB DB->>DB: Validate shape, criteria, length, duplicates DB->>DB: Check review status (crawl, no writer lines, hash match) alt Valid AI Points DB->>Points: DELETE existing 'ai' lines DB->>Points: INSERT new 'ai' lines DB->>Extractions: UPSERT marker (outcome: 'stored') else Failed/Empty/Rejected DB->>Extractions: UPSERT marker (outcome: 'failed'/'empty'/'rejected') end deactivate DB DB-->>Job: Return counts (stored, failed, etc.) Note over Job, DB: 3. Batch Completion Job->>Batches: UPDATE batch (status: 'stored', cost_usd) Note over Job, DB: 4. Purge (Optional) Job->>DB: Call purge_review_ai_points(version) activate DB DB->>Points: DELETE 'ai' lines for version DB->>Extractions: DELETE markers for version deactivate DBSummary by CodeRabbit