Fix auto-import git history backfill bug (bd-4pv)

Auto-import was allowing git history backfill to run, which could
incorrectly purge issues. The fix adds NoGitHistory=true to all
auto-import code paths:
- autoimport.go (importFromGit)
- autoflush.go (autoImportIfNewer)
- daemon_sync.go (importToJSONLWithStore)

Git history backfill is designed to detect deletions that happened
after a local DB was created. During auto-import, there is no local
work to protect - we are importing from the authoritative JSONL source.

Also adds comprehensive tests for NoGitHistory behavior.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-27 22:51:39 -08:00
parent d50861f188
commit 774a57684c
5 changed files with 611 additions and 66 deletions

View File

@@ -168,11 +168,11 @@ func autoImportIfNewer() {
// Use shared import logic (bd-157)
opts := ImportOptions{
DryRun: false,
SkipUpdate: false,
Strict: false,
SkipPrefixValidation: true, // Auto-import is lenient about prefixes
NoGitHistory: true, // Skip git history backfill during auto-import (bd-4pv)
}
result, err := importIssuesCore(ctx, dbPath, store, allIssues, opts)

View File

@@ -207,10 +207,10 @@ func importFromGit(ctx context.Context, dbFilePath string, store storage.Storage
// Note: SkipPrefixValidation allows mixed prefixes during auto-import
// (but now we set the prefix first, so CreateIssue won't use filename fallback)
opts := ImportOptions{
DryRun: false,
SkipUpdate: false,
SkipPrefixValidation: true, // Auto-import is lenient about prefixes
DryRun: false,
SkipUpdate: false,
SkipPrefixValidation: true, // Auto-import is lenient about prefixes
NoGitHistory: true, // Skip git history backfill during auto-import (bd-4pv)
}
_, err = importIssuesCore(ctx, dbFilePath, store, issues, opts)

View File

@@ -195,6 +195,7 @@ func importToJSONLWithStore(ctx context.Context, store storage.Storage, jsonlPat
SkipUpdate: false,
Strict: false,
SkipPrefixValidation: true, // Skip prefix validation for auto-import
NoGitHistory: true, // Skip git history backfill during auto-import (bd-4pv)
}
_, err = importIssuesCore(ctx, "", store, issues, opts)