Skip to content

Conversation

@gridbugs
Copy link
Collaborator

When generating portable lockdirs the solver runs multiple times. Dune collects any errors from the solver and prints them to the terminal in the event that no solution was found on any platforms, and logs them printing a warning if no solution was found on some but not all platforms. This can create a situation where the same error is printed multiple times, since many solver errors are platform agnostic.

This change groups solver errors by the contents of their message when generating portable lockdirs. Each solver error is printed a single time, along with the list of platforms on which it occurred.

bin/pkg/lock.ml Outdated
Platforms_by_message.to_list platforms_by_message
|> List.map ~f:(fun (solver_error, platforms) ->
Pp.concat
~sep:Pp.newline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use Pp.newline as it messes up various things that consume user messages. Instead do a break and wrap in a vertical box. You can also use Pp.concat_map with a hovbox so that each line sits sensibly.

bin/pkg/lock.ml Outdated
@@ Pp.textf
"Unable to solve dependencies while generating lock directory: %s"
(Path.to_string_maybe_quoted path)
; Pp.hovbox (Pp.concat ~sep:Pp.newline (pp_solve_errors_by_platforms errors))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about Pp.newline even though it was around before.

bin/pkg/lock.ml Outdated
@ List.concat_map errors ~f:(fun (path, errors) ->
let messages = Platforms_by_message.all_messages errors in
[ Pp.textf "Lock directory %s:" (Path.to_string_maybe_quoted path)
; Pp.hovbox (Pp.concat ~sep:Pp.newline messages)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@gridbugs gridbugs force-pushed the portable-lockdirs-dedup-errors branch 2 times, most recently from 07870ae to 09e28a2 Compare October 29, 2025 06:35
@Alizter Alizter enabled auto-merge October 29, 2025 12:42
When generating portable lockdirs the solver runs multiple times. Dune
collects any errors from the solver and prints them to the terminal in
the event that no solution was found on any platforms, and logs them
printing a warning if no solution was found on some but not all
platforms. This can create a situation where the same error is printed
multiple times, since many solver errors are platform agnostic.

This change groups solver errors by the contents of their message when
generating portable lockdirs. Each solver error is printed a single
time, along with the list of platforms on which it occurred.

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
@Alizter Alizter force-pushed the portable-lockdirs-dedup-errors branch from 09e28a2 to 25af255 Compare October 29, 2025 12:42
@Alizter Alizter merged commit 56d6850 into ocaml:main Oct 29, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants