Skip to content

feat: Add simple output to allow consitent machine readable output - #531

Open
tonur wants to merge 45 commits into
homeport:mainfrom
tonur:add-simple-output
Open

feat: Add simple output to allow consitent machine readable output#531
tonur wants to merge 45 commits into
homeport:mainfrom
tonur:add-simple-output

Conversation

@tonur

@tonur tonur commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

Closes #525

This pull request introduces a new option for generating simplified list diffs and refactors the comparison logic for named lists to improve determinism and flexibility. It also adds a utility for comparing YAML nodes, and makes some targeted improvements to output formatting and CLI options.

Feature: Simple List Diff Option

  • Added a new CLI flag --simple-list-diff (and corresponding field in reportConfig) to allow users to toggle between detailed per-entry diffs and a simple overview (added/removed) for named lists. The flag is wired through the CLI, configuration, and core comparison logic. [1] [2] [3] [4] [5] [6]

Output: Diff Formatting Enhancements

  • Enhanced the diff syntax output to optionally show only changed lines for modifications when the appropriate flag is set, and improved output formatting for additions by using the correct indentation. [1] [2] [3] [4]

@tonur

tonur commented Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

Waiting for #527 to be completed before this is implemented.

@tonur tonur changed the title Add simple output to allow consitent machine readable output feat: Add simple output to allow consitent machine readable output Aug 26, 2025
tonur and others added 19 commits August 28, 2025 21:09
….T with Ginkgo and improving output normalization
@tonur

tonur commented Dec 25, 2025

Copy link
Copy Markdown
Contributor Author

After #527 was completed, this would also be an immense help to me. This change will close #525
I have merged the upstream changes into this branch, and confirmed that it still works:
image
image
image

Would this be something you'd be willing to accept? @HeavyWombat

@tonur
tonur marked this pull request as ready for review December 25, 2025 09:09
@codecov

codecov Bot commented Dec 25, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.10%. Comparing base (6f6bdc4) to head (4446e02).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #531      +/-   ##
==========================================
+ Coverage   82.32%   84.10%   +1.77%     
==========================================
  Files          17       18       +1     
  Lines        1765     2019     +254     
==========================================
+ Hits         1453     1698     +245     
- Misses        236      248      +12     
+ Partials       76       73       -3     
Flag Coverage Δ
unittests 84.10% <100.00%> (+1.77%) ⬆️

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.

@tonur
tonur force-pushed the add-simple-output branch from 2123c94 to 10bd969 Compare December 25, 2025 09:32
@tonur

tonur commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

Any chance you'd be accepting this @HeavyWombat? :D

@HeavyWombat

Copy link
Copy Markdown
Member

Any chance you'd be accepting this @HeavyWombat? :D

Hi @tonur, I am coming back to some of the pending PRs of dyff. Some of the recent updates to the tool make it hard for me to follow, what we wanted to achieve here. With #525 being tackled, I am wondering: Could you try to explain to me again what you want to achieve with this second one? May your use case or some pseudo diff outputs to help me understand your case? Thanks in adance!

@tonur

tonur commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

@HeavyWombat thanks for following up on this!
My need is for a tool to grab all modified entries of a list in a yaml file.

Take fx the files from assets/issues/issue-525/:
image

What I want is to specify a flag, which I have called "--simple-list-diff --changed-entries", and then make dyff only output the changed entries on that list. (Note that it should probably just be a singular flag called "--output pure-yaml" or stuff like that.)
So the above comparison would result in this output:

name: a-type-of-file
allowed:
- digest: "sha256:1111111111111111111111111111111111111111111111111111111111111111"
  image: name/container
  registry: ghcr.io
  tag: 1.2.4
  field:
  - test
- digest: "sha256:22222222222222222222222222222222222222222222222222222222222222222"
  image: yes/i-am-an-image
  registry: docker.io
  tag: 1.2.4-test_with.symbols
- digest: "sha256:4444444444444444444444444444444444444444444444444444444444444444"
  image: oh-look/another-flaky
  registry: quay.io
  tag: 3.1.2-test-with-dashes
- digest: "sha256:0000000000000000000000000000000000000000000000000000000000000000"
  image: you-would-not/guess
  registry: docker.io
  tag: 1.3.2
- digest: "sha256:6666666666666666666666666666666666666666666666666666666666666666"
  image: additional/image
  registry: new.io
  tag: 9.8.7

The important part is that the output is machine readable, so that I can use it for automation and run a CI/CD pipeline that handles only the modified entries.

Does that explain it?

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.

[BUG] dyff between command is non deterministic and uses 2 different styles randomly

2 participants