Skip to content

Conversation

@MixiMaxiMouse
Copy link
Contributor

This PR introduces a new subcommand dune promotion show that lets users
view the corrected contents of files ready for promotion without modifying
them.

It also adds a blackbox test verifying key behaviors:

  • Displays corrected contents for failed diff rules
  • Handles multiple and missing files gracefully
  • Ensures source files remain unchanged
  • Produces appropriate warnings for non-promotable files

Fixes #3883

@rgrinberg
Copy link
Member

@ElectreAAS do you want to try reviewing this one?

Copy link
Collaborator

@ElectreAAS ElectreAAS left a comment

Choose a reason for hiding this comment

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

This is great!
My only question was: didn't we already have this? isn't this supposed to be what dune promotion diff does?
well apparently not
thanks :)

@Alizter Alizter requested a review from rgrinberg November 12, 2025 12:22
@rgrinberg
Copy link
Member

I'll let @ElectreAAS review or merge this one.

@rgrinberg rgrinberg removed their request for review November 12, 2025 13:45
@ElectreAAS ElectreAAS force-pushed the feat/add-promotion-show-command branch from 218c6ea to 17be9be Compare November 17, 2025 18:28
@ElectreAAS
Copy link
Collaborator

I just rebased on main and apparently fucked up something with Github, don't worry I'm on it ;)

@ElectreAAS ElectreAAS force-pushed the feat/add-promotion-show-command branch from 17be9be to a9b7a5c Compare November 17, 2025 18:53
@ElectreAAS
Copy link
Collaborator

Also as this is user-facing, a changes entry would be nice

@Alizter
Copy link
Collaborator

Alizter commented Nov 19, 2025

Fiber.sequential_iter will preserve the order. (sorry I didn't mention this sooner)

@ElectreAAS ElectreAAS enabled auto-merge (squash) November 26, 2025 09:38
Maxence Maury and others added 5 commits November 26, 2025 10:38
Implements a new command to display corrected file contents
without applying the promotion. Users can now view what the
promoted file would look like before deciding to promote.

- Added 'show' subcommand to bin/promotion.ml
- Exposed correction_file function in src/promote/diff_promotion.mli

Tests still need to be added.

Fixes ocaml#3883

Signed-off-by: Maxence Maury <[email protected]>
Add a new blackbox test to verify the behavior of the
'dune promotion show' command. The test covers common
use cases and edge cases to make sure the command works
as intended and doesn’t modify source files.

It checks that:
- corrected files are displayed after failed diffs
- multiple files and missing promotions are handled properly
- warnings appear for non-promotable or missing files
- source files stay untouched after showing their content

Signed-off-by: Maxence Maury <[email protected]>
Signed-off-by: Ambre Austen Suhamy <[email protected]>
@ElectreAAS ElectreAAS force-pushed the feat/add-promotion-show-command branch from 0761581 to da65ac6 Compare November 26, 2025 09:38
@ElectreAAS ElectreAAS merged commit 8bea914 into ocaml:main Nov 26, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dune command to get the contents of a "corrected" file

4 participants