beads/cmd/bd
Steve Yegge 953858b853 fix: Resolve race condition in parallel issue creation (bd-89)
Fixed UNIQUE constraint errors when creating multiple issues in parallel.

Root cause: The previous two-step approach used INSERT OR IGNORE to
pre-initialize counters, followed by an UPSERT to increment. Multiple
concurrent transactions could all execute the INSERT OR IGNORE with the
same initial value, causing them to generate duplicate IDs.

Solution: Replaced with a single atomic UPSERT that:
1. Initializes counter from MAX(existing IDs) if needed
2. Updates counter to MAX(current, max existing) + 1 on conflict
3. Returns the final incremented value

This ensures counters are correctly initialized from existing issues
(fixing lazy init tests) while preventing race conditions through the
BEGIN IMMEDIATE transaction serialization.

Tested with 10 parallel processes - all succeeded with unique IDs.

Also added comprehensive profiling test suite for import performance
investigation (bd-199).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 02:57:10 -07:00
..
dep.go Fix critical race conditions in auto-flush feature 2025-10-13 22:34:12 -07:00
export.go Fix race condition in dirty issue tracking (bd-52, bd-53) 2025-10-14 00:29:23 -07:00
export_import_test.go Pre-release fixes and polish for open source launch 2025-10-12 17:28:48 -07:00
import.go feat: Add external_ref field for linking to external issue trackers 2025-10-14 02:43:10 -07:00
import_collision_test.go fix: sync ID counters after import to prevent collisions 2025-10-14 01:19:03 -07:00
import_profile_test.go fix: Resolve race condition in parallel issue creation (bd-89) 2025-10-15 02:57:10 -07:00
init.go feat: Add version mismatch detection for outdated binaries 2025-10-15 00:43:59 -07:00
main.go fix: Add collision detection to auto-import (bd-228) 2025-10-15 02:11:42 -07:00
main_test.go Add comprehensive test coverage for auto-flush feature 2025-10-13 23:38:24 -07:00
markdown.go feat: Add markdown file support to bd create command 2025-10-14 13:21:08 -07:00
markdown_test.go feat: Add markdown file support to bd create command 2025-10-14 13:21:08 -07:00
quickstart.go Fix quickstart EXTENDING.md reference to use full URL (#12) 2025-10-14 01:10:18 -07:00
ready.go Implement JSONL export/import and shift to text-first architecture 2025-10-12 01:17:50 -07:00
version.go chore: Bump version to 0.9.6 2025-10-15 02:32:15 -07:00