Enhance absent_file filter to suppress diffs when file is absent in b… #341
+66
−10
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.
…oth catalogs
Pass from_resources and to_resources to filter options, add logic to detect files with ensure=>absent in both catalogs, and suppress all parameter diffs for those files. Maintains backward compatibility by checking ensure diffs when resource lists are not provided.
Summary
When the AbsentFile filter is enabled,
octocatalog-diffshould not show diffs for resources that areensure => absentin both catalogs, even if other parameters differ. If both sides are absent for the same resource key, those parameter differences are meaningless and should be suppressed.This PR fixes a case where we would still emit diffs when both catalogs had
ensure == absentbut other params differed.Problem
Today, AbsentFile filtering primarily triggers based on seeing an explicit
ensurediff (e.g.,present -> absent). If a file is absent in both catalogs, there may be noensurediff at all, but we could still show diffs for other parameters (owner/mode/etc.) if they change.That output is noise: if the file is absent in both catalogs, the params don’t matter.
Changes
Pass full resource lists to filters
from_resources: @catalog1_raw.resourcesto_resources: @catalog2_raw.resourcesinto the filter options hash.
Improve AbsentFile filter behavior
ensure => absentdiff in the new catalog is still sufficient to trigger filtering even when resource lists aren’t provided.Tests
Run:
bundle exec rspec spec/octocatalog-diff/tests/catalog-diff/filter/absent_file_spec.rb