Repository navigation
fix(organize): a file that fails the check after its move fails alone - #124
Merged
Merged
Conversation
After each move the batch checks that the file is at its destination and gone from its source. A file that failed the check was a critical error: the batch stopped and every confirmed move was rolled back. The file that failed never joins the completed moves, so the rollback did not bring it back; it only undid the rest. - A failed check is a per-file failure. The row is listed as not moved and the other files stay moved and undoable. - "Destination missing" now always carries MOVE_VERIFICATION_DESTINATION_FAILED (it carried the raw ENOENT) and its message ends with whether the file is still at its original location. A destination that cannot be read for another reason keeps the filesystem's code, so EIO still stops the batch. - Failed checks share the escalation rule that permission denials already had: three in a row with no verified move in between roll the batch back. One counter, one predicate, one threshold. - Strict mode still stops on the first failure. - The renderer maps both codes and shows the handler's message. Without an entry the destination code fell through to the generic save-failed copy.
The existing tests for a file that fails the check after its move run on a mocked filesystem. This one runs the real batch handler, the real move, the real check and the real rollback in a temp folder. The only stand-in is the other program: a real filesystem call made right after a file lands at its destination. - A file removed from its destination fails alone; the others stay moved. - A file put back at its source fails alone and is reported as still there. - A file present at both places fails alone and neither copy is touched. - A destination that keeps losing files is rolled back. With the handler from main the first three fail: the whole run is rolled back.
npm audit --omit=dev started failing on 2026-11-12: versions 2.0.0 to 2.1.5 carry two moderate advisories (GHSA-qv5m-9pm6-hqp3, GHSA-jpvv-r467-5p4w). It is a transitive dependency of @modelcontextprotocol/sdk. Only its lockfile entry and its row in the commercial-use inventory change. 2.1.6 (2026-11-02) is the first patched release; 2.1.8 was published hours before this commit and is left for a later update.
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.
Follow-up to #122 from the hands-on Mac report (item 2): a file that fails the check after its move is listed as not moved, and the rest of the run stays moved. Before, it undid the whole run.
What changes
The move check (
batchOrganizeHandler.js)MOVE_VERIFICATION_DESTINATION_FAILED(it carried the rawENOENT), and its message ends with where the file is: still at its original location, gone from there too, or not checkable.EIOstill stops the batch andEACCES/EPERMcount as permission failures.verification failedis no longer critical. On the move path only the move check produced it;checksum mismatchstays critical.Escalation
FAILURE_ESCALATION_THRESHOLD), renamed from the permission-only ones. This is a judgment call on top of "fail alone": a destination that keeps losing files is treated as a fault of the destination, not of each file.Renderer (
errorMapping.js)MOVE_VERIFICATION_DESTINATION_FAILEDfell through the_FAILEDsuffix rule to the generic save-failed copy.Also in this PR
test/batchOrganize.moveCheckFailsAlone.realfs.test.js: the same cases on the real filesystem (real handler, move, check and rollback in a temp folder). With the handler frommain, three of its four tests fail because the whole run is rolled back.@hono/node-server2.1.5 → 2.1.6 in the lockfile and the inventory.npm audit --omit=devstarted failing on 2026-11-12 (two moderate advisories, transitive through@modelcontextprotocol/sdk), which failsnpm run cion every branch.Not in this PR
Checks
Windows 11 x64, on this branch's tree:
npm run local:gate, every step: 957 test suites, 14143 tests passed, 11 skipped, coverage thresholds met, production build, native modules.A separate process deleting files from the destination while a 60-file batch runs (one-off runs, not in the repo):
win-unpackedbuilt from the first commit), organize called through its own preload bridgeNot checked: macOS (the new real-filesystem test runs there when
mainnext builds; pull requests run Ubuntu and Windows only), the installer, the Organize screen in the packaged app (the call went through the preload bridge, not the buttons), and a real sync client or antivirus product.