Apply recipe patches in deterministic order - #53
Open
val-ms wants to merge 1 commit into
Open
Conversation
Recipe patch directories were consumed using os.listdir(), whose ordering is filesystem-dependent. Sequential patch sets could therefore work on one platform and fail on another when a dependent patch was returned first. Sort patch directory entries by filename before applying patches or copying auxiliary files. Add regression coverage that presents patches in reverse filesystem order and verifies they are still applied by filename.
val-ms
marked this pull request as ready for review
August 13, 2026 19:00
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.
Summary
.patch,.diff, and auxiliary filesRoot cause
Mussels consumed patch directories directly through
os.listdir(). The APIdoes not guarantee an ordering, so sequential patch sets could be applied in a
different order on different filesystems. This was observed when a dependent
json-c patch series applied numerically on Linux and Windows but started with
the final patch on macOS.
Fix
Sort patch-directory entries by filename before processing them. Existing
numeric patch naming conventions now reliably determine application order on
every platform. Non-patch files copied from the same directory are also
processed deterministically.
The regression test forces
os.listdir()to return0002before0001and verifies that Mussels still applies
0001first.Validation
pytest -q: 36 passed