Sub-issue of #12230. Latent bug discovered while tracing through the
RPC dispatch sites.
When a watch server is running and a client invokes
dune build <target> from a subdirectory, the target name is sent
verbatim over RPC. The server resolves it via its own
reach_from_root_prefix (anchored at the workspace root), so a target
the user typed relative to their own cwd is misresolved. Symptom:
Error: Don't know how to build <target> even though the target is
present relative to the user's cwd.
The RPC protocol does not carry the client's cwd, so any command that
takes path-like positional arguments and runs over RPC has this shape
of bug. See sibling issues for the dune runtest and dune fmt
variants.
Fix direction is open to discussion: client-side resolution before
sending (analogous to runtest), or extending the RPC request to carry
the client's cwd so the server can resolve correctly. For dune build
the choice is less obvious than for runtest because targets are not
plain files — variable expansion (%{...}) interacts with the cwd in
ways that need to be decided before any code change.
Sub-issue of #12230. Latent bug discovered while tracing through the
RPC dispatch sites.
When a watch server is running and a client invokes
dune build <target>from a subdirectory, the target name is sentverbatim over RPC. The server resolves it via its own
reach_from_root_prefix(anchored at the workspace root), so a targetthe user typed relative to their own cwd is misresolved. Symptom:
Error: Don't know how to build <target>even though the target ispresent relative to the user's cwd.
The RPC protocol does not carry the client's cwd, so any command that
takes path-like positional arguments and runs over RPC has this shape
of bug. See sibling issues for the
dune runtestanddune fmtvariants.
Fix direction is open to discussion: client-side resolution before
sending (analogous to runtest), or extending the RPC request to carry
the client's cwd so the server can resolve correctly. For
dune buildthe choice is less obvious than for runtest because targets are not
plain files — variable expansion (
%{...}) interacts with the cwd inways that need to be decided before any code change.