From f2db0a1d42e447190d08662a393625eca4cb114a Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Tue, 23 Dec 2025 12:41:54 -0800 Subject: [PATCH] fix: exclude external deps from orphan check in migration invariants (bd-ucgz) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit External dependencies (external::) reference issues in other projects and are expected to not exist in the local issues table. The orphan check now excludes these with: AND d.depends_on_id NOT LIKE 'external:%' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/storage/sqlite/migration_invariants.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/storage/sqlite/migration_invariants.go b/internal/storage/sqlite/migration_invariants.go index 44aeff70..b1e3b105 100644 --- a/internal/storage/sqlite/migration_invariants.go +++ b/internal/storage/sqlite/migration_invariants.go @@ -148,11 +148,14 @@ func checkForeignKeys(db *sql.DB, snapshot *Snapshot) error { } // Check for orphaned dependencies (depends_on_id not in issues) + // Exclude external dependencies (external::) which reference + // issues in other projects and are expected to not exist locally var orphanedDepsDependsOn int err = db.QueryRow(` SELECT COUNT(*) FROM dependencies d WHERE NOT EXISTS (SELECT 1 FROM issues WHERE id = d.depends_on_id) + AND d.depends_on_id NOT LIKE 'external:%' `).Scan(&orphanedDepsDependsOn) if err != nil { return fmt.Errorf("failed to check orphaned dependencies (depends_on_id): %w", err)