Skip to content

Dedupe planner: a skipped group's members stay (INV-32) - #306

Merged
Nishith merged 1 commit into
mainfrom
fix/dedupe-planner-rail-protects-fanout
Nov 29, 2026
Merged

Nishith merged 1 commit into
mainfrom
fix/dedupe-planner-rail-protects-fanout

Conversation

@Nishith

@Nishith Nishith commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Fixes #300.

What

The dedupe planner skips a group whose members are all marked Delete, but its members could still be removed by another route:

  • Pair fan-out from another group (RAW+JPEG or Live Photo partners in two groups).
  • An overlapping group that lists the same files and has a kept member.

Members of a skipped group are now protected from direct deletes (step 4) and from fan-out (step 5). Three guard lines plus the set that feeds them; nothing else in the planner changes.

New invariant: INV-32 (proposal for the wording)

"A Deduplicate plan never empties a group…" added to AGENTS.md. Note that it is deliberately stronger than "never empties": a skipped group keeps every member, even one whose partner is deleted elsewhere. Over-keeping is the safe direction.

Tests

  • DeduplicationPlannerGroupRailTests: fixed regressions for both routes (tagged AGENTS-INVARIANT: 32), group order both ways, and a check that ordinary fan-out still works.
  • DeduplicationPlannerPropertyTests: new property test whose generator builds cross-group pairs and overlapping groups. Existing property tests use the unchanged generator path.
  • Red first: the fixed tests failed 6 assertions against the unmodified planner; the property test fails 44 times with the guard lines switched off.

Evidence (local, Swift newer than CI)

  • script/swift_meaningful_coverage.sh: exit 0, 2518 passed, 0 failed, 96.17% (DeduplicationPlanner.swift 98.8%)
  • 14 guards: exit 0. Xcode build: exit 0. git diff --check: exit 0.
  • Not verified in the running app.

🤖 Generated with Claude Code

The per-group rail skips a group whose members are all marked Delete, but
its members could still be removed by pair fan-out from another group or by
a second group that lists the same files. Members of a skipped group are now
protected from direct deletes and from fan-out.

Adds INV-32, fixed regressions for both routes, and a property test whose
generator builds cross-group pairs and overlapping groups.

Fixes #300

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T08:34:34.482462Z 2f8954f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Nishith
Nishith enabled auto-merge (squash) November 29, 2026 08:49
@Nishith
Nishith merged commit ace948b into main Nov 29, 2026
24 of 25 checks passed
@Nishith
Nishith deleted the fix/dedupe-planner-rail-protects-fanout branch November 29, 2026 14:47
Nishith added a commit that referenced this pull request Nov 29, 2026
main holds #306 and #307 as squash commits; this branch already contains
both, so conflicting hunks keep this branch's side.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Nishith added a commit that referenced this pull request Nov 29, 2026
main holds #306, #307 and #308 as squash commits; this branch already
contains all three, so conflicting hunks keep this branch's side.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

Dedupe planner can trash every file in an all-Delete group through pair fan-out

1 participant