Skip to content

test: dune fmt RPC ignores client cwd (#15107)#15120

Draft
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-qwoxmynwrxnu
Draft

test: dune fmt RPC ignores client cwd (#15107)#15120
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-qwoxmynwrxnu

Conversation

@Alizter

@Alizter Alizter commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Reproduction case for #15107. When a watch server is running and a client invokes dune fmt from 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.

@Alizter Alizter added test-suite rpc Dune's RPC server and client support labels Jun 10, 2026
@Alizter Alizter self-assigned this Jun 10, 2026
@Alizter Alizter force-pushed the push-qwoxmynwrxnu branch from ffcf331 to dbfd8af Compare June 10, 2026 17:12
@Alizter Alizter changed the title test: dune fmt RPC ignores client cwd test: dune fmt RPC ignores client cwd (#15107) Jun 10, 2026
@Alizter Alizter force-pushed the push-qwoxmynwrxnu branch 3 times, most recently from 3619cb6 to fa2473b Compare June 10, 2026 22:15
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>
@Alizter Alizter force-pushed the push-qwoxmynwrxnu branch from fa2473b to f0d1463 Compare June 26, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rpc Dune's RPC server and client support test-suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant