Skip to content

fix(code-reviews): review .sql migration files for production safety#982

Merged
alex-alecu merged 4 commits intomainfrom
worktree-feat/review-prompt-for-db-deploy
Mar 11, 2026
Merged

fix(code-reviews): review .sql migration files for production safety#982
alex-alecu merged 4 commits intomainfrom
worktree-feat/review-prompt-for-db-deploy

Conversation

@alex-alecu
Copy link
Copy Markdown
Contributor

@alex-alecu alex-alecu commented Mar 10, 2026

Summary

  • Narrow the "skip" rule from "migrations" to "migration snapshots & journals" so auto-generated Drizzle metadata (meta/_journal.json, meta/*_snapshot.json, migrations.js) is still skipped, but hand-written .sql migration files are reviewed
  • Add DB migration review checklist: table-locking DDL without CONCURRENTLY, NOT NULL without DEFAULT, column drops, unbatched backfills, missing partial indexes
  • Bump prompt template versions (GitHub v5.6.0, GitLab v5.7.0-gitlab)

Context: PR #979 added a CREATE INDEX on a high-write table. A human caught the missing CONCURRENTLY but the code reviewer skipped the file entirely because the prompt said to skip all migrations.

Verification

  • pnpm typecheck passes
  • pnpm test generate-prompt — all 14 tests pass

Visual Changes

N/A

Reviewer Notes

The key change in the whatToReview field is the "Skip these" bullet: Generated files (lock files, migrations)Generated files (lock files, migration snapshots & journals). This removes the contradiction with the new "Database migrations (.sql files — DO review these)" section that was flagged by both sentry[bot] and kilo-code-bot[bot].

The reviewer prompt told the agent to skip all migrations. This meant
dangerous DDL like CREATE INDEX without CONCURRENTLY went unflagged.

Narrow the skip rule to migration snapshots/journals only and add
explicit checks for table-locking DDL, NOT NULL without DEFAULT,
column drops, unbatched backfills, and missing partial indexes.
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 10, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/lib/code-reviews/prompts/default-prompt-template.json
  • src/lib/code-reviews/prompts/default-prompt-template-gitlab.json

Reviewed by gpt-5.4-20260305 · 322,950 tokens

Comment thread src/lib/code-reviews/prompts/default-prompt-template.json Outdated
Comment thread src/lib/code-reviews/prompts/default-prompt-template.json Outdated
Comment thread src/lib/code-reviews/prompts/default-prompt-template-gitlab.json Outdated
…for .sql migrations

The skip list said 'migrations' which contradicted the new DB migration
review checklist. Narrow it to 'migration snapshots & journals' so .sql
files are consistently reviewed.
Copy link
Copy Markdown
Contributor

@RSO RSO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure how I feel about hard-coding stuff like this in the prompt. That can get hairy real quick if we want to also worry about MySQL/Redis/whatever.

@alex-alecu alex-alecu enabled auto-merge March 11, 2026 08:16
@alex-alecu alex-alecu merged commit 4ba4a68 into main Mar 11, 2026
18 checks passed
@alex-alecu alex-alecu deleted the worktree-feat/review-prompt-for-db-deploy branch March 11, 2026 08:16
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