test: add comprehensive orphan handling mode tests

- TestOrphanHandling_Strict: Verifies import fails on missing parent
- TestOrphanHandling_Resurrect: Verifies parent tombstone creation
- TestOrphanHandling_Skip: Verifies orphans are skipped with warning
- TestOrphanHandling_Allow: Verifies orphans import without validation
- TestOrphanHandling_Config: Tests config reading with all modes + defaults
- TestOrphanHandling_NonHierarchical: Verifies flat IDs work in all modes

Also fixes batch_ops_test.go to pass OrphanHandling parameter to generateBatchIDs.

All tests pass. Closes bd-968f

Amp-Thread-ID: https://ampcode.com/threads/T-fd18d4a5-06b3-4400-9073-194d570846d8
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-05 00:02:57 -08:00
parent ff8f6ecadf
commit 265b142dc5
2 changed files with 272 additions and 2 deletions

View File

@@ -270,7 +270,7 @@ func TestGenerateBatchIDs(t *testing.T) {
{Title: "Issue 3", Description: "Third", CreatedAt: time.Now()},
}
err = s.generateBatchIDs(ctx, conn, issues, "test-actor")
err = s.generateBatchIDs(ctx, conn, issues, "test-actor", OrphanAllow)
if err != nil {
t.Fatalf("failed to generate IDs: %v", err)
}
@@ -299,7 +299,7 @@ func TestGenerateBatchIDs(t *testing.T) {
{ID: "wrong-prefix-123", Title: "Wrong", CreatedAt: time.Now()},
}
err = s.generateBatchIDs(ctx, conn, issues, "test-actor")
err = s.generateBatchIDs(ctx, conn, issues, "test-actor", OrphanAllow)
if err == nil {
t.Fatal("expected error for wrong prefix")
}