Fix bd migrate loop: skip prefix validation during auto-import

When auto-importing issues from JSONL, issues with different prefixes
(e.g., gt-1 vs gastown-) would fail validation and cause an infinite
loop of failed migrations.

The fix adds SkipPrefixValidation option to CreateIssuesWithFullOptions
which propagates through EnsureIDs to skip prefix validation for issues
that already have IDs during import. This allows importing issues with
any prefix while still validating new issues created interactively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-27 21:45:42 -08:00
parent 7447a5004c
commit 22d34a22dc
4 changed files with 50 additions and 10 deletions

View File

@@ -620,7 +620,11 @@ if len(newIssues) > 0 {
}
}
if len(batchForDepth) > 0 {
if err := sqliteStore.CreateIssuesWithOptions(ctx, batchForDepth, "import", opts.OrphanHandling); err != nil {
batchOpts := sqlite.BatchCreateOptions{
OrphanHandling: opts.OrphanHandling,
SkipPrefixValidation: opts.SkipPrefixValidation,
}
if err := sqliteStore.CreateIssuesWithFullOptions(ctx, batchForDepth, "import", batchOpts); err != nil {
return fmt.Errorf("error creating depth-%d issues: %w", depth, err)
}
result.Created += len(batchForDepth)