feat: dune shell for debugging rules - #15597
Draft
Alizter wants to merge 1 commit into
Draft
Conversation
Add `dune shell TARGET` to prepare the rule producing TARGET up to its action boundary, then open an interactive shell in the action execution directory and environment. Preserve the selected sandbox and keep the initiating build and its locks alive for the session. A command after `--` runs non-interactively in the same prepared environment. Expose the expanded action as an editable file and provide `run` and `dune-run` helpers to replay it through the Dune action interpreter without rebuilding dependencies or applying normal build post-processing such as caching, promotion, sandbox extraction, or patch-back. Preserve direct process metadata and raw exit statuses for debugging tools and scripts. Document the sandbox and replay semantics in the interactive help. Reject aliases, dynamic and concurrent actions, universe dependencies, action extensions, patch-back rules, external action runners, watch mode, and native Windows until faithful session semantics are defined for them. Signed-off-by: Ali Caglayan <alizter@gmail.com>
dune shell for debugging rule actions
Alizter
marked this pull request as draft
July 24, 2026 17:44
dune shell for debugging rule actions
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.
Intro
Suppose I was interested in the linking step for the dune binary:
If the rule was sandboxed, the interactive shell starts there:
Here
runis a shell script wrapping a way for dune to run the action of the rule to check its performance etc.Summary
dune shell TARGETto open an interactive shell or run a command at a prepared rule action boundaryrunanddune-runreplay helpersTesting
./dune.exe build @check @fmt./dune.exe runtest test/blackbox-tests/test-cases/dune-shellCloses #3961