Skip to content

Conversation

@dafyddcrosby
Copy link
Contributor

These are incredibly complex methods, and I want to make sure I'm not breaking something in any future commits trying to speed up depsolving

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

…y_constraint

Add unit tests for the EnvironmentCookbookVersionsEndpoint helpers:
- sort_versions: descending semver sort, single element, empty, multi-digit
- filter_by_constraint: nil passthrough, exact/>=/>~ constraints, no match, immutability

Signed-off-by: David Crosby <dcrosby@fb.com>
Add comprehensive unit tests for the depsolve dependency solver:
- empty versions returns nil and sets @last_constraint_failure
- empty unsolved list returns desired_versions unchanged
- single cookbook with no dependencies resolves to latest
- cookbook with satisfiable dependency resolves both
- missing dependency cookbook returns nil and sets @last_missing_dep
- backtracking to older version when newest has unsatisfiable dep
- environment constraints applied to dependency versions
- dependency's own version constraint filters available versions
- pre-tracked dependency not narrowed to single version (known failure)
- unsatisfiable dep constraint (all versions filtered) returns nil
- cache accumulates entries for all resolved cookbooks
- multiple independent unsolved cookbooks resolve to latest
- diamond dependency (two cookbooks sharing a dep)
- conflicting dependency constraints returns nil
- deep dependency chain (A -> B -> C)
- multiple backtracking steps (v3, v2 fail, v1 succeeds)
- cookbook with missing metadata key uses fallback

Signed-off-by: David Crosby <dcrosby@fb.com>
@dafyddcrosby dafyddcrosby marked this pull request as ready for review February 10, 2026 19:40
@dafyddcrosby dafyddcrosby requested review from a team and jaymzh as code owners February 10, 2026 19:40
@sonarqubecloud
Copy link

@tpowell-progress tpowell-progress merged commit cc5b427 into chef:main Feb 10, 2026
61 of 66 checks passed
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