feat(package): resolve and lock two majors of one package #328
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/323-two-majors-resolve"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #323
Slice 1 of 3 of #28: the resolver and the lock take two majors of one package. Workspace loading and checker identity (#324) and lowering and the back ends (#325) are the next slices; until then a graph with two majors resolves and locks but does not build.
Loop decisions
resolvefirst runs the solver exactly as before, one version per package. Only when that has no solution does it run again with every package whose candidates span several majors split into one solver package per major (acme/json 1.x,acme/json 2.x). A graph that resolved before therefore resolves and locks byte-identically, and an update never adds a second major where one does. The second run's answer, success or explanation, is the answer.*,>=1.0.0) becomes one incompatibility{depender, not acme/json 1.x R, not acme/json 2.x R}. It holds as soon as one major in the graph satisfies it. Where none does yet and nothing else is left to decide, the solver decides the last (highest) major and learns its way down if that fails (chooseMajor, only active in the split run). A requirement that reaches no major with a release becomes a major of its own with no versions, so the explanation saysno version of acme/json 3.x matches ^3.0.0.name M.x, so explanations readacme/a depends on acme/json 1.x ^1.2.0. Unsplit packages keep their plain name, so explanations of single-major graphs are unchanged.Resolution.versionsandpreferredareMap<String, List<Version>>, with one version per major, lowest first. The lock keeps the highest allowed locked version per key.renderLocksortsgraphby name, then version; single-major locks are unchanged.Lock.lockedWithin(name, versions)picks the entry of a requirement's major.lockProblems(sotorb lock --checkandtorb install) andpublishProblemsuse it.torb add/remove/updateprint changes and capability gains per (name, major).Tests (compiler/tests/packages.test.trb)
a -> json ^1withb -> json ^2resolves to one version of each.^1.2.0vs<1.1.0) still fails, namingacme/json 1.x.lockProblemsfor requirements of either major.docs/design/PROJECT.mdsection 6a and theRELEASE.md"not built" list are updated. Design docs do not feedskills/, so no regeneration is needed. Seed impact: none.cd99b615a5df9de48e77df9de48e776f592335db6f592335db580eb6611fApproved.
lockProblemswith two majors; two explanation tests rewritten to within-major conflicts with the same shape. CI green on this head (tier A, bootstrap, gates, pdisc).chooseMajorfallback,keysOffor unreachable majors, andcounterpartOffor the CLI change summaries read consistently with the stated behaviour.packagelines.Non-blocking:
Lock.lockedWithinsilently falls back to the first entry when no locked version is in the set; fine forlockProblems(it reports the pin), worth keeping in mind for slice 2 callers.