Implement adaptive ID length scaling (bd-ea2a13)

- Start with 4-char IDs for small databases (0-500 issues)
- Scale to 5-char at 500-1500 issues, 6-char at 1500+
- Configurable via max_collision_prob, min/max_hash_length
- Birthday paradox math ensures collision probability stays under threshold
- Comprehensive tests and documentation
- Collision calculator tool for analysis

Also filed bd-aa744b to remove sequential ID code path.
This commit is contained in:
Steve Yegge
2025-10-30 21:40:52 -07:00
parent fb48d681a1
commit 76d3403d0a
8 changed files with 864 additions and 16 deletions

View File

@@ -166,6 +166,10 @@ Configuration keys use dot-notation namespaces to organize settings:
- `compact_*` - Compaction settings (see EXTENDING.md)
- `issue_prefix` - Issue ID prefix (managed by `bd init`)
- `id_mode` - ID generation mode: `sequential` or `hash` (managed by `bd init`)
- `max_collision_prob` - Maximum collision probability for adaptive hash IDs (default: 0.25)
- `min_hash_length` - Minimum hash ID length (default: 4)
- `max_hash_length` - Maximum hash ID length (default: 8)
### Integration Namespaces
@@ -176,6 +180,26 @@ Use these namespaces for external integrations:
- `github.*` - GitHub integration settings
- `custom.*` - Custom integration settings
### Example: Adaptive Hash ID Configuration
```bash
# Configure adaptive ID lengths (see docs/ADAPTIVE_IDS.md)
# Default: 25% max collision probability
bd config set max_collision_prob "0.25"
# Start with 4-char IDs, scale up as database grows
bd config set min_hash_length "4"
bd config set max_hash_length "8"
# Stricter collision tolerance (1%)
bd config set max_collision_prob "0.01"
# Force minimum 5-char IDs for consistency
bd config set min_hash_length "5"
```
See [docs/ADAPTIVE_IDS.md](docs/ADAPTIVE_IDS.md) for detailed documentation.
### Example: Jira Integration
```bash