refactor(strategy): sweep push-bootstrap marker on disable, not via entire clean · Entire
refactor(strategy): sweep push-bootstrap marker on disable, not via entire clean
b27efd1→main·
karthik-rameshkumar·3d ago·4 files·+23 added/-61 removed
Follow-up to the review fix: the earlier commit enrolled the empty-remote
bootstrap marker in entire clean's typed cleanup machinery, but that command
is scoped to session data (session states, shadow branches, temp files), and
the marker is a per-remote performance cache — not session data.
The sibling entire-session-locks directory (also a non-session-data cache)
establishes the right pattern: it is swept by entire disable's pristine
teardown via a best-effort os.RemoveAll, and is not an entire clean item.
Mirror that: drop the CleanupTypePushBootstrap enum, result fields, discovery,
deletion, and clean-command display plumbing, and instead RemoveAll the marker
dir in removeAllSessionStates alongside entire-session-locks. This fixes the
real gap — the marker previously survived entire disable as leaked state —
while removing the exhaustive-switch maintenance surface. The marker still
self-heals via its TTL + fingerprint, so entire clean has no reason to touch it.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
01KXG26CGYEFX9015W2KTZ29FKView transcript
Changes
4
cmd/entire/cli
Mclean.go+3/-8
Msetup.go+3
strategy
Mcleanup.go+11/-50
Mmanual_commit_push.go+6/-3
316 unmodified lines
// Group items by type for display var branches, states, checkpoints, pushBootstrap []strategy.CleanupItem var branches, states, checkpoints []strategy.CleanupItem for _, item := range items { switch item.Type { case strategy.CleanupTypeShadowBranch: states = append(states, item) case strategy.CleanupTypeCheckpoint: checkpoints = append(checkpoints, item) case strategy.CleanupTypePushBootstrap: pushBootstrap = append(pushBootstrap, item) } }
// Report results totalDeleted := len(result.ShadowBranches) + len(result.SessionStates) + len(result.Checkpoints) + len(result.PushBootstrap) + len(deletedTempFiles) totalFailed := len(result.FailedBranches) + len(result.FailedStates) + len(result.FailedCheckpoints) + len(result.FailedPushBootstrap) + len(failedTempFiles) if totalDeleted > 0 { fmt.Fprintf(w, "✓ Deleted %d %s:\n", totalDeleted, itemWord(totalDeleted)) printResultSection(w, "Shadow branches", result.ShadowBranches) printResultSection(w, "Session states", result.SessionStates) printResultSection(w, "Checkpoints", result.Checkpoints) printResultSection(w, "Push-bootstrap marker", result.PushBootstrap) printResultSection(w, "Temp files", deletedTempFiles) }
// Delete the push-bootstrap marker directory. if pushBootstrap { if dir, err := pushBootstrapDir(ctx); err == nil { if rmErr := os.RemoveAll(dir); rmErr != nil { result.FailedPushBootstrap = append(result.FailedPushBootstrap, pushBootstrapDirName) } } }
// Log summary totalDeleted := len(result.ShadowBranches) + len(result.SessionStates) + len(result.Checkpoints) + len(result.PushBootstrap) + len(deletedTempFiles) totalFailed := len(result.FailedBranches) + len(result.FailedStates) + len(result.FailedCheckpoints) + len(result.FailedPushBootstrap) if totalDeleted > 0 || totalFailed > 0 { logging.Info(logCtx, "cleanup completed", slog.Int("deleted_branches", len(result.ShadowBranches)), ) }