Commit Graph

921 Commits

Author SHA1 Message Date
Steve Yegge
2276d5e428 Implement hash ID generation (bd-168)
- Add generateHashID function with SHA256-based IDs
- Update CreateIssue and CreateIssues to use hash IDs
- Add collision detection with nonce retry logic
- Add comprehensive tests for hash ID generation
- Hash IDs format: prefix-<8 hex chars> (e.g., bd-a3f8e9a2)

Amp-Thread-ID: https://ampcode.com/threads/T-48f75379-427f-4d72-bbc2-42bad0d0d62d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 14:16:35 -07:00
Steve Yegge
6091e87cd1 Revert "Implement hash ID generation (bd-168)"
This reverts commit 2480316248.
2025-10-30 14:16:24 -07:00
Steve Yegge
2480316248 Implement hash ID generation (bd-168)
- Add generateHashID function with SHA256-based IDs
- Update CreateIssue and CreateIssues to use hash IDs
- Add collision detection with nonce retry logic
- Add comprehensive tests for hash ID generation
- Hash IDs format: prefix-<8 hex chars> (e.g., bd-a3f8e9a2)

Amp-Thread-ID: https://ampcode.com/threads/T-48f75379-427f-4d72-bbc2-42bad0d0d62d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 14:12:29 -07:00
Steve Yegge
7a1ad14509 bd sync: 2025-10-30 14:12:20 2025-10-30 14:12:20 -07:00
Steve Yegge
6f6f040cf4 bd sync: 2025-10-30 14:04:13 2025-10-30 14:04:13 -07:00
Steve Yegge
2b05ec65f8 Implement 6-char progressive hash IDs (bd-166, bd-167)
- Hash ID generation now returns full 64-char SHA256
- Progressive collision handling: 6→7→8 chars on INSERT failure
- Added child_counters table for hierarchical IDs
- Updated all docs to reflect 6-char design
- Collision math: 97% of 1K issues stay at 6 chars

Next: Implement progressive retry logic in CreateIssue (bd-168)
Amp-Thread-ID: https://ampcode.com/threads/T-9931c1b7-c989-47a1-8e6a-a04469bd937d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 14:04:03 -07:00
Steve Yegge
4e12f23470 bd sync: 2025-10-30 14:02:09 2025-10-30 14:02:09 -07:00
Steve Yegge
a3f2dda482 Clarify prefix-optional CLI design in bd-165 and bd-170
Updated hash ID design to explicitly document hybrid approach:
- Storage: Always use prefix (bd-a3f8e9)
- CLI input: Prefix optional (a3f8e9 or bd-a3f8e9 both work)
- CLI output: Always show prefix (for external clarity)

Rationale:
 External references are unambiguous: "Fixed in bd-a3f8e9"
 CLI convenience: Less typing when using bd commands
 Grep-able: Can search for bd-a3f8e9 across files
 Future-proof: Supports multiple database prefixes
 No conflict with git SHAs in commit messages

Updated issues:
- bd-165: Added "ID Structure" section with prefix behavior
- bd-170: Detailed prefix parsing logic and examples

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 00:33:05 -07:00
Steve Yegge
b078ade2a8 Move collision analysis to docs/ and create bd-191
- Moved collision-resolution-failure-analysis.md to docs/
  (better organization with other architecture docs)

- Created bd-191: Add --parent flag to bd list command
  Useful for listing children of an epic, will be even better
  with hierarchical IDs (bd-165)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 00:27:59 -07:00
Steve Yegge
312af83f63 Update hash ID design to use hierarchical children (bd-165)
Major simplification of the hash ID proposal:
- Remove separate alias system (was adding complexity)
- Add hierarchical sequential children: bd-{hash}.1.2.3
- Up to 3 levels deep for natural work breakdown structure
- Git-style prefix matching instead of #aliases

Benefits:
 Simpler architecture (no alias counter to coordinate)
 Human-friendly IDs where it matters (epic children)
 Natural WBS encoding in IDs
 Collision-free at top level, rare within epics
 -1000 LOC vs dual-system approach

Updated issues:
- bd-165: Core epic with new design doc
- bd-167: child_counters table (not alias table)
- bd-168: hierarchical child ID generation
- bd-169: JSONL format stores hierarchical IDs
- bd-170: Git-style prefix matching (not aliases)
- bd-171: Hierarchical child logic (not alias conflicts)
- bd-173: Migration preserves hierarchy
- bd-174: Tree visualization (not alias commands)
- bd-176: Updated docs plan

Timeline: ~8 weeks (down from 9 due to simplification)

Also added collision-resolution-failure-analysis.md documenting
current architecture issues to inform the redesign.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 00:26:36 -07:00
Steve Yegge
db6dd403ba Add critical warning: solo workflows only until 1.0.0 2025-10-29 23:50:04 -07:00
Steve Yegge
2d53ba347a bd sync: 2025-10-29 23:47:57 2025-10-29 23:47:57 -07:00
Steve Yegge
0b51f8c865 bd sync: 2025-10-29 23:20:22 2025-10-29 23:20:22 -07:00
Steve Yegge
5aed853646 bd sync: 2025-10-29 23:14:46 2025-10-29 23:14:46 -07:00
Steve Yegge
ea38485718 Update issues 2025-10-29 23:00:42 -07:00
Steve Yegge
91c12f61b4 Merge: use remote version 2025-10-29 22:56:19 -07:00
Steve Yegge
1ae8e64bda Close bd-160 2025-10-29 22:56:09 -07:00
Steve Yegge
24fcec03f4 bd sync: 2025-10-29 22:55:15 2025-10-29 22:55:15 -07:00
Steve Yegge
731f40da34 Fix FileWatcher robustness issues (bd-71)
- Fix Debouncer race condition with sequence numbers to prevent double-fire
- Add parent directory watch to catch file creates/renames
- Add .git/HEAD watch for branch change detection
- Implement retry/backoff (50-400ms) for re-establishing JSONL watch
- Handle Create/Chmod events in addition to Write
- Add .git/HEAD polling in polling mode
- All 18 debouncer and watcher tests pass

Amp-Thread-ID: https://ampcode.com/threads/T-4029d643-b4b4-4d3b-bd85-74461f78cd7f
Co-authored-by: Amp <amp@ampcode.com>
2025-10-29 22:55:13 -07:00
Steve Yegge
0f1b597961 chore: Bump version to 0.19.0
Release highlights:
- Fix bd-160: JSONL integrity validation prevents export deduplication data loss
- Add comprehensive integration tests for export/import workflows
- Clear export_hashes on imports to prevent staleness
- Created bd-179 epic for remaining test coverage improvements

This release fixes a critical P0 bug that could cause silent data loss
when JSONL and export_hashes diverged after git operations.
2025-10-29 22:05:18 -07:00
Steve Yegge
9ba77e981f bd sync: 2025-10-29 21:57:23 2025-10-29 21:57:23 -07:00
Steve Yegge
c34b93fa1a Fix bd-160: Implement JSONL integrity validation and prevent export deduplication data loss
## Problem
Export deduplication feature broke when JSONL and export_hashes diverged
(e.g., after git pull/reset). This caused exports to skip issues that
weren't actually in the file, leading to silent data loss.

## Solution
1. JSONL integrity validation before every export
   - Store JSONL file hash after export
   - Validate hash before export, clear export_hashes if mismatch
   - Automatically recovers from git operations changing JSONL

2. Clear export_hashes on all imports
   - Prevents stale hashes from causing future export failures
   - Import operations invalidate export_hashes state

3. Add Storage interface methods:
   - GetJSONLFileHash/SetJSONLFileHash for integrity tracking
   - ClearAllExportHashes for recovery

## Tests Added
- TestJSONLIntegrityValidation: Unit tests for validation logic
- TestImportClearsExportHashes: Verifies imports clear hashes
- TestExportIntegrityAfterJSONLTruncation: Simulates git reset (would have caught bd-160)
- TestExportIntegrityAfterJSONLDeletion: Tests recovery from file deletion
- TestMultipleExportsStayConsistent: Tests repeated export integrity

## Follow-up
Created bd-179 epic for remaining integration test gaps (multi-repo sync,
daemon auto-sync, corruption recovery tests).

Closes bd-160
2025-10-29 21:57:15 -07:00
Steve Yegge
52e6361ad8 Add recovery plan documentation for bd-160 export bug 2025-10-29 21:37:58 -07:00
Steve Yegge
d5400dcdeb bd sync: 2025-10-29 21:37:39 2025-10-29 21:37:39 -07:00
Steve Yegge
c6476fe2da bd sync: 2025-10-29 21:30:19 2025-10-29 21:30:19 -07:00
Steve Yegge
a7f86341a7 bd sync: 2025-10-29 21:21:13 2025-10-29 21:21:15 -07:00
Steve Yegge
bafa8374f9 CRITICAL: Disable export deduplication (bd-160)
The timestamp-only deduplication feature causes data loss when
export_hashes table gets out of sync with JSONL file (after git
operations, imports, etc). This leads to exports skipping issues
that aren't actually in the file.

Symptoms we saw:
- Export reports 'Skipped 128 issues with timestamp-only changes'
- JSONL only has 38 lines but DB has 149 issues
- Two repos on same commit show different issue counts
- Auto-import doesn't trigger (hash matches despite missing data)

Fix: Disable the feature entirely until we can implement proper
JSONL integrity validation (see bd-160 for proposed solutions).
2025-10-29 21:21:04 -07:00
Steve Yegge
c9704f8bd4 Fix export: clear stale export_hashes 2025-10-29 21:19:29 -07:00
Steve Yegge
98b153f2a7 bd sync: apply rename detection from import 2025-10-29 21:16:13 -07:00
Steve Yegge
a001e4ee7b bd sync: 2025-10-29 21:14:31 2025-10-29 21:14:31 -07:00
Steve Yegge
c9e6757f9e bd sync: 2025-10-29 20:48:48 2025-10-29 20:48:48 -07:00
Steve Yegge
4a9ee2f1e7 bd sync: 2025-10-29 20:48:00 2025-10-29 20:48:00 -07:00
Steve Yegge
4d62cb944c bd sync: 2025-10-29 20:45:07 2025-10-29 20:45:07 -07:00
Steve Yegge
1523bd5875 Merge remote changes 2025-10-29 20:44:28 -07:00
Steve Yegge
7001c422de bd sync: 2025-10-29 20:44:15 2025-10-29 20:44:15 -07:00
Steve Yegge
73ee51bb3f Sync bd changes: close bd-59, link bd-65 to bd-102 2025-10-29 20:44:07 -07:00
Steve Yegge
5766bcb496 Import remapped issues after collision 2025-10-29 20:02:51 -07:00
Steve Yegge
5b752903ae bd sync: 2025-10-29 20:02:48 2025-10-29 20:02:48 -07:00
Steve Yegge
08bdac1e14 bd daemon sync: 2025-10-29 19:52:19 2025-10-29 19:52:19 -07:00
Steve Yegge
6e6e7eb1f5 bd daemon sync: 2025-10-29 19:52:15 2025-10-29 19:52:15 -07:00
Steve Yegge
ba18638da2 bd sync: 2025-10-29 19:51:50 2025-10-29 19:51:50 -07:00
Steve Yegge
71cc695a7d Add issue bd-102: --json flag consistency 2025-10-29 19:49:26 -07:00
Steve Yegge
e972295c1e Sync beads database 2025-10-29 19:45:50 -07:00
Steve Yegge
17a20748cb Mark in-progress issues as open 2025-10-29 19:44:54 -07:00
Steve Yegge
6d3888617c Merge remote-tracking branch 'origin/main'
Resolved version conflicts by accepting version 0.18.0 across all files.
2025-10-29 19:41:12 -07:00
Steve Yegge
b2d874cbbf chore: Bump version to 0.18.0
Amp-Thread-ID: https://ampcode.com/threads/T-34d05149-eda4-40e0-b758-28a736a7eba6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-29 19:34:01 -07:00
Steve Yegge
0f3b826010 Resolve merge conflict: use local JSONL 2025-10-29 19:32:03 -07:00
Steve Yegge
98c39c2e6f bd sync: 2025-10-29 19:31:28 2025-10-29 19:31:28 -07:00
Steve Yegge
5513af3b63 Fix CI: Configure git identity for tests 2025-10-29 19:16:43 -07:00
Steve Yegge
3fd3760a28 bd daemon export: 2025-10-29 19:12:54 2025-10-29 19:12:54 -07:00