Fix bd-88: import now reports unchanged issues correctly

When importing JSONL that matches the database exactly, import was
reporting '0 created, 0 updated' which was confusing. Now it properly
tracks and reports unchanged issues.

Changes:
- Added Unchanged field to ImportResult
- Track unchanged issues separately from skipped/updated
- Display unchanged count in import summary
- Updated dry-run output to show unchanged count
- Added test to verify correct reporting behavior

Example output: 'Import complete: 0 created, 0 updated, 88 unchanged'

Amp-Thread-ID: https://ampcode.com/threads/T-5dd4843e-9ce3-4fe0-9658-d2227b0a2e4e
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-23 23:08:02 -07:00
parent 0b819e1f40
commit e5022171ef
4 changed files with 116 additions and 7 deletions

View File

@@ -141,8 +141,11 @@ Behavior:
} else if !result.PrefixMismatch {
fmt.Fprintf(os.Stderr, "No collisions detected.\n")
}
fmt.Fprintf(os.Stderr, "Would create %d new issues, update %d existing issues\n",
result.Created, result.Updated)
msg := fmt.Sprintf("Would create %d new issues, update %d existing issues", result.Created, result.Updated)
if result.Unchanged > 0 {
msg += fmt.Sprintf(", %d unchanged", result.Unchanged)
}
fmt.Fprintf(os.Stderr, "%s\n", msg)
fmt.Fprintf(os.Stderr, "\nDry-run mode: no changes made\n")
os.Exit(0)
}
@@ -177,6 +180,9 @@ Behavior:
// Print summary
fmt.Fprintf(os.Stderr, "Import complete: %d created, %d updated", result.Created, result.Updated)
if result.Unchanged > 0 {
fmt.Fprintf(os.Stderr, ", %d unchanged", result.Unchanged)
}
if result.Skipped > 0 {
fmt.Fprintf(os.Stderr, ", %d skipped", result.Skipped)
}