Commit Graph

2595 Commits

Author SHA1 Message Date
Steve Yegge
cdc156428c fix(staleness): use RFC3339Nano precision for last_import_time (#399)
The staleness check compares last_import_time against JSONL file mtime.
File mtime has nanosecond precision, but last_import_time was stored with
only second precision (RFC3339). This caused a race condition where the
stored time could be slightly earlier than the file mtime, triggering
false "Database out of sync" errors - particularly in git worktrees.

Changed all 6 locations that set last_import_time to use RFC3339Nano.
The CheckStaleness parser already handles both formats, so this is
backward compatible.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:11:01 -08:00
Steve Yegge
e8ffac63ba bd sync: 2025-11-26 23:59:43 2025-11-26 23:59:43 -08:00
Steve Yegge
d51ddb0b03 fix(beads): also fix FindJSONLPath to skip deletions.jsonl (bd-tqo)
Code review follow-up:
- Fix misleading docstring in FindJSONLInDir (does not return empty)
- Fix same bug in beads.FindJSONLPath (also fell back to matches[0])
- Add comprehensive tests for FindJSONLPath skipping deletions

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:44:04 -08:00
Steve Yegge
887c958567 fix(autoimport): prevent export to wrong JSONL file (bd-tqo)
Add FindJSONLInDir helper that correctly prefers issues.jsonl over other
.jsonl files. Previously, glob patterns could return deletions.jsonl or
merge artifacts (beads.base.jsonl, etc.) first alphabetically, causing
issue data to be written to the wrong file.

This fixes the root cause of deletions.jsonl corruption where full issue
objects were written instead of deletion records, leading to all issues
being purged during sync.

Changes:
- Add FindJSONLInDir() in internal/autoimport with proper file selection
- Update AutoImportIfNewer() to use FindJSONLInDir
- Update CheckStaleness() to use FindJSONLInDir
- Update triggerExport() in RPC server to use FindJSONLInDir
- Add comprehensive tests for FindJSONLInDir

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:25:32 -08:00
Steve Yegge
1b0e8cd1fb bd sync: 2025-11-26 23:25:20 2025-11-26 23:25:20 -08:00
Steve Yegge
30aa8e3c2a bd sync: 2025-11-26 23:17:21 2025-11-26 23:17:21 -08:00
Steve Yegge
224715d1d5 bd sync: 2025-11-26 23:14:29 2025-11-26 23:14:29 -08:00
Steve Yegge
1322e7e80a chore: remove corrupted deletions.jsonl (contained issue data instead of deletion records) 2025-11-26 23:14:10 -08:00
Steve Yegge
5506486dc5 feat(import,sync): add --no-git-history flag to prevent spurious deletions
Fixes bd-0b2: The git history backfill mechanism was causing data loss
during JSONL filename migrations (beads.jsonl → issues.jsonl). When issues
existed in the old filename's git history, the backfill incorrectly treated
them as "deleted" and purged them from the database.

Changes:
- Add NoGitHistory field to importer.Options and ImportOptions structs
- Modify purgeDeletedIssues() to skip git history check when flag is set
- Add --no-git-history flag to bd import command
- Add --no-git-history flag to bd sync command
- Update purge_test.go to pass Options argument

Usage:
  bd import -i .beads/issues.jsonl --no-git-history
  bd sync --no-git-history

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:10:43 -08:00
Steve Yegge
6294ef0cc6 fix(init,import): preserve metadata.json and improve prefix detection
- bd init now preserves existing metadata.json settings instead of
  overwriting with defaults (bd-zai)
- bd init detects existing JSONL filename (beads.jsonl vs issues.jsonl)
  when creating new metadata.json
- bd import now correctly reports prefix source ("issues" vs "directory")
- bd import avoids using ".beads" as prefix when run from inside .beads/

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:57:17 -08:00
Steve Yegge
dfc68ed8f6 bd sync: 2025-11-26 22:46:36 2025-11-26 22:46:36 -08:00
Steve Yegge
b5e58b0814 chore: file bugs discovered during issues.jsonl migration
New bugs filed:
- bd-zai: bd init resets metadata.json jsonl_export
- bd-8an: bd import auto-detects wrong prefix
- bd-0b2: Need --no-git-history flag
- bd-4pv: bd export only outputs 1 issue after corruption
- bd-4t7: Auto-import runs despite --no-auto-import flag
2025-11-26 22:30:33 -08:00
Steve Yegge
503c9a966e chore: file bugs discovered during issues.jsonl migration 2025-11-26 22:29:15 -08:00
Steve Yegge
83672a792b chore: close resolved beads, update issues.jsonl 2025-11-26 22:26:22 -08:00
Steve Yegge
985bd9be20 fix: standardize on issues.jsonl, clear corrupted deletions manifest 2025-11-26 22:23:14 -08:00
Steve Yegge
016db76325 bd sync: 2025-11-26 22:17:11 2025-11-26 22:17:11 -08:00
Steve Yegge
3704ef4329 bd sync: 2025-11-26 22:11:38 2025-11-26 22:11:38 -08:00
Steve Yegge
5a25bdb221 chore: update metadata.json to use issues.jsonl as canonical export 2025-11-26 22:11:33 -08:00
Steve Yegge
03b9cf03c0 chore: remove legacy beads.jsonl, standardize on issues.jsonl 2025-11-26 22:10:44 -08:00
Steve Yegge
9a8472f78b bd sync: 2025-11-26 22:09:13 2025-11-26 22:09:13 -08:00
Steve Yegge
482b8c5b4b bd sync: flush pending changes 2025-11-26 22:05:25 -08:00
Steve Yegge
7c19af8940 bd sync: migrate to issues.jsonl 2025-11-26 22:04:45 -08:00
Steve Yegge
ff3352ab23 bd-6xd: Standardize on issues.jsonl as canonical filename
- Change default JSONL filename from beads.jsonl to issues.jsonl
- Add bd doctor check and fix to auto-migrate legacy beads.jsonl configs
- Update FindJSONLPath to prefer issues.jsonl over beads.jsonl
- Add CheckLegacyJSONLConfig and CheckLegacyJSONLFilename checks
- Add LegacyJSONLConfig fix to rename files and update config
- Update .gitattributes to reference issues.jsonl
- Fix tests to expect new canonical filename
- Add bd-6xd to v0.25.1 release notes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:02:59 -08:00
Steve Yegge
753333149e bd sync: 2025-11-26 19:54:48 2025-11-26 22:02:48 -08:00
Steve Yegge
913f82181a bd sync: 2025-11-26 19:05:03 2025-11-26 22:02:48 -08:00
Steve Yegge
c9914a57ee fix: staleness check fails after write in git worktrees (#399)
After write operations in git worktrees, subsequent reads failed with
"Database out of sync with JSONL" even though the hash check passed.

Root cause: flushToJSONLWithState() updated last_import_hash but not
last_import_time after export. CheckStaleness() compares last_import_time
against JSONL mtime, so after export the JSONL appeared "newer" than the
last import.

Additional issue: RFC3339 only has second precision but file mtimes have
nanosecond precision, causing false positives when times were within the
same second.

Fix:
- Update last_import_time after export in flushToJSONLWithState()
- Use RFC3339Nano format for nanosecond precision
- Update CheckStaleness() to parse both formats for backward compatibility

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:02:48 -08:00
Steve Yegge
38ba8f8cf5 bd sync: 2025-11-26 18:07:01 2025-11-26 22:02:48 -08:00
Matt Wilkie
8bde895fcc update bd JSONL 2025-11-26 22:02:48 -08:00
Matt Wilkie
88bff25796 update bd JSONL 2025-11-26 22:02:43 -08:00
matt wilkie
827e67fe12 bd sync: 2025-11-26 06:33:11 2025-11-26 22:02:43 -08:00
matt wilkie
69d442be3a WIP: changes before push 2025-11-26 22:02:29 -08:00
Steve Yegge
9d77b916a6 bd sync: 2025-11-26 17:45:41 2025-11-26 22:01:58 -08:00
Matt Wilkie
a7b6f9ee58 bd sync: 2025-11-26 09:12:04 2025-11-26 22:01:58 -08:00
Steve Yegge
e25d86f79a bd sync: 2025-11-26 21:54:33 2025-11-26 21:54:33 -08:00
Steve Yegge
49d5bda3bd chore(beads-mcp): update lock file for version 0.25.1
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 21:54:23 -08:00
Steve Yegge
ed4630092e fix(beads-mcp): resolve all mypy type checking errors
- Add mypy override in pyproject.toml to relax strict typing for test files
- Update test fixtures to use _connection_pool instead of deprecated _client
- Fix datetime type mismatches in test fixtures (use datetime objects, not strings)
- Add type annotations to inner functions in test_multi_project_switching.py
- Fix union type handling in test assertions with isinstance checks

Reduces mypy errors from 216 to 0. All 168 tests still pass.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 21:54:23 -08:00
Steve Yegge
30ea542131 bd sync: 2025-11-26 21:05:31 2025-11-26 21:05:31 -08:00
Steve Yegge
a4a5b8a2a6 bd sync: 2025-11-26 21:02:17 2025-11-26 21:02:17 -08:00
Steve Yegge
fe6de0a73f fix: CI test failures on Windows
- TestVersionChangesCoverage: Add missing 3rd changelog entry for v0.25.1
- TestDefaultPath: Use filepath.Join for cross-platform path handling
- TestDebouncer_CancelWithNoPendingAction: Increase sleep from 60ms to 100ms
  to account for Windows timer imprecision

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:59:07 -08:00
Steve Yegge
ab330ea39d fix: bd sync now only commits .beads/ files, not other staged files (bd-red)
Previously, bd sync would commit ALL staged files when committing beads
changes. This could lead to unintended commits of work-in-progress code
that users had staged but weren't ready to commit.

Changed gitCommitBeadsDir to use pathspec (-- .beads/) to explicitly
limit the commit to only .beads/ files.

Also added in previous commit (bd-pbj):
- New Untracked Files check in bd doctor for untracked .beads/*.jsonl
- bd doctor --fix can now stage and commit untracked JSONL files

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:46:47 -08:00
Steve Yegge
3a343ead8d bd sync: 2025-11-26 20:45:48 2025-11-26 20:45:48 -08:00
Steve Yegge
8ad0144142 bd sync: 2025-11-26 20:33:12 2025-11-26 20:33:12 -08:00
Steve Yegge
6a024fb4d9 fix: git hooks now stage deletions.jsonl for cross-clone propagation
The pre-commit and pre-push hooks were only staging beads.jsonl and
issues.jsonl, but not deletions.jsonl. This caused deletions.jsonl
to remain untracked after bd cleanup or bd delete operations.

Updated all hook locations:
- cmd/bd/templates/hooks/pre-commit
- cmd/bd/templates/hooks/pre-push
- examples/git-hooks/pre-commit
- examples/git-hooks/pre-push
- .beads-hooks/pre-commit
- .beads-hooks/pre-push

Users with existing hooks should run: bd hooks install

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:29:47 -08:00
Steve Yegge
5f5b559433 bd sync: 2025-11-26 20:17:16 2025-11-26 20:17:16 -08:00
Steve Yegge
c76607ddd8 bd sync: 2025-11-26 19:54:48 2025-11-26 19:54:48 -08:00
Steve Yegge
340b3507b9 fix: expand tilde in global gitignore path from git config
git config --global core.excludesfile may return paths like ~/...
which Go does not expand. This caused setupGlobalGitIgnore to fail
when users had configured their gitignore with a tilde path.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 19:06:50 -08:00
Steve Yegge
9b51a090ca bd sync: 2025-11-26 19:05:03 2025-11-26 19:05:03 -08:00
Steve Yegge
d0bb0ad7d4 fix: staleness check fails after write in git worktrees (#399)
After write operations in git worktrees, subsequent reads failed with
"Database out of sync with JSONL" even though the hash check passed.

Root cause: flushToJSONLWithState() updated last_import_hash but not
last_import_time after export. CheckStaleness() compares last_import_time
against JSONL mtime, so after export the JSONL appeared "newer" than the
last import.

Additional issue: RFC3339 only has second precision but file mtimes have
nanosecond precision, causing false positives when times were within the
same second.

Fix:
- Update last_import_time after export in flushToJSONLWithState()
- Use RFC3339Nano format for nanosecond precision
- Update CheckStaleness() to parse both formats for backward compatibility

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 19:04:57 -08:00
Steve Yegge
eeda2053b8 bd sync: 2025-11-26 18:07:01 2025-11-26 18:07:01 -08:00
Matt Wilkie
daa94e5b31 update bd JSONL 2025-11-26 17:52:36 -08:00