Repository navigation
Refuse an output folder that cannot be listed, and test two publication guards - #521
Merged
Merged
Conversation
Review notes on #501. output_identity digested what Path.rglob lists, and rglob skips a directory the process cannot list, so the check that an output did not change during publication missed edits under it. It now walks with os.walk and raises that directory's error, which becomes the usual "cannot inspect" refusal. The list it digests is otherwise the same, in the same order. New tests/test_managed_output.py covers that refusal and two guards no test reached: stage_output removes a stage whose write, fsync or chmod fails (and leaves a registered stage to its owner), and rollback keeps a published tree that changed after its last check instead of deleting it.
Deicyde
marked this pull request as ready for review
October 31, 2026 04:53
Contributor
Author
|
Review at c54367e: merge. Nothing blocks merge, and there are no notes.
Checks
Posted by Claude Code (session jackmccarthy-eb). |
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-ups to #501 from jackmccarthy-da's review notes there: one fail-open check closed, and tests for two guards nothing exercised.
Change
output_identityrefuses a folder it cannot list. It digested the names and bytes thatsorted(path.rglob("*"))lists, andrglobsilently skips a directory the process cannot list.replace_outputscompares that digest before and after it moves the old output aside, so an edit under such a directory went unseen and was published over. A new_tree(path)walks withos.walk(onerror=...)and raises the listing error, which the existingexcept OSErrorturns into the usual "cannot inspect"SkeletonError. On any tree it can list,_treereturns the same paths in the same order assorted(path.rglob("*")), so digests do not change; it does not follow symlinked directories, and the loop still refuses a symlink when it reaches one. The docstring, which described the skip, now says it is refused.tests/test_managed_output.py, for guards the publishing commands' tests do not reach:test_output_identity_refuses_a_directory_it_cannot_list(POSIX, not as root): a subfolder with mode 0 is refused.test_stage_output_removes_a_stage_it_cannot_finish, for a failed write (a lone surrogate the UTF-8 encoder rejects),fsyncandchmod: the stage is gone and the old file is untouched.test_stage_output_leaves_a_registered_stage_to_its_owner: withstages, the failed stage stays listed for the caller to remove.test_rollback_preserves_output_that_changed_after_its_last_check: a second install fails, and another writer adds a file to the published tree after rollback checked it and before it moved the tree aside. The tree is kept under its.autoform-rollback-name with that file, and the error says so.Verification
checkpasses on the changed files._treeandsorted(rglob("*"))give the same 11 paths for a tree with dot files, nested folders, a non-ASCII name and symlinks to a folder and a file.tests/test_skeleton.py175 passed, 33 skipped (real Lean);tests/test_library_generate.py89 passed, 13 skipped;tests/test_review_bundle.py63 passed.stage_output's cleanup removed, the three stage tests fail; with the quarantine identity check removed, the rollback test fails.Overlap
_managed_output.pyand merges with this branch without conflict.output_identity's file reads andstage_output's writes, and already conflicts with main inskeleton.pybecause Give the managed-output helpers their own module #501 moved those helpers. This PR changes the loop header and docstring ofoutput_identityand adds no conflict of its own with Stream large skeleton packets and reports, and name each skeleton phase on stderr #516 today; once Stream large skeleton packets and reports, and name each skeleton phase on stderr #516 moves its edits into_managed_output.py, whichever lands second redoes thefor child in ...line.