Skip to content

feat(pkg): constrain package versions across platforms - #15983

Closed
Alizter wants to merge 3 commits into
ocaml:mainfrom
Alizter:push-stpxklwkyzmr
Closed

feat(pkg): constrain package versions across platforms#15983
Alizter wants to merge 3 commits into
ocaml:mainfrom
Alizter:push-stpxklwkyzmr

Conversation

@Alizter

@Alizter Alizter commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #15982. Only the final commit is new in this draft.

Summary

  • Add SAT constraints requiring all platform roles for a package to select the same version.
  • Let SAT choose an older common version when available.
  • Report the requested platform set as unsatisfiable when no common version exists.

Tests

  • dune runtest test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-older-common-version.t test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-platform-dependant-version.t test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-platform-dependant-version-extra-files.t
  • dune build @fmt @check

@Alizter Alizter added the package management Dune's package management — `(pkg)` stanza, lockdirs, `dune pkg` commands label Aug 17, 2026
Solve every requested platform before writing a portable lock directory. If any platform fails, report the failures together and leave no partial lock directory behind; otherwise merge the platform-specific package data into conditional lock-file entries.

This replaces the previous partial-success behavior and keeps the watch-server regression test tolerant of the additional solve work.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Build one solver universe containing every requested platform and invoke SAT once instead of solving each platform independently. Platform-aware roles, availability checks, conflict classes, and result extraction preserve which platforms selected each package while diagnostics are deduplicated by package.

Generate conditional lock-file data directly from the joint result and remove the per-platform result-merging APIs. A post-solve invariant still rejects different versions of the same package; the next commit moves that restriction into SAT.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
A joint solve could select different versions of one package on different platforms and only reject the result after SAT completed. Add equality constraints between the per-platform roles so SAT must choose one version that works everywhere.

This lets SAT fall back to an older common version when one exists and report an unsatisfiable platform set when no common version exists.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter
Alizter force-pushed the push-stpxklwkyzmr branch from d94fc9e to 512a19b Compare August 17, 2026 10:48
@Alizter Alizter closed this Aug 17, 2026
@Alizter
Alizter deleted the push-stpxklwkyzmr branch August 17, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package management Dune's package management — `(pkg)` stanza, lockdirs, `dune pkg` commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant