Commit Graph

1415 Commits

Author SHA1 Message Date
Steve Yegge
b9edb8f8a2 revmoed some old cruft 2025-11-04 22:52:04 -08:00
Steve Yegge
019c34029f removed bogus old issues file 2025-11-04 22:50:36 -08:00
Steve Yegge
ff137611b4 Delete 110 old closed issues to trim database 2025-11-04 22:46:23 -08:00
Steve Yegge
3c21dfaaac Merge fix/import-missing-parents: Parent resurrection with P0 bug fixes 2025-11-04 22:44:58 -08:00
Steve Yegge
001b74b9c3 bd sync: 2025-11-04 22:27:00 2025-11-04 22:27:00 -08:00
Steve Yegge
f1e17c2fcf Merge branch 'fix/import-missing-parents' of github.com:steveyegge/beads into fix/import-missing-parents
Amp-Thread-ID: https://ampcode.com/threads/T-cc299337-55ef-4b3e-b090-d12521080b54
Co-authored-by: Amp <amp@ampcode.com>

# Conflicts:
#	.beads/beads.jsonl
#	internal/storage/sqlite/ids.go
#	internal/storage/sqlite/resurrection.go
#	internal/storage/sqlite/resurrection_test.go
#	internal/storage/sqlite/sqlite.go
2025-11-04 22:26:11 -08:00
Steve Yegge
3af353ade3 Fix P0 bug: JSONL lookup now returns LAST match (bd-58c0)
Addresses code review feedback:

 P0 (Must Fix):
- Fix JSONL lookup to return LAST match, not FIRST (resurrection.go:160-162)
  - Changed from early return to scan all matches and keep last
  - Respects JSONL append-only semantics

 P1 (Should Fix):
- Add test for multiple JSONL versions
  - TestTryResurrectParent_MultipleVersionsInJSONL verifies correct behavior
- Document error message change in CHANGELOG.md
  - Old: "parent issue X does not exist"
  - New: "parent issue X does not exist and could not be resurrected from JSONL history"
  - Marked as breaking change for script parsers

 P2/P3 (Nice to Have):
- Add documentation to AGENTS.md explaining auto-resurrection behavior
- Document best-effort dependency resurrection

⏸️ Deferred (P1 - Optimize batch resurrection):
- Caching optimization deferred (no batch use cases currently)

All tests pass:
- Unit tests: internal/storage/sqlite/
- Integration test: TestImportWithDeletedParent
2025-11-04 22:25:33 -08:00
Steve Yegge
4c77631e48 Add comprehensive code review guide for resurrection feature
Detailed review guide covering:
- Backwards compatibility (highest priority)
- Transaction safety
- Resurrection logic correctness
- Integration points
- Testing coverage
- Edge cases
- Documentation

Includes specific code snippets, test workflows, and expected issues.
2025-11-04 22:25:33 -08:00
Steve Yegge
3cb2e790a9 Fix transaction conflict in TryResurrectParent (bd-58c0)
Refactored resurrection functions to accept optional *sql.Conn parameter:
- Added tryResurrectParentWithConn() internal function
- Added tryResurrectParentChainWithConn() internal function
- Updated CreateIssue to use conn-based resurrection
- Updated EnsureIDs to use conn-based resurrection

This eliminates 'database is locked' errors when resurrection
happens inside an existing transaction.

Fixes bd-58c0
2025-11-04 22:25:33 -08:00
Steve Yegge
c5865bc77e Add comprehensive tests for parent resurrection (bd-d19a Phase 3)
- Created resurrection_test.go with 9 unit tests covering:
  * Parent already exists (no-op)
  * Parent found in JSONL (successful resurrection)
  * Parent not in JSONL (graceful failure)
  * Missing JSONL file (graceful handling)
  * Malformed JSONL lines (skip with warning)
  * Dependency resurrection (best-effort)
  * Multi-level chain resurrection
  * Partial chain missing (stops at gap)
  * Idempotent resurrection

- Added integration test for deleted parent scenario
- Fixed resurrection.go dependency insertion (type column name)

All unit tests pass. Integration test reveals transaction conflict
that needs fixing (separate issue).

Relates to: bd-d19a
2025-11-04 22:25:33 -08:00
Steve Yegge
9e719afe8c docs: add next session guide for Phase 3 of bd-d19a 2025-11-04 22:25:33 -08:00
Steve Yegge
93195e336b feat(import): implement parent resurrection (bd-cc4f, bd-d76d, bd-02a4)
Phase 2 of fixing import failure on missing parent issues (bd-d19a).

Implemented:
- TryResurrectParent: searches JSONL history for deleted parents
- TryResurrectParentChain: recursively resurrects entire parent chains
- Creates tombstones (status=closed) to preserve hierarchical structure
- Modified EnsureIDs and CreateIssue to call resurrection before validation

When importing a child issue with missing parent:
1. Searches .beads/issues.jsonl for parent in git history
2. If found, creates tombstone with status=closed
3. Preserves original title and metadata
4. Appends original description to tombstone
5. Copies dependencies if targets exist

This allows imports to proceed even when parents were deleted,
enabling multi-repo workflows and normal database hygiene operations.

Part of bd-d19a (fix import failure on missing parents).

Amp-Thread-ID: https://ampcode.com/threads/T-a1c9e824-885e-40ce-a179-148cf39c7e64
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 22:25:33 -08:00
Steve Yegge
d6e2ff6151 Phase 1: Add topological sorting to fix import ordering
- Add sort.go with depth-based utilities (GetHierarchyDepth, SortByDepth, GroupByDepth)
- Sort issues by hierarchy depth before batch creation
- Create in depth-order batches (0→1→2→3)
- Fixes latent bug: parent-child pairs in same batch could fail if wrong order
- Comprehensive tests for all sorting functions
- Closes bd-37dd, bd-3433, bd-8b65

Part of bd-d19a (Fix import failure on missing parent issues)

Amp-Thread-ID: https://ampcode.com/threads/T-44a36985-b59c-426f-834c-60a0faa0f9fb
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 22:25:26 -08:00
Ben Lovell
b92e79f98e Fix pointer dereferencing in Update RPC handler (#223)
- Dereference Design, AcceptanceCriteria, Notes, and Assignee pointers in updatesFromArgs
- Fixes EOF errors when using --notes, --design, --assignee, or --acceptance-criteria flags
- Enhance TestUpdateIssue to verify all pointer-dereferenced fields are correctly stored
2025-11-04 22:10:56 -08:00
Steve Yegge
a40f9e1835 Add comprehensive tests for parent resurrection (bd-d19a Phase 3)
- Created resurrection_test.go with 9 unit tests covering:
  * Parent already exists (no-op)
  * Parent found in JSONL (successful resurrection)
  * Parent not in JSONL (graceful failure)
  * Missing JSONL file (graceful handling)
  * Malformed JSONL lines (skip with warning)
  * Dependency resurrection (best-effort)
  * Multi-level chain resurrection
  * Partial chain missing (stops at gap)
  * Idempotent resurrection

- Added integration test for deleted parent scenario
- Fixed resurrection.go dependency insertion (type column name)

All unit tests pass. Integration test reveals transaction conflict
that needs fixing (separate issue).

Relates to: bd-d19a
2025-11-04 13:26:57 -08:00
Steve Yegge
318709414e Update metadata 2025-11-04 13:18:55 -08:00
Steve Yegge
8530902a32 docs: add next session guide for Phase 3 of bd-d19a 2025-11-04 13:18:32 -08:00
Steve Yegge
9cad8581d2 bd sync: 2025-11-04 13:18:13 2025-11-04 13:18:13 -08:00
Steve Yegge
b41d65d833 feat(import): implement parent resurrection (bd-cc4f, bd-d76d, bd-02a4)
Phase 2 of fixing import failure on missing parent issues (bd-d19a).

Implemented:
- TryResurrectParent: searches JSONL history for deleted parents
- TryResurrectParentChain: recursively resurrects entire parent chains
- Creates tombstones (status=closed) to preserve hierarchical structure
- Modified EnsureIDs and CreateIssue to call resurrection before validation

When importing a child issue with missing parent:
1. Searches .beads/issues.jsonl for parent in git history
2. If found, creates tombstone with status=closed
3. Preserves original title and metadata
4. Appends original description to tombstone
5. Copies dependencies if targets exist

This allows imports to proceed even when parents were deleted,
enabling multi-repo workflows and normal database hygiene operations.

Part of bd-d19a (fix import failure on missing parents).

Amp-Thread-ID: https://ampcode.com/threads/T-a1c9e824-885e-40ce-a179-148cf39c7e64
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 13:16:17 -08:00
Steve Yegge
b55359d7db bd sync: 2025-11-04 13:08:01 2025-11-04 13:08:01 -08:00
Steve Yegge
0df9144a2f Delete WASM zombie issues - switched to npm package 2025-11-04 13:07:34 -08:00
Steve Yegge
f58605f26f bd sync: 2025-11-04 13:06:31 2025-11-04 13:06:31 -08:00
Steve Yegge
f2cb91d1fb Phase 1: Add topological sorting to fix import ordering
- Add sort.go with depth-based utilities (GetHierarchyDepth, SortByDepth, GroupByDepth)
- Sort issues by hierarchy depth before batch creation
- Create in depth-order batches (0→1→2→3)
- Fixes latent bug: parent-child pairs in same batch could fail if wrong order
- Comprehensive tests for all sorting functions
- Closes bd-37dd, bd-3433, bd-8b65

Part of bd-d19a (Fix import failure on missing parent issues)

Amp-Thread-ID: https://ampcode.com/threads/T-44a36985-b59c-426f-834c-60a0faa0f9fb
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 13:03:20 -08:00
Steve Yegge
7b3f762e81 bd sync: 2025-11-04 12:55:23 2025-11-04 12:55:23 -08:00
Steve Yegge
2618bee57f bd sync: 2025-11-04 12:46:20 2025-11-04 12:46:20 -08:00
Steve Yegge
aa7ec9fdbc Resolve merge conflict: accept remote 2025-11-04 12:46:19 -08:00
Steve Yegge
14bdc6fe68 Add bd migrate --to-separate-branch command
Implements bd-caa9: migration tool for existing users to enable
separate branch workflow.

Features:
- bd migrate --to-separate-branch <branch> sets sync.branch config
- Validates branch names (no whitespace/empty)
- Dry-run support with --dry-run flag
- Idempotent (safe to run multiple times)
- JSON output support
- Clear next steps for users

Closes bd-caa9, bd-a101

Amp-Thread-ID: https://ampcode.com/threads/T-93c3427d-12a1-4d9a-8690-1d0cfe22188f
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 12:39:38 -08:00
Steve Yegge
f3f5c142ce bd sync: 2025-11-04 12:36:59 2025-11-04 12:36:59 -08:00
Steve Yegge
cc9f4127ca bd sync: 2025-11-04 12:32:53 2025-11-04 12:32:53 -08:00
Steve Yegge
f76f150997 Add import bug analysis for bd-3xq
Amp-Thread-ID: https://ampcode.com/threads/T-14d3a206-aeac-4499-8ae9-47f3715e18fa
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 12:25:53 -08:00
Steve Yegge
eae4fcbec7 bd sync: 2025-11-04 11:29:29 2025-11-04 11:29:29 -08:00
Steve Yegge
e0e15400a1 bd sync: 2025-11-04 11:26:20 2025-11-04 11:26:31 -08:00
Steve Yegge
ba325a2931 Remove spurious test issues from issues.jsonl
These test issues (Frontend task, Backend task, Test Epic, etc.) were
accidentally committed during template feature development and kept
getting re-imported by auto-sync.

Restores issues.jsonl to the state before commit eb434dd.

Amp-Thread-ID: https://ampcode.com/threads/T-29a525fd-6b2d-4601-99ea-fce8c5cf6b13
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 11:26:21 -08:00
Steve Yegge
040e06dfad bd sync: 2025-11-04 11:25:42 2025-11-04 11:25:42 -08:00
Steve Yegge
b31bddc210 Optimize test suite performance - 45% reduction in integration tests
- Add testutil.TempDirInMemory() using /dev/shm on Linux for 20-30% I/O speedup
- Update slow hash multiclone tests to use in-memory filesystem
- Convert 17 scripttest tests (~200+s) to fast CLI tests (31s) with --no-daemon
- Disable slow scripttest suite behind build tag
- Add README_TESTING.md documenting test strategy and optimizations
- Update CI to use -short flag for PR checks, full tests nightly

Results:
- TestHashIDs_* reduced from ~20s to ~11s (45% reduction)
- Scripttest suite eliminated from default runs (massive speedup)
- Total integration test time significantly reduced

Closes bd-gm7p, bd-l5gq

Amp-Thread-ID: https://ampcode.com/threads/T-c2b9434a-cd29-4725-b8e0-cbea50b36fe2
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 11:25:36 -08:00
Steve Yegge
568c565e8c bd sync: 2025-11-04 10:38:13 2025-11-04 10:38:13 -08:00
Steve Yegge
e774fa46fb Merge branch 'main' of github.com:steveyegge/beads 2025-11-04 10:30:58 -08:00
Zoe Gagnon
e49d5582e0 Skip tests in the nix build (#222)
The nix build is currently failing on tests around new git-enabled features.
Since ssh and certs are not available in the nix sandbox, all such tests will fail.
Rather than set up a sandbox for those things, skip the tests, with the assumption that
they are already done elsewhere
2025-11-04 10:26:56 -08:00
Steve Yegge
47214ddfe2 bd sync: 2025-11-04 10:26:37 2025-11-04 10:26:37 -08:00
Steve Yegge
919da0da2c bd sync: 2025-11-04 10:25:11 2025-11-04 10:25:11 -08:00
Steve Yegge
38ff2b7aa9 Merge branch 'main' of github.com:steveyegge/beads 2025-11-04 10:24:19 -08:00
Steve Yegge
94e71642f9 fix: increase Windows filesystem delays in flaky tests
- TestDaemonAutoImportAfterGitPull: 200ms -> 500ms for filesystem timestamp precision
- TestSyncBranchPull_Success: 100ms -> 300ms for file I/O settling
- Also increase Linux delays slightly for more reliability
2025-11-04 10:20:12 -08:00
Steve Yegge
859fbd4976 fix: resolve CI test failures on Linux and Windows
- Fix TestMigrateCommand: Use correct sqlite3 driver name and file URI format
- Fix TestDaemonAutoImportAfterGitPull: Add Windows-specific delay for filesystem timestamp precision
- Fix TestSyncBranchPull_Success: Add Windows-specific delay for file I/O settling

Amp-Thread-ID: https://ampcode.com/threads/T-5abd1f2f-9607-4111-af9d-19df64362ac7
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 10:02:08 -08:00
Steve Yegge
ff914b2a2f bd sync: 2025-11-04 09:52:32 2025-11-04 09:52:32 -08:00
Steve Yegge
c472ca31d7 Resolved merge conflict in beads.jsonl (accepted theirs) 2025-11-04 09:51:06 -08:00
Steve Yegge
0cd5902ba5 bd sync: 2025-11-04 09:50:58 2025-11-04 09:50:58 -08:00
goreleaserbot
de1fb5ff85 Brew formula update for beads version v0.21.7 2025-11-04 01:12:37 -08:00
Steve Yegge
96f0931389 docs: Add 0.21.7 release notes to CHANGELOG 2025-11-04 01:11:47 -08:00
Steve Yegge
edac1feaa7 chore: Bump version to 0.21.7
Updated all component versions:
- bd CLI: 0.21.6 → 0.21.7
- Plugin: 0.21.6 → 0.21.7
- MCP server: 0.21.6 → 0.21.7
- Documentation: 0.21.6 → 0.21.7

Generated by scripts/bump-version.sh
2025-11-04 01:11:06 -08:00
Steve Yegge
85e1cc13de test: add waitFor helper for event-driven testing
- Add test_wait_helper.go with waitFor() function for polling-based test assertions
- Used by daemon watcher platform tests for non-blocking event verification
- Sync beads.jsonl

Amp-Thread-ID: https://ampcode.com/threads/T-80e427aa-40e0-48a6-82e0-e29a93edd444
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 01:10:18 -08:00