Critical bug fix: getNextID() was using alphabetical MAX instead of numerical MAX, causing "bd-9" to be treated as max when "bd-10" existed. This blocked all new issue creation after bd-10. Fixed by using SQL CAST to extract and compare numeric portions of IDs. This ensures bd-10 > bd-9 numerically, not alphabetically. Also completed comprehensive design for bd-9 (collision resolution): - Algorithm design with 7 phases (detection, scoring, remapping, etc.) - Created 7 child issues (bd-10, bd-12-17) breaking down implementation - Added design documents to .beads/ for future reference - Updated issues JSONL with new issues and dependencies Issues created: - bd-10: Export dependencies in JSONL - bd-12: Collision detection - bd-13: Reference scoring algorithm - bd-14: ID remapping with updates - bd-15: CLI flags and reporting - bd-16: Comprehensive tests - bd-17: Documentation updates - bd-18: Add design/notes fields to update command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
87 lines
6.2 KiB
Plaintext
87 lines
6.2 KiB
Plaintext
# Child Issues for BD-9: Collision Resolution
|
|
|
|
## Issues to Create
|
|
|
|
These issues break down bd-9 into implementable chunks. Link them all to bd-9 as parent-child dependencies.
|
|
|
|
### Issue 1: Extend export to include dependencies
|
|
**Title**: Extend export to include dependencies in JSONL
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Modify export.go to include dependencies array in each issue's JSONL output. This makes JSONL self-contained and enables proper collision resolution. Format: {"id":"bd-10","dependencies":[{"depends_on_id":"bd-5","type":"blocks"}]}
|
|
**Command**: `bd create "Extend export to include dependencies in JSONL" -t task -p 1 -d "Modify export.go to include dependencies array in each issue's JSONL output. This makes JSONL self-contained and enables proper collision resolution. Format: {\"id\":\"bd-10\",\"dependencies\":[{\"depends_on_id\":\"bd-5\",\"type\":\"blocks\"}]}"`
|
|
|
|
### Issue 2: Implement collision detection
|
|
**Title**: Implement collision detection in import
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Create collision.go with detectCollisions() function. Compare incoming JSONL issues against DB state. Distinguish between: (1) exact match (idempotent), (2) ID match but different content (collision), (3) new issue. Return list of colliding issues.
|
|
**Command**: `bd create "Implement collision detection in import" -t task -p 1 -d "Create collision.go with detectCollisions() function. Compare incoming JSONL issues against DB state. Distinguish between: (1) exact match (idempotent), (2) ID match but different content (collision), (3) new issue. Return list of colliding issues."`
|
|
|
|
### Issue 3: Implement reference scoring
|
|
**Title**: Implement reference scoring algorithm
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Count references for each colliding issue: text mentions in descriptions/notes/design fields + dependency references. Sort collisions by score ascending (fewest refs first). This minimizes total updates during renumbering.
|
|
**Command**: `bd create "Implement reference scoring algorithm" -t task -p 1 -d "Count references for each colliding issue: text mentions in descriptions/notes/design fields + dependency references. Sort collisions by score ascending (fewest refs first). This minimizes total updates during renumbering."`
|
|
|
|
### Issue 4: Implement ID remapping
|
|
**Title**: Implement ID remapping with reference updates
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Allocate new IDs for colliding issues. Update all text field references using word-boundary regex (\bbd-10\b). Update dependency records. Build id_mapping for reporting. Handle chain dependencies properly.
|
|
**Command**: `bd create "Implement ID remapping with reference updates" -t task -p 1 -d "Allocate new IDs for colliding issues. Update all text field references using word-boundary regex (\\bbd-10\\b). Update dependency records. Build id_mapping for reporting. Handle chain dependencies properly."`
|
|
|
|
### Issue 5: Add CLI flags
|
|
**Title**: Add --resolve-collisions flag and user reporting
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Add import flags: --resolve-collisions (auto-fix) and --dry-run (preview). Display clear report: collisions detected, remappings applied (old→new with scores), reference counts updated. Default behavior: fail on collision (safe).
|
|
**Command**: `bd create "Add --resolve-collisions flag and user reporting" -t task -p 1 -d "Add import flags: --resolve-collisions (auto-fix) and --dry-run (preview). Display clear report: collisions detected, remappings applied (old→new with scores), reference counts updated. Default behavior: fail on collision (safe)."`
|
|
|
|
### Issue 6: Write tests
|
|
**Title**: Write comprehensive collision resolution tests
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Test cases: simple collision, multiple collisions, dependency updates, text reference updates, chain dependencies, edge cases (partial ID matches, case sensitivity, triple merges). Add to import_test.go and collision_test.go.
|
|
**Command**: `bd create "Write comprehensive collision resolution tests" -t task -p 1 -d "Test cases: simple collision, multiple collisions, dependency updates, text reference updates, chain dependencies, edge cases (partial ID matches, case sensitivity, triple merges). Add to import_test.go and collision_test.go."`
|
|
|
|
### Issue 7: Update docs
|
|
**Title**: Update documentation for collision resolution
|
|
**Type**: task
|
|
**Priority**: 1
|
|
**Description**: Update README.md with collision resolution section. Update CLAUDE.md with new workflow. Document --resolve-collisions and --dry-run flags. Add example scenarios showing branch merge workflows.
|
|
**Command**: `bd create "Update documentation for collision resolution" -t task -p 1 -d "Update README.md with collision resolution section. Update CLAUDE.md with new workflow. Document --resolve-collisions and --dry-run flags. Add example scenarios showing branch merge workflows."`
|
|
|
|
## Additional Feature Issue
|
|
|
|
### Issue: Add design field support to update command
|
|
**Title**: Add design/notes/acceptance_criteria fields to update command
|
|
**Type**: feature
|
|
**Priority**: 2
|
|
**Description**: Currently bd update only supports status, priority, title, assignee. Add support for --design, --notes, --acceptance-criteria flags. This makes it easier to add detailed designs to issues after creation.
|
|
**Command**: `bd create "Add design/notes/acceptance_criteria fields to update command" -t feature -p 2 -d "Currently bd update only supports status, priority, title, assignee. Add support for --design, --notes, --acceptance-criteria flags. This makes it easier to add detailed designs to issues after creation."`
|
|
|
|
## Dependency Linking
|
|
|
|
After creating all child issues, link them to bd-9:
|
|
```bash
|
|
# Assuming the issues are bd-10 through bd-16 (or whatever IDs were assigned)
|
|
bd dep add <child-id> bd-9 --type parent-child
|
|
```
|
|
|
|
Example:
|
|
```bash
|
|
bd dep add bd-10 bd-9 --type parent-child
|
|
bd dep add bd-11 bd-9 --type parent-child
|
|
bd dep add bd-12 bd-9 --type parent-child
|
|
# etc.
|
|
```
|
|
|
|
## Current State
|
|
|
|
- bd-10 was created successfully ("Extend export to include dependencies")
|
|
- bd-11+ attempts failed with UNIQUE constraint errors
|
|
- This suggests those IDs already exist in the DB but may not be in the JSONL file
|
|
- Need to investigate DB/JSONL sync issue before creating more issues
|