fix(promote): exit 0 for auto-promote-only failures#15448
Open
Alizter wants to merge 1 commit into
Open
Conversation
Signed-off-by: Ali Caglayan <alizter@gmail.com>
f7f5b6f to
fbf6d22
Compare
rgrinberg
reviewed
Jul 9, 2026
| let run_change loc ~patch_back ~will_promote (mode : Diff.Mode.t) = function | ||
| | Message { source_file; messages } -> | ||
| User_error.raise | ||
| ?promotion:(Option.some_if will_promote (promotion source_file)) |
Member
There was a problem hiding this comment.
Is it intentional that we're changing an error message? Why do we need to do that?
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.
Description
Teach the build error collection path to distinguish promotion-only failures from real build failures when auto-promotion is enabled.
Diff actions still report errors internally so their diagnostics are printed, but if every collected error is an auto-promoted diff, the CLI exits successfully after finalizing the promotions. Non-promotable diffs and real build/action failures continue to exit non-zero.
The result-producing build path remains conservative: if a command such as
dune exec --auto-promotepromotes a dependency diff before producing its requested result, it still exits non-zero for that run and succeeds after the next run reaches a fixpoint.Related Issue and Motivation
dune build --auto-promoteand commands such asdune fmtcould successfully promote generated changes while still exiting with status 1, forcing callers to wrap them in|| true.This keeps successful auto-promotion distinct from actual failures, including formatter failures such as
ocamlformatbeing unable to parse a source file.Fixes #785
Checklist