Fix/version discovery range pruning - #1815
Open
georgelemon wants to merge 6 commits into
Open
Conversation
…tags Signed-off-by: George Lemon <georgelemon@protonmail.com>
=> >= 0.1.5) so versions that can never be selected - and their historical requirements (often pointing at deleted repos), are never processed. Keep installs interactive so private repos still work. Signed-off-by: George Lemon <georgelemon@protonmail.com>
Collaborator
|
A couple of things before this can get a proper review. When a change is largely AI-produced, please verify it's sound before submitting ie "Why it's provably safe" section isn't evidence. The intersection logic in processRequirements merges requirements coming from different versions of the same package, which changes resolution semantics — that needs tests demonstrating the solver still finds a solution when it has to fall back to an older version of a dependency Also please split this in two, both the PR and the issue:
|
The GIT_TERMINAL_PROMPT handling during version discovery belongs to the separate 'don't block on git credential prompts' change; this branch keeps only the discovery range pruning.
Intersecting same-name requirements coming from different versions of the same package can drop a version the solver needs when it has to fall back to an older version of that package (e.g. when the newest version's own dependencies are unresolvable). Keep distinct requirement ranges instead — only de-duplicate exact duplicates — and remove the now-unused intersectVersionRanges/isSimpleRange helpers. Add comprehensive offline resolver tests covering range pruning (>=, <=, ==, >X&<Y, ^=, ~=, any, multi-branch), failedReqs exclusion (satisfied and unsatisfied), multiple packages requiring the same dependency with different ranges, and fallback to older versions.
Signed-off-by: George Lemon <georgelemon@protonmail.com>
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.
Related to #1814
The mechanism now
Discovery only ever sees versions that could actually be selected:
getMinimalFromPreferred): each requirement branch filters discovered versions against its own range. Out-of-range historical versions (tim 0.2.0, watchout 0.2.0/0.2.1, supranim 0.1.0–0.1.4) never reach requirement processing → libffi/httpx/websocketx/libevent are never touched.ozark >= 0.1.4, 0.1.6 says>= 0.1.5—processRequirementsmerges them into the intersection>= 0.1.5and discovers only that. ozark 0.1.4 is never discovered, so its deadparsesqlURL is never probed at all.collectAllVersions,GIT_TERMINAL_PROMPT=0is set (respecting user overrides, restored afterwards). Any dead URL that is still probed (e.g. a genuinely dead direct requirement) fails fast and the version is excluded. Actual installs run outside this window, so private repos still get an interactive prompt.processRequirementsre-raises, the caller records the requirement infailedReqs, and dependent versions are excluded cleanly;collectAllVersionstolerates failed top-level requirements (and consumes failed futures so chronos stays quiet).Why it's provably safe
requiresstored on each version in the table, not from the merged range. The merged range only decides what gets fetched/discovered; it never relaxes what the solver enforces. So with>= 0.1.4and>= 0.1.5both present, the solver still always picks 0.1.5 — the merged range just stops wasting work on 0.1.4.Net result for booyaka now:
supranim >= 0.1.5→ intersect →ozark >= 0.1.5→ discover only 0.1.5 → no parsesql, no prompt, build succeeds.Git prompting: before vs now per scenario
GIT_TERMINAL_PROMPT=0→ fails fast → cleanMissing dependencieserror → no prompt