Fix bd-l0r: Skip export after ZFC import to preserve JSONL source of truth
## Problem When bd sync detected stale DB (>50% divergence), it would import JSONL to fix the DB, but then immediately export the DB back to JSONL. This caused the stale DB to overwrite the JSONL after a git pull, undoing cleanup work. Example scenario: 1. Clone has 688 stale issues in DB (628 closed) 2. git pull brings JSONL with 62 issues (cleanup applied) 3. bd sync detects 1009.7% divergence and imports JSONL (DB → 62 issues) ✓ 4. bd sync exports DB to JSONL (JSONL still 62 issues) ✓ 5. But this marks JSONL as "changed" and commits/pushes it ✗ ## Solution After ZFC (JSONL First Consistency) import, set skipExport flag to prevent the export step. JSONL is the source of truth after import - DB should sync to match, not export back. ## Changes - cmd/bd/sync.go: Add skipExport flag, set it after ZFC import - cmd/bd/sync.go: Wrap export logic in `if !skipExport` block - CHANGELOG.md: Update ZFC entry with accurate description - cmd/bd/sync_test.go: Add TestZFCSkipsExportAfterImport Fixes #bd-l0r 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -83,10 +83,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Now always uses content hash for reliable comparison
|
||||
- Prevents bd sync from overwriting pulled JSONL and resurrecting deleted issues
|
||||
|
||||
- **ZFC (JSONL First Consistency)**: Enforce source of truth semantics (bd-l0r, 1ba068f, 2e4171a, 949ab42)
|
||||
- bd sync now unconditionally imports JSONL first (source of truth)
|
||||
- Simpler JSONL → DB → JSONL flow ensures consistency
|
||||
- Prevents exporting when DB has significantly more issues than JSONL
|
||||
- **ZFC (JSONL First Consistency)**: Fix stale DB overwriting JSONL on sync (bd-l0r, 1ba068f, 2e4171a, 949ab42)
|
||||
- bd sync now detects stale DB (>50% divergence from JSONL) and imports first
|
||||
- After ZFC import, skips export to prevent overwriting JSONL source of truth
|
||||
- Fixes bug where DB with 688 issues would overwrite JSONL with 62 issues after pull
|
||||
- JSONL is source of truth after git pull - DB syncs to match, not vice versa
|
||||
- Preserves local uncommitted changes while catching stale DB scenarios
|
||||
|
||||
- **Merge Conflict Semantics**: Improved resolution policies (bd-pq5k, d4f9a05)
|
||||
|
||||
Reference in New Issue
Block a user