Skip to content

fix: Deterministic sort list in output to avoid random order - #527

Merged
HeavyWombat merged 4 commits into
homeport:mainfrom
tonur:deterministic-sort-list-fix
Dec 22, 2025
Merged

fix: Deterministic sort list in output to avoid random order#527
HeavyWombat merged 4 commits into
homeport:mainfrom
tonur:deterministic-sort-list-fix

Conversation

@tonur

@tonur tonur commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

Solves one part of this issue:

With some additional features added to solve machine readable feature request in this PR:

YAML comparison to avoid non-deterministic random output:

  • The getNonStandardIdentifierFromNamedLists function in pkg/dyff/core.go now sorts keys before iterating, ensuring deterministic order when comparing named lists. This prevents inconsistent results due to map iteration order.

Test fixture updates:

  • The test fixture files assets/issues/issue-525/from.yaml and assets/issues/issue-525/to.yaml have been updated with new and modified entries, reflecting changes in image tags, digests, and additional images for more comprehensive testing. [1] [2]

Output formatting:

  • The generateHumanDetailOutputAddition method in pkg/dyff/output_human.go now uses the report's configured indent value instead of a hardcoded value, ensuring consistent output formatting.

Example that this is deterministic:
One sample:
image

Many samples:
image

@tonur

tonur commented Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

I don't know if this is a fix or a feat.
I will use fix in the PR title, but please tell me to change it if you disagree.

@tonur tonur changed the title Deterministic sort list fix fix: Deterministic sort list in output to avoid random order Aug 26, 2025
@tonur

tonur commented Oct 26, 2025

Copy link
Copy Markdown
Contributor Author

Any chance that this could get a review?

@HeavyWombat
HeavyWombat force-pushed the deterministic-sort-list-fix branch from 58bb275 to 9770607 Compare December 22, 2025 21:28
@HeavyWombat
HeavyWombat self-requested a review December 22, 2025 21:28
@HeavyWombat HeavyWombat self-assigned this Dec 22, 2025
@codecov

codecov Bot commented Dec 22, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.32%. Comparing base (a61af3d) to head (9770607).
⚠️ Report is 5 commits behind head on main.

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              
Flag Coverage Δ
unittests 82.32% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HeavyWombat HeavyWombat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
HeavyWombat merged commit 1847614 into homeport:main Dec 22, 2025
7 checks passed
@tonur

tonur commented Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

@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
Please let me know if I can do anything to help!

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 25, 2025
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 [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;522](homeport/dyff#522)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.23.4 to 2.24.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;523](homeport/dyff#523)
- build(deps): bump github.com/Masterminds/semver/v3 from 3.3.1 to 3.4.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;524](homeport/dyff#524)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.24.0 to 2.25.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;528](homeport/dyff#528)
- build(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;532](homeport/dyff#532)
- build(deps): bump github.com/onsi/gomega from 1.38.0 to 1.38.2 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;533](homeport/dyff#533)
- build(deps): bump github.com/stretchr/testify from 1.11.0 to 1.11.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;535](homeport/dyff#535)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.1 to 2.25.2 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;536](homeport/dyff#536)
- build(deps): bump github.com/spf13/pflag from 1.0.7 to 1.0.10 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;537](homeport/dyff#537)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.2 to 2.25.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;539](homeport/dyff#539)
- build(deps): bump github.com/spf13/cobra from 1.9.1 to 1.10.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;538](homeport/dyff#538)
- build(deps): bump actions/setup-go from 5 to 6 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;540](homeport/dyff#540)
- build(deps): bump github.com/lucasb-eyer/go-colorful from 1.2.0 to 1.3.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;543](homeport/dyff#543)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.25.3 to 2.26.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;548](homeport/dyff#548)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.26.0 to 2.27.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;557](homeport/dyff#557)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.27.1 to 2.27.2 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;559](homeport/dyff#559)
- build(deps): bump golangci/golangci-lint-action from 8 to 9 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;562](homeport/dyff#562)
- build(deps): bump actions/checkout from 5 to 6 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;568](homeport/dyff#568)
- build(deps): bump github.com/spf13/cobra from 1.10.1 to 1.10.2 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;569](homeport/dyff#569)
- build(deps): bump github.com/onsi/gomega from 1.38.2 to 1.38.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;571](homeport/dyff#571)
- build(deps): bump github.com/onsi/ginkgo/v2 from 2.27.2 to 2.27.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;576](homeport/dyff#576)
- build(deps): bump github.com/BurntSushi/toml from 1.5.0 to 1.6.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;581](homeport/dyff#581)
- Fix build linter warning and update dependencies by [@&#8203;HeavyWombat](https://github.com/HeavyWombat) in [#&#8203;582](homeport/dyff#582)
- fix: Deterministic sort list in output to avoid random order by [@&#8203;tonur](https://github.com/tonur) in [#&#8203;527](homeport/dyff#527)
- Add test case for issue 525 by [@&#8203;HeavyWombat](https://github.com/HeavyWombat) in [#&#8203;583](homeport/dyff#583)
- docs(README): add mise alternative method installation by [@&#8203;jylenhof](https://github.com/jylenhof) in [#&#8203;579](homeport/dyff#579)

#### New Contributors

- [@&#8203;tonur](https://github.com/tonur) made their first contribution in [#&#8203;527](homeport/dyff#527)
- [@&#8203;jylenhof](https://github.com/jylenhof) made their first contribution in [#&#8203;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-->
@tonur
tonur deleted the deterministic-sort-list-fix branch December 29, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants