fix: sort resource collections in YAML and register fetch command - #291
Merged
Conversation
Sort conditions alphabetically by name when serializing a default step so pulls produce stable YAML instead of ordering that follows whatever the platform returns. Also register FetchCommand in the CLI command list — it was implemented but never wired up, so `poly fetch` was unavailable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Sort API integration operations, test case function call assertions and their arguments, and the integration/operation keys of test case API mocks when serializing. All of these are built from platform projection maps, so pulls previously produced whatever order the map iteration gave and unrelated pulls reordered blocks in the YAML. The rules within a mocked operation are left alone — they are a sequence and `repeat` depends on their order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Coverage Report
Changed file coverage
|
oeisenberg
approved these changes
Aug 28, 2026
oeisenberg
left a comment
Contributor
There was a problem hiding this comment.
See it, say it, sorted
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
Sorts collections alphabetically during YAML serialization so pulls produce stable, diff-friendly output. Also registers
FetchCommandin the CLI command list — it was implemented but never wired up, sopoly fetchwas unavailable.Motivation
Several collections are built by iterating a map in the platform projection — flow step conditions, API integration operations, test case function call assertions and their arguments, and the integration/operation keys of test case API mocks. Their serialized order followed whatever the map iteration gave, so unrelated pulls could reorder blocks in a resource's YAML and create noisy diffs.
Separately, the
fetchcommand existed incli_commands/sync.pybut was missing fromCOMMANDS, so it never appeared in the CLI.Changes
FlowStep.to_yaml_dictsorts conditions byname(matches the existingsorted(self.extracted_entities)behaviour)ApiIntegration.to_yaml_dictsorts operations bynameFunctionCallAssertion.to_yaml_dictsorts arguments byparameter_name, andTestCaseAssertion.to_yaml_dictsorts function call assertions bynameTestCaseApiMocks.to_yaml_dictsorts integration and operation names; the rules within an operation keep their order, since they are a sequence andrepeatdepends on itFetchCommandto theCOMMANDSlist incli.pysopoly fetchis registereduv.lockversion bump picked up from the 0.44.4 releaseTest strategy
poly --helpnow listsfetch)Checklist
ruff check .andruff format --check .passpytestpasses (1356 passed)polyCLI interface (or migration path documented)Screenshots / Logs