Skip to content

Fix allow update-types filtering for individual dependency updates#14598

Merged
kbukum1 merged 4 commits intomainfrom
kbukum1/fix-allow-update-types-filtering
Apr 2, 2026
Merged

Fix allow update-types filtering for individual dependency updates#14598
kbukum1 merged 4 commits intomainfrom
kbukum1/fix-allow-update-types-filtering

Conversation

@kbukum1
Copy link
Copy Markdown
Contributor

@kbukum1 kbukum1 commented Apr 1, 2026

What are you trying to accomplish?

Fixes #12668

Follow-up to #12925. The update-types check in allowed_update? runs pre-resolution when previous_version is nil, so the filter is silently skipped for individual updates.

This moves update-types filtering to ignore_conditions_for, converting allowed types into inverse ignore version ranges — the same mechanism ignore update-types already uses, which only needs the current version.

Related: #12925, API #8052, CLI #605

Anything you want to highlight for special attention from reviewers?

allowed_update? is a dependency-level gate (name, type) that runs pre-resolution. Version-level filtering belongs in ignore_conditions_for which only needs the current installed version to compute ranges.

Test repo: https://github.com/dsp-testing/dependabot-allow-update-types

How will you know you have accomplished your goal?

  • Existing and new tests pass
  • Re-running Dependabot on the test repo should only create PRs matching the configured update-types filters

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Copilot AI review requested due to automatic review settings April 1, 2026 19:08
@kbukum1 kbukum1 requested a review from a team as a code owner April 1, 2026 19:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes allow.update-types filtering for individual (non-grouped) dependency updates by moving semver filtering out of Job#allowed_update? (which runs pre-resolution without previous_version) and into Job#ignore_conditions_for, reusing the existing “ignore by version range” mechanism.

Changes:

  • Removes the (pre-resolution) update-types gate from Job#allowed_update? and derives semver filtering via implicit ignore ranges in ignore_conditions_for.
  • Adds semver label/constants + mapping in Updater::UpdateTypeHelper as a shared source of truth.
  • Adds/update specs and fixtures to assert the correct ignored_versions are passed into update checkers for allow update-types scenarios.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
updater/lib/dependabot/job.rb Moves allow update-types enforcement into ignore_conditions_for by generating implicit ignore version ranges.
updater/lib/dependabot/updater/update_type_helper.rb Adds semver constants and a mapping to config update-type strings.
updater/spec/dependabot/job_spec.rb Updates allowed_update? expectations and adds focused ignore_conditions_for coverage for allow-derived ranges.
updater/spec/dependabot/updater/operations/update_all_versions_spec.rb Verifies UpdateChecker receives the expected ignored_versions when allow update-types are present.
updater/spec/fixtures/job_definitions/bundler/version_updates/allow_update_types_patch_only.yaml New job definition fixture to exercise patch-only allow update-types.
updater/spec/fixtures/job_definitions/bundler/version_updates/allow_update_types_minor_and_patch.yaml New job definition fixture to exercise minor+patch allow update-types.
updater/spec/fixtures/bundler_allow_update_types/original/Gemfile Adds a minimal bundler fixture project for allow update-types scenarios.
updater/spec/fixtures/bundler_allow_update_types/original/Gemfile.lock Adds the corresponding lockfile fixture.

config_type = "version-update:semver-#{dep_update_type}" if dep_update_type
normalized_types = allowed_update_types.filter_map { |t| t.is_a?(String) ? t.downcase.strip : nil }
next false if config_type && !normalized_types.include?(config_type)
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review Tip: For allow update types we need previous and current versions to ignore updates that are not allowed for the dependency name or dependency-type. We can only apply this in post resolution to see if update is necessary or not. It is different then ignore conditions where we are adding range versions conditions and using this to filter out the other versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

end

it { is_expected.to be(true) }
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review tip: All tests are moved in the new section, ignore_conditions_for

"update-types" => ["version-update:semver-minor"]
}
]
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review tip: All tests are moved in the new section, ignore_conditions_for

"dependency-name" => "business"
}
]
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review tip: All tests are moved in the new section, ignore_conditions_for

@kbukum1 kbukum1 force-pushed the kbukum1/fix-allow-update-types-filtering branch from aed17bc to 68be912 Compare April 1, 2026 20:39
@kbukum1 kbukum1 requested a review from Copilot April 1, 2026 20:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

@kbukum1 kbukum1 marked this pull request as draft April 1, 2026 23:10
@kbukum1 kbukum1 requested a review from Copilot April 2, 2026 00:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

@kbukum1 kbukum1 marked this pull request as ready for review April 2, 2026 00:45
Copy link
Copy Markdown
Contributor

@AbhishekBhaskar AbhishekBhaskar left a comment

Choose a reason for hiding this comment

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

LGTM

@kbukum1 kbukum1 merged commit 6145745 into main Apr 2, 2026
173 checks passed
@kbukum1 kbukum1 deleted the kbukum1/fix-allow-update-types-filtering branch April 2, 2026 02:45
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.

Add support for update-types in allow block

3 participants