Skip to content

moonlight-lupin/agent-skills / plugins/dev-pipeline/skills/review-lessons

review-lessons

Verified

Library of lessons from past build-review loops — not a stage. Use when a review or fix round hits a specific case: a reviewer BLOCKING that contradicts the brief, a test that passes but checks nothing, a feature dead in production, SQLite/WAL migrations, MCP tool surfaces, REST API authz, app ↔ external-source sync, Android/APK verification, fill-template extraction, CLI/git mechanics, reviewer outages. Load the one file the case needs; never load the whole library.

FileKindSize
SKILL.mdexecutableskill md5.5 KB
references/architecture-refactor-test-updates.mdexecutablescript2.9 KB
references/beta-gate-release-hardening.mdexecutablescript3.3 KB
references/ci-and-repo-hygiene.mdexecutablescript3.7 KB
references/confirm-loop-lessons.mdexecutablescript24.2 KB
references/cross-model-parallel-review.mdexecutablescript4.8 KB
references/data-integrity-principles.mdexecutablescript7.3 KB
references/delegate-skills-adaptation.mdexecutablescript2.1 KB
references/evidence-pairs.mdexecutablescript2.5 KB
references/extraction-from-filled-docs.mdexecutablescript6.1 KB
references/field-briefing-integration.mdexecutablescript5.2 KB
references/full-module-replacement-scoping.mdexecutablescript6.3 KB
references/generated-frontmatter-and-reviewer-outages.mdexecutablescript3.0 KB
references/loop-pitfalls.mdexecutablescript27.9 KB
references/mcp-category-tool-implementation.mdexecutablescript5.3 KB
references/mcp-design-review-patterns.mdexecutablescript5.7 KB
references/minified-bundle-selector-research.mdexecutablescript4.4 KB
references/mobile-app-verification.mdexecutablescript4.8 KB
references/multi-batch-sequencing.mdexecutablescript5.7 KB
references/parallel-dual-review.mdexecutablescript10.8 KB
references/pitfalls-dispatch-semantics.mdexecutablescript6.3 KB
references/pitfalls-fix-round-verification.mdexecutablescript6.6 KB
references/planning-with-files-adaptation.mdexecutablescript2.6 KB
references/plugin-gates-and-fix-rounds.mdexecutablescript8.2 KB
references/production-reachability-review.mdexecutablescript5.0 KB
references/reconciliation-review-findings.mdexecutablescript3.1 KB
references/rest-api-review-checklist.mdexecutablescript13.0 KB
references/review-findings-adjudication.mdexecutablescript34.4 KB
references/scope-test-in-process-execution.mdexecutablescript4.2 KB
references/security-property-tests.mdexecutablescript14.2 KB
references/sqlite-migration-pitfalls.mdexecutablescript4.1 KB
references/sqlite-wal-review-findings.mdexecutablescript5.0 KB
references/sync-pipeline-review-patterns.mdexecutablescript13.2 KB
references/tool-mechanics-pitfalls.mdexecutablescript44.1 KB
references/upgrade-path-test-pattern.mdexecutablescript3.0 KB

references/upgrade-path-test-pattern.md

View on GitHub
# Upgrade-Path Test Pattern

Learned from a sixth-pass review (Aug 2026). The reviewer identified that migration 055's data-loss bug was invisible to all 1272 passing tests because every test bootstraps a fresh database — migrations run on an empty schema where cascade-deletes have nothing to delete.

## The Problem

Migration tests typically verify that `migrate(conn)` succeeds on a fresh in-memory database. But migrations that rebuild tables (DROP + CREATE + INSERT) can silently destroy data when run against a populated database. The fresh-DB test pattern cannot catch this because:

1. All migrations run in order on an empty schema
2. The table being rebuilt has zero rows
3. CASCADE-deletes have nothing to cascade to
4. The test passes, the bug ships

## The Fix: Upgrade-Path Tests

Write tests that:
1. Bootstrap a fresh database (migrate runs all migrations)
2. Seed real data (company, accounts, entries, lines)
3. Assert row counts are non-zero
4. Re-run migrate (idempotent — nothing to apply)
5. Assert row counts are unchanged

```python
class TestUpgradePath:
    def test_journal_lines_survive_full_migration_chain(self, tmp_path):
        conn = sqlite3.connect(str(tmp_path / "upgrade.db"))
        conn.row_factory = sqlite3.Row
        migrate(conn)

        # Seed real data
        company = setup_company(conn, Company(name="Upgrade Co"))
        cid = company.id
        seed_accounts_from_template(conn, cid, "sg_sme_default")
        create_fiscal_period(conn, FiscalPeriod(...))
        entry = create_entry(conn, JournalEntry(..., lines=[...]))
        submit_entry(conn, cid, entry.id)
        approve_entry(conn, cid, entry.id)

        lines_before = conn.execute("SELECT COUNT(*) FROM journal_lines").fetchone()[0]
        assert lines_before == 2

        # Re-run migrate — should be idempotent
        applied = migrate(conn)
        assert applied == []

        # CRITICAL: lines must survive
        lines_after = conn.execute("SELECT COUNT(*) FROM journal_lines").fetchone()[0]
        assert lines_after == lines_before, (
            f"Journal lines lost during migration: {lines_before} -> {lines_after}"
        )
```

## Also Test DB Constraints Accept New Values

After a migration that widens a CHECK constraint, verify the new value is accepted at the DB level:

```python
def test_fx_revaluation_entry_type_accepted_in_db(self, tmp_path):
    conn = sqlite3.connect(str(tmp_path / "fxr.db"))
    conn.row_factory = sqlite3.Row
    migrate(conn)
    # ... setup ...
    conn.execute(
        "INSERT INTO journal_entries (..., entry_type, ...) VALUES (..., 'fx_revaluation', ...)",
        (...)
    )
    conn.commit()
    row = conn.execute("SELECT entry_type FROM journal_entries WHERE entry_no = ?", ...).fetchone()
    assert row["entry_type"] == "fx_revaluation"
```

## General Rule

Any migration that rebuilds a table (DROP + CREATE + INSERT pattern) needs an upgrade-path test that seeds data before the migration and verifies data survives after. Fresh-DB tests alone cannot catch cascade-delete data loss.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall