fix: Deterministic sort list in output to avoid random order - #527
Conversation
|
I don't know if this is a fix or a feat. |
|
Any chance that this could get a review? |
…ce it was used everywhere else
58bb275 to
9770607
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #527 +/- ##
==========================================
+ Coverage 82.27% 82.32% +0.05%
==========================================
Files 17 17
Lines 1760 1765 +5
==========================================
+ Hits 1448 1453 +5
Misses 236 236
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
HeavyWombat
left a comment
There was a problem hiding this comment.
Tak! I am sorry that it took so long to look into this. There are maybe two things I would like to tweak, but I need to play around with it locally first before making up my mind. So I will use your work here as the basis for that. Again, thank you very much for making me aware of the issue.
|
@HeavyWombat no worries, thank you so much for taking the time to look at this! And thank you for making such a great tool. When you have tweaked the change to your liking, I also see immense value of implementing this thing: #531 |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [homeport/dyff](https://github.com/homeport/dyff) | patch | `v1.10.2` → `v1.10.3` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>homeport/dyff (homeport/dyff)</summary> ### [`v1.10.3`](https://github.com/homeport/dyff/releases/tag/v1.10.3): dyff release v1.10.3 [Compare Source](homeport/dyff@v1.10.2...v1.10.3) #### What's Changed - build(deps): bump actions/checkout from 4 to 5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​522](homeport/dyff#522) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.23.4 to 2.24.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​523](homeport/dyff#523) - build(deps): bump github.com/Masterminds/semver/v3 from 3.3.1 to 3.4.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​524](homeport/dyff#524) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.24.0 to 2.25.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​528](homeport/dyff#528) - build(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​532](homeport/dyff#532) - build(deps): bump github.com/onsi/gomega from 1.38.0 to 1.38.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​533](homeport/dyff#533) - build(deps): bump github.com/stretchr/testify from 1.11.0 to 1.11.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​535](homeport/dyff#535) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.1 to 2.25.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​536](homeport/dyff#536) - build(deps): bump github.com/spf13/pflag from 1.0.7 to 1.0.10 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​537](homeport/dyff#537) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.2 to 2.25.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​539](homeport/dyff#539) - build(deps): bump github.com/spf13/cobra from 1.9.1 to 1.10.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​538](homeport/dyff#538) - build(deps): bump actions/setup-go from 5 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​540](homeport/dyff#540) - build(deps): bump github.com/lucasb-eyer/go-colorful from 1.2.0 to 1.3.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​543](homeport/dyff#543) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.3 to 2.26.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​548](homeport/dyff#548) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.26.0 to 2.27.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​557](homeport/dyff#557) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.27.1 to 2.27.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​559](homeport/dyff#559) - build(deps): bump golangci/golangci-lint-action from 8 to 9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​562](homeport/dyff#562) - build(deps): bump actions/checkout from 5 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​568](homeport/dyff#568) - build(deps): bump github.com/spf13/cobra from 1.10.1 to 1.10.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​569](homeport/dyff#569) - build(deps): bump github.com/onsi/gomega from 1.38.2 to 1.38.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​571](homeport/dyff#571) - build(deps): bump github.com/onsi/ginkgo/v2 from 2.27.2 to 2.27.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​576](homeport/dyff#576) - build(deps): bump github.com/BurntSushi/toml from 1.5.0 to 1.6.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​581](homeport/dyff#581) - Fix build linter warning and update dependencies by [@​HeavyWombat](https://github.com/HeavyWombat) in [#​582](homeport/dyff#582) - fix: Deterministic sort list in output to avoid random order by [@​tonur](https://github.com/tonur) in [#​527](homeport/dyff#527) - Add test case for issue 525 by [@​HeavyWombat](https://github.com/HeavyWombat) in [#​583](homeport/dyff#583) - docs(README): add mise alternative method installation by [@​jylenhof](https://github.com/jylenhof) in [#​579](homeport/dyff#579) #### New Contributors - [@​tonur](https://github.com/tonur) made their first contribution in [#​527](homeport/dyff#527) - [@​jylenhof](https://github.com/jylenhof) made their first contribution in [#​579](homeport/dyff#579) **Full Changelog**: <homeport/dyff@v1.10.2...v1.10.3> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi42Ni4yIiwidXBkYXRlZEluVmVyIjoiNDIuNjYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Solves one part of this issue:
dyff betweencommand is non deterministic and uses 2 different styles randomly #525With some additional features added to solve machine readable feature request in this PR:
YAML comparison to avoid non-deterministic random output:
getNonStandardIdentifierFromNamedListsfunction inpkg/dyff/core.gonow sorts keys before iterating, ensuring deterministic order when comparing named lists. This prevents inconsistent results due to map iteration order.Test fixture updates:
assets/issues/issue-525/from.yamlandassets/issues/issue-525/to.yamlhave been updated with new and modified entries, reflecting changes in image tags, digests, and additional images for more comprehensive testing. [1] [2]Output formatting:
generateHumanDetailOutputAdditionmethod inpkg/dyff/output_human.gonow uses the report's configured indent value instead of a hardcoded value, ensuring consistent output formatting.Example that this is deterministic:

One sample:
Many samples:
