Skip to content

Migrate lfs-tidy onto the CleanPipeline seam#205

Merged
jakebromberg merged 2 commits into
mainfrom
migrate/clean-lfs
Jun 22, 2026
Merged

Migrate lfs-tidy onto the CleanPipeline seam#205
jakebromberg merged 2 commits into
mainfrom
migrate/clean-lfs

Conversation

@jakebromberg

Copy link
Copy Markdown
Owner

Step 3 of #118 (5 of 5). Moves git-lfs-tidy onto git_tidy_core::clean::run_clean while keeping its LfsCleanResult wrapper.

decide admits only orphaned objects when --prune is set; every other classification is counted skipped, matching the old match arms. act owns count/byte extraction, dry-run branching, the prune call, and the PrunedRepo record. Per-group health recommendations are the aggregate extra the pipeline doesn't model, so they stay tool-side: detected from the group's classifications and emitted after that group's prune lines, keeping output ordering exact.

Behavior-preserving: all existing tests (incl. recommendations assertions) pass unchanged. Local CI green.

Refs #118

Replace the hand-rolled clean loop in git-lfs-tidy with the shared `git_tidy_core::clean::run_clean` seam (issue #118 step 3). lfs groups items by repo, so we call the shared loop once per group over that group's items, accumulating each group's `CleanResult` into one aggregate `succeeded`/`failed`/`skipped`. A new `should_clean` predicate is the pure `decide` filter: it admits only orphaned objects when `--prune` is set, so every other classification (untracked, missing, healthy) is rejected and counted as a skip by the pipeline, exactly matching the old `skipped += 1; continue;`. The `act` closure owns everything lfs-specific — count/byte extraction, the dry-run-vs-real branch, the "would prune"/"pruned"/"error: could not prune" wording, the `git.lfs_prune` call, and the `PrunedRepo` success record (dry-run still returns `Outcome::Cleaned` with `dry_run: true`).

The per-group health recommendations are the one aggregate extra the pipeline doesn't model, so they stay tool-side around the per-group `run_clean` call. We detect `has_untracked`/`has_missing` directly from the group's item classifications and emit the recommendation lines after that group's `run_clean` call, pushing each into `recommendations`. Because each group is processed in full — prune lines first, then recommendation lines — before the next group, output ordering is preserved exactly. The `LfsCleanResult` wrapper (which derefs to `CleanResult<PrunedRepo>` and carries the `#[allow(dead_code)]` `recommendations`) is kept unchanged, so the public signature is stable and every existing unit and integration test passes without edits.

Refs #118
Doc-only follow-ups surfaced by review. Update the CleanPipeline-seam description in CLAUDE.md from "migrated so far: git-repo-tidy" to reflect that all seven tools now sit on the shared run_clean seam, noting the shared should_clean_landed filter for branch/worktree, the per-group call pattern for grouped tools (with stash's descending pre-sort), and lfs-tidy's tool-side recommendations. Drop the stale "candidate to drop once lfs moves onto the shared CleanPipeline" line from LfsCleanResult.recommendations, since lfs is now on the seam, and describe how the field is computed tool-side instead.

Refs #118
@jakebromberg jakebromberg merged commit ce536fa into main Jun 22, 2026
3 checks passed
@jakebromberg jakebromberg deleted the migrate/clean-lfs branch June 22, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant