Repository navigation
test: make censor disambiguate digests - #14430
Merged
Merged
Conversation
Alizter
requested review from
Leonidas-from-XIV and
rgrinberg
and removed request for
Leonidas-from-XIV
May 5, 2026 14:52
Alizter
force-pushed
the
push-nwnkytqqvovv
branch
3 times, most recently
from
May 5, 2026 18:31
2c01b6f to
bbfa420
Compare
Alizter
marked this pull request as ready for review
May 5, 2026 18:31
Signed-off-by: Ali Caglayan <[email protected]>
This was referenced May 5, 2026
rgrinberg
approved these changes
May 5, 2026
There was a problem hiding this comment.
Pull request overview
This PR consolidates the blackbox test output “censoring” helpers into a single censor pipeline that can normalize paths/digests more robustly, including disambiguating multiple distinct digest occurrences, and updates affected cram expectations and documentation accordingly.
Changes:
- Add a new
dune_cmdsed action/subcommand (subst-unique) to replace each distinct match with a stable, uniquely numbered label when needed. - Replace specialized helpers (
censor_ppx,censor_cinaps,strip_sandbox) with a singlecensorimplementation in the blackbox test setup script. - Update many cram test expectations to reflect disambiguated
$DIGEST1/$DIGEST2/...outputs and the new unified censoring behavior; document it inhacking.rst.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/blackbox-tests/utils/dune_cmd.ml | Introduces Sed.Subst_unique + subst-unique subcommand for disambiguating multiple distinct substitutions. |
| test/blackbox-tests/setup-script.sh | Reworks censor to normalize $PWD, digests, and cinaps paths; removes old helper functions. |
| doc/hacking.rst | Documents the new censor behavior and the $DIGEST1/$DIGEST2/... convention. |
| test/blackbox-tests/test-cases/top-module/load-with-ppx.t | Switches from censor_ppx to unified censor and updates expected paths. |
| test/blackbox-tests/test-cases/pkg/withenv-path.t | Updates PATH expectations to reflect disambiguated digests and new censoring. |
| test/blackbox-tests/test-cases/pkg/portable-lockdirs/portable-lockdirs-platform-dependant-dependencies.t | Updates expected package directory names to use $DIGEST1/$DIGEST2. |
| test/blackbox-tests/test-cases/pkg/opam-var/opam-var-switch.t | Updates sandbox/package path expectations to match new censor output. |
| test/blackbox-tests/test-cases/pkg/dep-section-variables.t | Updates expected sandbox/package paths and removes strip_sandbox usage. |
| test/blackbox-tests/test-cases/pkg/default-exported-env.t | Updates exported env var output expectations using unified censor. |
| test/blackbox-tests/test-cases/pkg/absolute-paths-in-sections.t | Updates expected --prefix outputs to match new censor normalization. |
| test/blackbox-tests/test-cases/merlin/multiple-ppx-stanzas-github1946.t/run.t | Switches to censor and updates expected .ppx/$DIGEST* paths. |
| test/blackbox-tests/test-cases/merlin/merlin-tests.t/run.t | Switches to censor and updates expected absolute paths to $PWD/.... |
| test/blackbox-tests/test-cases/melange/merlin.t | Switches to censor and updates expected .ppx paths. |
| test/blackbox-tests/test-cases/melange/dune | Adds an inline note in enabled_if stanza. |
| test/blackbox-tests/test-cases/dune-cache/trim.t | Updates expected cache DB filenames to use $DIGEST1/$DIGEST2/.... |
| test/blackbox-tests/test-cases/dune-build-info-in-ppx-github3336.t/run.t | Switches to censor for .ppx executable listing. |
| test/blackbox-tests/test-cases/describe/describe.t | Updates many digest placeholders to disambiguated $DIGEST* labels. |
| test/blackbox-tests/test-cases/describe/describe-workspace-pp.t | Updates many digest placeholders to disambiguated $DIGEST* labels. |
| test/blackbox-tests/test-cases/cram/junction-cleanup.t | Uses censor instead of strip_sandbox and updates expected sandbox path text. |
| test/blackbox-tests/test-cases/cinaps/multiple-cinaps.t | Switches to censor and updates expected cinaps path normalization. |
| test/blackbox-tests/test-cases/cinaps/link-flags.t | Switches to censor and updates expected cinaps path normalization. |
Alizter
added a commit
that referenced
this pull request
May 21, 2026
Resolve `%{bin:...}` to the build artifact path (`Original_path`)
instead of the install staging area. When `%{bin:...}` appears in `(deps
...)`, a bin-layout directory is created under
`_build/install/<context>/.binaries/<digest>/` with correctly-named
symlinks, and added to `PATH`.
The legacy staging paths (`_build/install/default/bin`, `lib`, etc.)
remain on the root env for now. They cannot be removed until `(deps
(package ...))` provides its own scoped layout (the install-layout PR
#14373), since actions using `(package ...)` deps still rely on the
staging area for `PATH` and `OCAMLPATH` visibility.
Env binaries (from `(env (binaries ...))`) are excluded from the
bin-layout since they already use `.bin/` on `PATH`.
`Dep_conf_eval.unnamed` and `Dep_conf_eval.named` now return a single
`Env.t Action_builder.t` whose evaluation both registers deps and
produces the env (previously a tuple with a separate `unit
Action_builder.t` for deps registration). Build-tracking-only callers
(`lib_flags`, `simple_rules`) discard the env via
`Action_builder.ignore`.
`(include FILE)` inside `(deps ...)` propagates the recursive call's
`bin_env` via a new `Include_result` variant on `dep_evaluation_result`;
`named_paths_builder` folds the include `bin_env`s into the final
`bin_env` via `Env_path.extend_env_concat_path`. Without this, the
action's `PATH` would not get a bin-layout dir for include-d bin pforms.
The change is not gated by lang version: #3324 affects every lang
version, so gating would leave the bug unfixed for pre-3.24 projects.
The user-visible realignments are confined to in-`_build` paths and the
migration cost is small enough to not warrant a per-project opt-in.
- Fixes #3324
- Depends on #14430 (merged)
- Depends on #14431 (merged)
- [x] changelog
- [x] documentation
## Known limitations (deferred to follow-up)
- dune's sandbox does not relocate the `PATH` environment variable. The
bin-layout dir on `PATH` points at the un-sandboxed `_build/`. This
works locally because absolute paths are still readable from inside the
sandbox, but would break under remote action execution. Tracked by
`test/blackbox-tests/test-cases/bin-pform/sandbox.t`.
- `Bin_layout.Key.reverse_table` grows unboundedly in long-running
`--watch` sessions (one entry per unique sorted bin set). Pattern
inherited from `Ppx_driver.Key`. Bounded by the number of distinct bin
sets the workspace evaluates; unlikely to be a real problem.
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.
We cleanup all our
censor-style helpers into a single one that works for all cases and disambiguates between distinct matches.This reveals some erroneous censorship that we have partaken in with various tests.