feat(resolver,python): version_range hint on load_family callback (closes #92)#93
Closed
doubleailes wants to merge 3 commits into
Closed
feat(resolver,python): version_range hint on load_family callback (closes #92)#93doubleailes wants to merge 3 commits into
doubleailes wants to merge 3 commits into
Conversation
…oses #92) The `load_family` callback now receives a `version_range` argument when its signature accepts one. The hint is a rez-syntax range string (`"2+<3"`, `"==2.0"`, `None` for unconstrained) that the shim can pass directly to `rez.packages.iter_packages(range_=...)` to skip on-disk version directories outside the current solver constraint. ## Why this matters Issue #92 measured 95% load-fan-out waste in a real Fortiche resolve: 2,637 PackageData materialised so that 132 land in the solve. With the hint, the shim pre-filters to versions intersecting the solver's current constraint — projected ~400 loads instead of 2,637, a 6.6× cut to a path that accounts for 91% of resolve wall time on that workload. ## Backward compatibility Detected at solve start via `inspect.signature`: def load_family(name): # legacy, 1-arg def load_family(name, version_range=None): # new, 2-arg def load_family(name, **kwargs): # **kwargs accepted All three keep working. The hint is passed as a keyword argument so the **kwargs form receives it transparently. No flag-day for existing shims. ## Backtrack widening The repo tracks the loaded range per family. If a later request needs a wider range than the cached load covered (i.e. the solver backtracks and widens), the loader is re-called with the unioned range and the variant cache invalidates the stale `PackageVariantList`. In practice this is rare — most resolves narrow monotonically. ## Surface area changes Rust: - `FamilyLoader` signature: `Fn(&str, Option<&VersionRange>) -> Vec<...>` - `PackageRepo::get_family(name, hint)` — was `get_family(name)` - `PackageVariantList::new(ctx, name, hint)` — was `new(ctx, name)` - `PackageVariantCache::get_or_build(ctx, name, hint)` — was 2-arg - `PackageRepo` internal cache entry now tracks `loaded_range` Python: - `load_family` callback gains optional `version_range` kwarg - Detection via `inspect.signature`; legacy callbacks unchanged ## Tests Rust: - test_loader_receives_version_range_hint — confirms the hint string is "2+<3" for `lib-2+<3` requests - test_loader_eager_seed_no_loader_call — pre-seeded families never invoke the loader even with a hint - All 44 existing solver tests + 2 new = 46/46 Python: - test_load_family_range_hint_passed_for_pinned_request - test_load_family_legacy_one_arg_callback_still_works - test_load_family_range_hint_string_format - test_load_family_kwargs_callback - 94 existing tests + 4 new = 98/98 ## Differential `cargo test --release -p rer-resolver --test test_rez_benchmark -- --ignored`: **188/188** in 16.64 s. Solver behavior unchanged on the strict rez-faithfulness gate. ## Docs `docs/content/docs/getting-started/rez-integration.md` updated: - `load_family` worked example now shows the 2-arg signature with `iter_packages(range_=...)`. - New "The version_range hint (issue #92) — pre-filter at the shim" section with the impact table and the advisory semantics. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
The cross-reference link `#plugging-in-the-static-package-py-fast-parser` pointed at a section that only exists on the `experimental` branch, so Zola's internal-link checker fails when building this doc on main. Replace the link with a text-only reference. The cross-link can come back when the `experimental` branch lands on main and the section is actually present in this doc. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
First 1.0 release candidate. Picks up everything currently on `main`: - Solver port + 188-case rez differential (1:1 match) - load_family lazy package discovery (#86) - resolved_ephemerals on SolveResult (#84) - PackageData.from_strings raw-string fast path (#88) - load_family version_range hint (#92, this branch) The 1.0.0 jump signals that the public API surface is now under the stability contract documented in `docs/content/docs/engineering/stability/`. RC numbers keep shipping until the gate to remove the `-rc.N` suffix is reviewed (see CHANGELOG `[1.0.0] — TBD`). Four touchpoints: - Cargo.toml: workspace version + the two internal-dep pins (rer-version, rer-resolver) - docs/config.toml: GitHub-pill version - docs/content/_index.md: homepage repo_version - docs/content/docs/getting-started/quick-start.md: Rust dep snippet Existing historical note at `docs/content/docs/engineering/stability.md:39` ("Pre-1.0.0 (0.1.0-rc.x) releases did not carry a stability contract") stays unchanged — it's a deliberate reference to the prior series. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.
Summary
Threads a
VersionRangehint throughpyrer.solve'sload_familycallback so the rez integration shim can pre-filter viarez.packages.iter_packages(range_=...). Targets the 95% load-fan-out waste documented in #92.The win
How
Rust:
Python:
Tests
Verifications
Test plan
Files
🤖 Generated with Claude Code