Files
gstack/review/specialists/data-migration.md
Garry Tan 9ca8f1d7a9 feat: adaptive gating + cross-review dedup for review army (v0.15.2.0) (#760)
* feat: add test_stub optional field to specialist finding schema

All specialist prompts now document test_stub as an optional output field,
enabling specialists to suggest test code alongside findings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: adaptive gating + test framework detection for review army

Adds gstack-specialist-stats binary for tracking specialist hit rates.
Resolver now detects test framework for test_stub generation, applies
adaptive gating to skip silent specialists, and compiles per-specialist
stats for the review-log entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: cross-review finding dedup + test stub override + enriched review-log

Step 5.0 suppresses findings previously skipped by the user when the
relevant code hasn't changed. Test stub findings force ASK classification
so users approve test creation. Review-log now includes quality_score,
per-specialist stats, and per-finding action records.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump version and changelog (v0.15.2.0)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: bash operator precedence in test framework detection

[ -f a ] || [ -f b ] && X="y" evaluates as A || (B && C), so the
assignment only runs when the second test passes. Wrap the OR group
in braces: { [ -f a ] || [ -f b ]; } && X="y".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 22:46:21 -07:00

2.3 KiB

Data Migration Specialist Review Checklist

Scope: When SCOPE_MIGRATIONS=true Output: JSON objects, one finding per line. Schema: {"severity":"CRITICAL|INFORMATIONAL","confidence":N,"path":"file","line":N,"category":"data-migration","summary":"...","fix":"...","fingerprint":"path:line:data-migration","specialist":"data-migration"} Optional: line, fix, fingerprint, evidence, test_stub. If no findings: output NO FINDINGS and nothing else.


Categories

Reversibility

  • Can this migration be rolled back without data loss?
  • Is there a corresponding down/rollback migration?
  • Does the rollback actually undo the change or just no-op?
  • Would rolling back break the current application code?

Data Loss Risk

  • Dropping columns that still contain data (add deprecation period first)
  • Changing column types that truncate data (varchar(255) → varchar(50))
  • Removing tables without verifying no code references them
  • Renaming columns without updating all references (ORM, raw SQL, views)
  • NOT NULL constraints added to columns with existing NULL values (needs backfill first)

Lock Duration

  • ALTER TABLE on large tables without CONCURRENTLY (PostgreSQL)
  • Adding indexes without CONCURRENTLY on tables with >100K rows
  • Multiple ALTER TABLE statements that could be combined into one lock acquisition
  • Schema changes that acquire exclusive locks during peak traffic hours

Backfill Strategy

  • New NOT NULL columns without DEFAULT value (requires backfill before constraint)
  • New columns with computed defaults that need batch population
  • Missing backfill script or rake task for existing records
  • Backfill that updates all rows at once instead of batching (locks table)

Index Creation

  • CREATE INDEX without CONCURRENTLY on production tables
  • Duplicate indexes (new index covers same columns as existing one)
  • Missing indexes on new foreign key columns
  • Partial indexes where a full index would be more useful (or vice versa)

Multi-Phase Safety

  • Migrations that must be deployed in a specific order with application code
  • Schema changes that break the current running code (deploy code first, then migrate)
  • Migrations that assume a deploy boundary (old code + new schema = crash)
  • Missing feature flag to handle mixed old/new code during rolling deploy