Expose resolved_ephemerals on pyrer.SolveResult#85
Merged
Conversation
Agent-Logs-Url: https://github.com/doubleailes/rer/sessions/ca234794-b68f-4bbf-832b-9be9ee11ca99 Co-authored-by: doubleailes <23233470+doubleailes@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Expose resolved ephemerals from pyrer.SolveResult
Expose May 16, 2026
resolved_ephemerals on pyrer.SolveResult
…hemerals The Vec-returning accessors (`Solver::resolved_packages` / `resolved_ephemerals`, `ResolvePhase::solved_variants` / `solved_ephemerals`) force callers that only need to iterate to pay for an intermediate `Vec` plus, for ephemerals, an owning clone of each `Requirement`. Add borrowing-iterator siblings so future consumers can stream without allocating. New API, additive — every existing Vec method keeps its signature: Solver::resolved_packages_iter() -> Option<impl Iterator<Item = Rc<PackageVariant>>> Solver::resolved_ephemerals_iter() -> Option<impl Iterator<Item = &Requirement>> ResolvePhase::iter_solved_variants() -> impl Iterator<Item = Rc<PackageVariant>> ResolvePhase::iter_solved_ephemerals() -> impl Iterator<Item = &Requirement> `iter_solved_variants` still has to clone `self.scopes` internally because `get_solved_variant` takes `&mut self` (it triggers a deferred sort on the variant slice); the saving vs the Vec form is the trailing `.collect()`. `iter_solved_ephemerals` is the bigger win — pure borrow, zero allocation, no per-element clone. Refactor the existing Vec methods to delegate to the iter forms so there's one implementation of the filter logic. ## pyrer wired through `crates/rer-python/src/lib.rs` switches its `SolveResult` build to use `resolved_packages_iter` / `resolved_ephemerals_iter`. Two intermediate `Vec`s skipped per solved result; for ephemerals every entry is now read by reference instead of cloned then stringified. ## Tests - `test_iter_resolved_packages_matches_vec_form` and `test_iter_resolved_ephemerals_matches_vec_form` in `solver::tests` — confirm iter and Vec forms agree on the same input and that the iter form returns `None` on a failed solve. - Existing 5 Python tests for `resolved_ephemerals` still pass (the FFI surface is unchanged; just the implementation under it). ## Verification - `cargo test` (Rust): 41/41 unit tests pass (was 39 + 2 new). - `cargo test … --ignored` (188-case differential): 188/188 still match rez 1:1 in 17.68 s. - `pytest tests/` (all Python): 80/80. ## Perf (188-case benchmark, same machine as README reference) | | Total | Mean | Median | |---|---:|---:|---:| | README reference (post-#73) | 11.35 s | 60 ms | 30 ms | | This branch, pre iter-forms (run 1) | 11.19 s | 60 ms | 28 ms | | This branch, pre iter-forms (run 2) | 11.27 s | 60 ms | 33 ms | | This branch, post iter-forms (run 1) | 10.90 s | 58 ms | 28 ms | | This branch, post iter-forms (run 2) | 11.16 s | 59 ms | 30 ms | Within run-to-run noise; if anything a slight improvement from the avoided allocations. No regression. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Picks up the resolved_ephemerals feature (issue #84) plus the borrowing-iterator API additions (`resolved_packages_iter` / `resolved_ephemerals_iter` on Solver, `iter_solved_variants` / `iter_solved_ephemerals` on ResolvePhase). The docs version pill, homepage `repo_version`, and the Quick Start `rer-resolver` dep example are bumped along with the workspace version so they stay in sync. 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? |
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.
pyrer.SolveResulthad no way to read back the ephemeral packages a solve landed on, blocking drop-in compatibility with rez'sSolver.resolved_ephemerals(downstreamResolvedContext.resolved_ephemerals, env-var exports, etc.). The solver already tracked them internally — only the PyO3 surface and the Rust accessor were missing.Changes
rer-resolver:ResolvePhase::solved_ephemerals()walks the final phase's scopes and collects each ephemeral scope's intersectedRequirementvia the existingPackageScope::get_solved_ephemeral.Solver::resolved_ephemerals() -> Option<Vec<Requirement>>mirrorsresolved_packages()—NoneunlessSolved.rer-python: newresolved_ephemerals: list[str]field onSolveResult, stringified viaRequirement'sDisplay(rez requirement form). Empty list forfailed/error.requires-contributed ephemerals, empty when no ephemerals participated, and empty/Noneon failure.Example
Encoding matches
resolved/failure_description: rez-style strings the caller re-parses withrez.version.Requirement.