test: dune fmt RPC ignores client cwd (#15107)#15120
Draft
Alizter wants to merge 1 commit into
Draft
Conversation
13 tasks
ffcf331 to
dbfd8af
Compare
3619cb6 to
fa2473b
Compare
Adds a cram test demonstrating that when a client invokes `dune fmt` from a subdirectory while a watch server is running, the request sent over RPC carries no cwd information: the server re-issues the build as `Alias_rec "fmt"` at its own workspace root and formats whatever is reachable from there, not just the user's subdirectory. Custom rules under @fmt in two distinct directories let us observe which ones get built. Local sanity check: only the subdir rule fires. RPC: both rules fire — the bug. Unlike the runtest RPC test, this one cannot use `--root` because `--root` forces to_cwd = [] (bin/workspace_root.ml:91), which masks the mismatch by also flattening the local scope. We use walk-up workspace discovery (unset INSIDE_DUNE) anchored by a dune-workspace file so the discovery does not escape the cram sandbox. A CR-someday in the test flags the --root + to_cwd question for separate investigation. Tracks ocaml#15107 (sub-issue of ocaml#12230). Recorded with CR-someday Alizter for the follow-up fix that extends the RPC fmt request to carry the client's cwd. Signed-off-by: Ali Caglayan <alizter@gmail.com>
fa2473b to
f0d1463
Compare
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.
Reproduction case for #15107. When a watch server is running and a client invokes
dune fmtfrom a subdirectory, the request carries no cwd information: the server formats everything reachable from its own workspace root rather than scoping to the user's subdirectory.