fix(resolver): bypass cooldown for transitive deps when top-level pin exists#1154
Conversation
… exists When a package is both a top-level exact-pinned requirement (e.g., `foo==1.0`) and a transitive dependency of another package (e.g., `bar` depends on `foo>=0.9`), the cooldown check was blocking the transitive resolution even though the user explicitly approved that version via the pin. This could cause version downgrades or resolution failures. `resolve_package_cooldown()` now checks the dependency graph for an existing top-level exact pin before enforcing cooldown on transitive dependencies. Closes: python-wheel-build#1153 Co-Authored-By: Claude <claude@anthropic.com> Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
📝 WalkthroughWalkthroughThis PR extends the cooldown bypass logic in Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I'm late to party on review here, but just thinking out loud. I think it makes sense to always do this, but I'm wondering about edge cases? |
| logger.info("cooldown bypassed as the top-level requirement uses == pin") | ||
| return None | ||
|
|
||
| if req_type != RequirementType.TOP_LEVEL: |
There was a problem hiding this comment.
Nit: this graph lookup (get_root_node + get_outgoing_edges) runs for every non-top-level resolution even when ctx.cooldown is None. We could add an early if ctx.cooldown is None: return None guard at the top of the function to skip both this check and the existing top-level pin check when cooldown isn't active.
When a package is both a top-level exact-pinned requirement (e.g.,
foo==1.0) and a transitive dependency of another package (e.g.,bardepends onfoo>=0.9), the cooldown check was blocking the transitive resolution even though the user explicitly approved that version via the pin. This could cause version downgrades or resolution failures.resolve_package_cooldown()now checks the dependency graph for an existing top-level exact pin before enforcing cooldown on transitive dependencies.Closes: #1153