Repository navigation
Expose and test what Reset and Delete offer for a profile's archives - #201
Merged
Merged
Conversation
Moves the archive selection out of the editor controller's instance methods into nonisolated statics, with no change in behavior: - resetArchiveCandidates: the hash gate plus the located archives - deleteArchiveOffer: the located archives, the ownership verdict and whether removal is offered - locateArchives and profileRoots take the Unison directory and local hostname instead of reading the controller's state Adds ArchiveOfferSelectionTests over real archive files in a temporary directory: a local pair and a profile with an ssh root (selected files, hashes and header roots), the three Reset gates, archives under a former hostname, and Delete's withheld offer when another profile shares the roots, for both root kinds. This is the baseline for dropping the unused hash parameter from locateArchives and reading the profile once. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bcourbage
added a commit
that referenced
this pull request
Nov 8, 2026
locateArchives never read the computed hash result; it finds a profile's archives by matching the roots recorded in each archive header. The hash computation remains the gate that decides whether a profile can be reset or whether Delete offers archive removal, so callers still run it and branch on its failure. Only the unused value stops being passed along. Also corrects the Reset action's doc comment, which said the hash identifies the profile's files. The ArchiveOfferSelectionTests from #201 are unchanged. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
bcourbage
added a commit
that referenced
this pull request
Nov 8, 2026
Selecting archives parsed the profile text twice and computed MD5 digests that both actions discarded. Add ArchiveHash.eligibilityFailure, the no-roots and no-local-root gate on a parsed root list, and use it from computeAllFromProfileText as well so there is one definition of the gate. The editor now parses the roots once, applies the gate, and hands the same roots to the header matcher. Hash computation stays for the callers that use the digests (abandoned-staging recovery). The ArchiveOfferSelectionTests from #201 are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bcourbage
added a commit
that referenced
this pull request
Nov 8, 2026
) * Read the profile once when selecting archives for Reset and Delete The selection read the .prf twice: ArchiveHash.computeAll read it for the gate, and locateArchives read it again for the roots it matches archive headers against. The two reads could see different files if the profile changed between them. Read the text once and feed both the gate and the root list from it. Delete's selection now calls resetArchiveCandidates instead of repeating the gate and locate steps, and the separate root-reading helper goes away. locateArchives takes the roots directly. The ArchiveOfferSelectionTests from #201 are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Gate Reset and Delete on the roots without computing archive hashes Selecting archives parsed the profile text twice and computed MD5 digests that both actions discarded. Add ArchiveHash.eligibilityFailure, the no-roots and no-local-root gate on a parsed root list, and use it from computeAllFromProfileText as well so there is one definition of the gate. The editor now parses the roots once, applies the gate, and hands the same roots to the header matcher. Hash computation stays for the callers that use the digests (abandoned-staging recovery). The ArchiveOfferSelectionTests from #201 are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Describe Reset's root validation and header matching in its comments The doc comment and an inline comment still presented the archive hash as the eligibility gate. Reset validates the profile's roots and matches them against archive headers; no hash is computed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Reflow the Reset action's doc comment Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Moves the archive selection out of
ProfileEditorWindowController's instance methods intononisolatedstatics, with no behavior change, and addsArchiveOfferSelectionTestsover real archive files in a temporary Unison directory.resetArchiveCandidates: the hash gate plus the located archives (the three Reset failure cases come back asArchiveHash.Failure).deleteArchiveOffer: the located files and hashes, the ownership verdict, andremovalOffered(files present and no other owner).locateArchivesandprofileRootstake the Unison directory and local hostname instead of reading controller state.ArchiveLocationis no longer private.resetArchivesAction,confirmAndResetArchivesanddeleteActionnow call these. The alert text, buttons and the mutation path are untouched.Tests cover a local pair and a profile with an ssh root (selected files, hashes, header roots), the three Reset gates, archives under a former hostname (not live), and Delete's withheld offer when another profile shares the roots, for both root kinds.
Why
Step 2 of the cleanup plan.
locateArchivesnever reads itscomputedparameter. Dropping it and reading the profile once is the next PR, and these tests are its baseline: they must pass unchanged. They also pin that the hash call still works as a gate.Size
Production: +72 / -30 in one file (the statics and two small types add lines now; the next PR removes the unused parameter). Tests: one new file, 10 tests.
One ordering difference: Reset now locates archives before
refreshTableFirstResponder()instead of after. That call only nudges focus and does not touch archive state.Verified
make teston Heracles: 1546 tests, 0 failures.🤖 Generated with Claude Code