Switch from hex to Base36 encoding for issue IDs (GH #213)
This change improves information density by using Base36 (0-9, a-z) instead of hex (0-9, a-f) for hash-based issue IDs. Key benefits: - Shorter IDs: Can now use 3-char IDs (was 4-char minimum) - Better scaling: 3 chars good for ~160 issues, 4 chars for ~980 issues - Case-insensitive: Maintains excellent CLI usability - Backward compatible: Old hex IDs continue to work Changes: - Implemented Base36 encoding with proper truncation (keep LSB) - Updated adaptive length thresholds (3-8 chars instead of 4-8) - Fixed collision probability math to match encoding (was calculating for base36 but encoding in hex - now both use base36) - Fixed ID parser bug (use prefixWithHyphen for substring matching) - Updated all tests and test data patterns Fixes #213 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2
cmd/bd/testdata/blocked.txt
vendored
2
cmd/bd/testdata/blocked.txt
vendored
@@ -4,7 +4,7 @@ bd init --prefix test
|
||||
# Create first issue
|
||||
bd create 'First issue'
|
||||
cp stdout first.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" first.txt > first_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" first.txt > first_id.txt'
|
||||
|
||||
# Create second issue that depends on first
|
||||
exec sh -c 'bd create "Second issue" --deps $(cat first_id.txt)'
|
||||
|
||||
2
cmd/bd/testdata/close.txt
vendored
2
cmd/bd/testdata/close.txt
vendored
@@ -4,7 +4,7 @@ bd init --prefix test
|
||||
# Create issue and capture its hash ID
|
||||
bd create 'Issue to close'
|
||||
cp stdout issue.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" issue.txt > issue_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" issue.txt > issue_id.txt'
|
||||
|
||||
# Close the issue
|
||||
exec sh -c 'bd close $(cat issue_id.txt) --reason Fixed'
|
||||
|
||||
4
cmd/bd/testdata/dep_add.txt
vendored
4
cmd/bd/testdata/dep_add.txt
vendored
@@ -11,8 +11,8 @@ cp stdout second.txt
|
||||
grep 'Created issue: test-' second.txt
|
||||
|
||||
# Extract IDs using grep (hash IDs are test-XXXXXXXX format)
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" first.txt > first_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" second.txt > second_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" first.txt > first_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" second.txt > second_id.txt'
|
||||
|
||||
# Add dependency: second depends on first
|
||||
exec sh -c 'bd dep add $(cat second_id.txt) $(cat first_id.txt)'
|
||||
|
||||
4
cmd/bd/testdata/dep_remove.txt
vendored
4
cmd/bd/testdata/dep_remove.txt
vendored
@@ -4,11 +4,11 @@ bd init --prefix test
|
||||
# Create issues and capture their hash IDs
|
||||
bd create 'First issue'
|
||||
cp stdout first.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" first.txt > first_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" first.txt > first_id.txt'
|
||||
|
||||
bd create 'Second issue'
|
||||
cp stdout second.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" second.txt > second_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" second.txt > second_id.txt'
|
||||
|
||||
# Add dependency
|
||||
exec sh -c 'bd dep add $(cat second_id.txt) $(cat first_id.txt)'
|
||||
|
||||
4
cmd/bd/testdata/dep_tree.txt
vendored
4
cmd/bd/testdata/dep_tree.txt
vendored
@@ -4,11 +4,11 @@ bd init --prefix test
|
||||
# Create issues and capture their hash IDs
|
||||
bd create 'Root issue'
|
||||
cp stdout root.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" root.txt > root_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" root.txt > root_id.txt'
|
||||
|
||||
bd create 'Child issue'
|
||||
cp stdout child.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" child.txt > child_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" child.txt > child_id.txt'
|
||||
|
||||
# Add dependency: child depends on root
|
||||
exec sh -c 'bd dep add $(cat child_id.txt) $(cat root_id.txt)'
|
||||
|
||||
2
cmd/bd/testdata/show.txt
vendored
2
cmd/bd/testdata/show.txt
vendored
@@ -7,7 +7,7 @@ cp stdout issue.txt
|
||||
grep 'Created issue: test-' issue.txt
|
||||
|
||||
# Extract ID using grep
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" issue.txt > issue_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" issue.txt > issue_id.txt'
|
||||
|
||||
# Show the issue
|
||||
exec sh -c 'bd show $(cat issue_id.txt)'
|
||||
|
||||
2
cmd/bd/testdata/stats.txt
vendored
2
cmd/bd/testdata/stats.txt
vendored
@@ -4,7 +4,7 @@ bd init --prefix test
|
||||
# Create issues
|
||||
bd create 'First issue'
|
||||
cp stdout first.txt
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" first.txt > first_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" first.txt > first_id.txt'
|
||||
|
||||
bd create 'Second issue'
|
||||
|
||||
|
||||
2
cmd/bd/testdata/update.txt
vendored
2
cmd/bd/testdata/update.txt
vendored
@@ -7,7 +7,7 @@ cp stdout issue.txt
|
||||
grep 'Created issue: test-' issue.txt
|
||||
|
||||
# Extract ID using grep
|
||||
exec sh -c 'grep -oE "test-[a-f0-9]+" issue.txt > issue_id.txt'
|
||||
exec sh -c 'grep -oE "test-[a-z0-9]+" issue.txt > issue_id.txt'
|
||||
|
||||
# Update the issue status
|
||||
exec sh -c 'bd update $(cat issue_id.txt) --status in_progress'
|
||||
|
||||
Reference in New Issue
Block a user