fix(show): report stale lock files clearly - #11010
Open
AG0708 wants to merge 1 commit into
Open
Conversation
When show resolves packages against a stale lock, the solver can report that dependencies match no versions. Detect that combination and direct users to regenerate the lock file while preserving solver errors for fresh locks. Fixes python-poetry#9485. Signed-off-by: Abhinav Gorrepati <gorrepatiabhinav1@gmail.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new stale-lock error message logic duplicates existing guidance strings; consider centralizing this message (and the
self._lock_create_command()usage) in a shared helper to avoid future divergence. - Returning
1from_display_packages_informationon stale-lock errors changes its return-type behavior; confirm callers either ignore the return value or adjust the method to use a more consistent error-signaling pattern (e.g. raising a specific exception). - The bare
except SolverProblemErrorwill intercept all solver issues duringshow; if there are non-lock-related solver failures that should surface differently, consider checking forlocker.is_fresh()before catching or rewrapping the exception to preserve more context.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new stale-lock error message logic duplicates existing guidance strings; consider centralizing this message (and the `self._lock_create_command()` usage) in a shared helper to avoid future divergence.
- Returning `1` from `_display_packages_information` on stale-lock errors changes its return-type behavior; confirm callers either ignore the return value or adjust the method to use a more consistent error-signaling pattern (e.g. raising a specific exception).
- The bare `except SolverProblemError` will intercept all solver issues during `show`; if there are non-lock-related solver failures that should surface differently, consider checking for `locker.is_fresh()` before catching or rewrapping the exception to preserve more context.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request Check List
Resolves: #9485
Summary
When
poetry showtries to solve against a stale lock file, the solver can currently emit a misleading dependency-resolution failure such as:This change detects that specific combination—a stale lock followed by
SolverProblemError—and reports Poetry's canonical recovery guidance instead:Fresh-lock solver failures and successful stale-lock
showpaths remain unchanged.Validation
outdated_lockfixture.showsuites: 90 passed.AI assistance is disclosed in the commit trailer.