Fix: Add auto-flush to renumber, rename-prefix, and compact commands
These commands modify issues in bulk but weren't triggering auto-export to JSONL. This caused database and JSONL to get out of sync. Added markDirtyAndScheduleFlush() calls to: - bd renumber (after renumbering completes) - bd rename-prefix (after prefix rename completes) - bd compact (after single/batch compaction) - bd delete (already had it) Fixes the issue where massive cleanups weren't exported to JSONL. Amp-Thread-ID: https://ampcode.com/threads/T-a43dc9fa-e9bc-43c7-9055-33acc08bc642 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -183,6 +183,9 @@ func runCompactSingle(ctx context.Context, compactor *compact.Compactor, store *
|
||||
originalSize, compactedSize, savingBytes,
|
||||
float64(savingBytes)/float64(originalSize)*100)
|
||||
fmt.Printf(" Time: %v\n", elapsed)
|
||||
|
||||
// Schedule auto-flush to export changes
|
||||
markDirtyAndScheduleFlush()
|
||||
}
|
||||
|
||||
func runCompactAll(ctx context.Context, compactor *compact.Compactor, store *sqlite.SQLiteStorage) {
|
||||
@@ -304,6 +307,11 @@ func runCompactAll(ctx context.Context, compactor *compact.Compactor, store *sql
|
||||
if totalOriginal > 0 {
|
||||
fmt.Printf(" Saved: %d bytes (%.1f%%)\n", totalSaved, float64(totalSaved)/float64(totalOriginal)*100)
|
||||
}
|
||||
|
||||
// Schedule auto-flush to export changes
|
||||
if successCount > 0 {
|
||||
markDirtyAndScheduleFlush()
|
||||
}
|
||||
}
|
||||
|
||||
func runCompactStats(ctx context.Context, store *sqlite.SQLiteStorage) {
|
||||
|
||||
@@ -96,6 +96,9 @@ Example:
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Schedule auto-flush to export changes
|
||||
markDirtyAndScheduleFlush()
|
||||
|
||||
fmt.Printf("%s Successfully renamed prefix from %s to %s\n", green("✓"), cyan(oldPrefix), cyan(newPrefix))
|
||||
|
||||
if jsonOutput {
|
||||
|
||||
@@ -127,6 +127,9 @@ Risks:
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Schedule auto-flush to export changes
|
||||
markDirtyAndScheduleFlush()
|
||||
|
||||
fmt.Printf("%s Successfully renumbered %d issues\n", green("✓"), len(issues))
|
||||
|
||||
// Count actual changes
|
||||
|
||||
Reference in New Issue
Block a user