Repository navigation
Split Resolve into ResolveFirst and FirstSolve.UpgradePass - #112
Merged
Merged
Conversation
A caller can run every first solve before any upgrade pass. Resolve now uses the same path, so the two give the same answer and report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also list the full supported surface and say what ResolveFirst keeps by reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Merging at It adds a public API, so it had two independent reviews (separate Claude sessions that did not write it):
RoboRev jobs 5734 and 5739 passed with no findings. CI: Left as is, all low: one long doc line on |
Merged
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.
Adds
ResolveFirst, which runs only the first solve, andFirstSolve.UpgradePass, which runs theUpgradeRootspass later from that answer without solving it again. Package Manager solves about 30 environments per upload and wants every first answer to exist before any pass starts, so a deadline during the passes can fall back to the first answers: https://github.com/rstudio/package-manager/issues/22820.API
FirstSolvekeeps reqs, index, Options, the first answer, and the first solve's duration and steps. The pass reads those, so its step and time bounds count from the first solve as inResolve, and a caller cannot hand it a different answer or inputs.Resolvenow runsresolveFirstthen the same pass, so the two paths are one code path.UpgradeRoots == 0:UpgradePassreturns the first answer withUpgradenil. A ctx already ended: the first answer,StoppedByTimetrue, no error.ResolveFirstcopies reqs andAllowPrerelease;ResolutionandUpgradePassreturn fresh copies. AFirstSolveis safe to use from several goroutines.Tests
resolver/firstsolve_test.go:TestTwoPhaseMatchesResolve: 14 fixtures (early/late gain, time factor and max time, step factor short/exact, max steps, budget 1, three root-moving-down cases) on a fake clock. Two phases andResolvearereflect.DeepEqual, report included, with the same steps per solve.TestTwoPhaseStepBoundIsRelativeToFirstSolve,TestTwoPhaseEndedCtxGivesFirst,TestTwoPhasePassOff,TestResolveFirstRunsNoPass,TestTwoPhaseResultsShareNothing, andTestTwoPhaseAcrossGoroutines(first solves and passes on different goroutines, two passes per value).Red: against a stub that solves but passes no duration or steps to the pass, 4 tests fail: five equivalence cases (time factor 1, 1.5, early 1; step factor short and exact) (
steps per solve: two phases [7], Resolve [7 7 8]), the step-bound test (using 0 steps, want ... using 15), the copy test, and the goroutine test. A nil stub panics.Green:
go test ./...passes 1302 tests (7 skipped).go test -race ./resolver/passes.go vet,gofmt -land golangci-lint v2.11.2 are clean.🤖 Generated with Claude Code