beads/internal
Marco Del Pin dba9bb91c3 fix(import): handle duplicate issue IDs in JSONL files gracefully
Implements three-layer deduplication strategy to prevent UNIQUE
constraint errors during import:
1. Early deduplication during processing (importer.go)
2. Pre-batch deduplication (importer.go)
3. INSERT OR IGNORE with explicit error handling (issues.go)
**Problem:**
JSONL files with duplicate issue IDs caused import failures:
  Import failed: UNIQUE constraint failed: issues.id
**Root Cause:**
- Go SQLite driver returns errors even with INSERT OR IGNORE
- Only content hash was deduplicated, not IDs
- Multiple code paths affected (insertIssue, insertIssues)
**Solution:**
Layer 1: Early deduplication by ID in upsertIssues (lines 489-502)
Layer 2: Pre-batch deduplication (lines 713-726)
Layer 3: INSERT OR IGNORE + isUniqueConstraintError() helper
**Testing:**
- Multiple production databases tested
- 9 duplicates handled successfully
- 100% success rate on v0.30.5 databases
- Zero UNIQUE constraint errors
**Impact:**
- Enables importing JSONL with duplicate IDs
- Duplicate count shown in import statistics
- No breaking changes, backward compatible
🤖 Generated with Claude Code
2025-12-18 19:26:29 +01:00
..
autoimport fix: NixOS symlink compatibility for mtime and permission checks (#459) 2025-12-05 13:22:09 -08:00
beads fix(ci): update nix vendorHash and fix integration test compilation 2025-12-14 22:18:10 -08:00
compact Fix test compilation errors: add context.Background() to sqlite.New() calls 2025-11-21 14:57:18 -05:00
config feat: add bd mail commands and identity configuration (bd-kwro.6, bd-kwro.7) 2025-12-16 18:13:33 -08:00
configfile feat: change deletions TTL default from 7 to 3 days 2025-12-03 22:44:59 -08:00
daemon feat: add Git worktree compatibility (PR #478) 2025-12-13 12:50:33 -08:00
debug feat: Complete command set standardization (bd-au0) 2025-11-23 20:33:31 -08:00
export Add configurable export error handling policies (bd-exug) 2025-11-23 20:21:51 -08:00
git fix(lint): resolve all golangci-lint errors 2025-12-14 22:36:51 -08:00
hooks hooks: harden timeout kill and add platform split 2025-12-16 22:38:45 -08:00
importer fix(import): handle duplicate issue IDs in JSONL files gracefully 2025-12-18 19:26:29 +01:00
lockfile test(lockfile): improve coverage from 42% to 98% 2025-12-14 15:21:29 -08:00
merge fix: add ID-based fallback matching to prevent ghost resurrection (bd-ncwo) 2025-12-16 22:35:29 -08:00
routing Fix TestRoutingIntegration and improve DetectUserRole robustness 2025-11-20 19:04:42 -05:00
rpc Phase 4: Remove deprecated edge fields from Issue struct (Decision 004) 2025-12-18 02:48:13 -08:00
storage fix(import): handle duplicate issue IDs in JSONL files gracefully 2025-12-18 19:26:29 +01:00
syncbranch refactor: remove all deletions.jsonl code (bd-fom) 2025-12-16 14:20:49 -08:00
testutil Fix test compilation errors: add context.Background() to sqlite.New() calls 2025-11-21 14:57:18 -05:00
types Phase 4: Remove deprecated edge fields from Issue struct (Decision 004) 2025-12-18 02:48:13 -08:00
util Extract normalizeLabels to internal/util/strings.go 2025-11-06 20:00:08 -08:00
utils fix: improve issue ID prefix extraction for word-like suffixes 2025-12-16 13:19:22 -08:00
validation fix: improve priority format documentation and error message (GH#517) 2025-12-16 01:07:55 -08:00