Skip to content

feat(rpc): Show the progress when building over RPCs. - #16819

Merged
mefyl merged 7 commits into
mainfrom
feat/rpc-client-progress
Oct 30, 2026
Merged

mefyl merged 7 commits into
mainfrom
feat/rpc-client-progress

Conversation

@mefyl

@mefyl mefyl commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When building over RPCs, display progress via the existing dune monitor polling.

Example status line output:

Connected to RPC server | Done: 94% (89/94, 5 left)

Related Issue and Motivation

When using passive watch mode, building will properly report the end result, but shows no progress. On longer builds taking minutes, this leaves dune build staring at you silently for what is, IMO, an uncomfortable time. I often end up going to the dune watch output terminal/buffer to check progress.

There is a slight misfeature were, in a pathological case, we could display the very end of the previous build right before it is canceled. We do send the build request first to mitigate that as much as possible, but it is possible that a progress flashes before we display "restarting current build" and the new progress. I did not find a fix simple enough to justify the change, given how non critical this issue seems to be.

Checklist

  • Tests added, if applicable.
  • Change log entry added for any user-facing changes.
  • Documentation added for any user-facing changes.

@mefyl
mefyl requested review from Alizter and rgrinberg October 28, 2026 09:23
@mefyl mefyl self-assigned this Oct 28, 2026
@mefyl
mefyl marked this pull request as draft October 28, 2026 09:23
@mefyl
mefyl force-pushed the feat/rpc-client-progress branch from 47002e9 to bcb8a81 Compare October 28, 2026 09:26
Signed-off-by: mefyl <quentin@tarides.com>
@mefyl
mefyl force-pushed the feat/rpc-client-progress branch from bcb8a81 to f8c93b2 Compare October 28, 2026 09:31
@mefyl
mefyl marked this pull request as ready for review October 28, 2026 09:38
@mefyl
mefyl added this pull request to stack #16821 October 28, 2026 09:43
@Alizter

Alizter commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

The main disadvantage of subscribing to the global count is that it will show unrelated progress on a busy server. For an exaggerated example, consider the main build server currently busy with running some long jobs like some tests. If a client requests a target to be built, it will join the current build, merging their progress. The client may however get a reply that their build is finished before the entire progress finishes.

See the rpc-build-concurrent-finish.t test for such an example.

I've experimented in the past with having per-requests progress reporting that would give the client a more accurate progress. You can see a recently rebased branch here https://github.com/Alizter/dune/tree/prototype/rpc-request-progress

This was just an experiment on my part and I didn't have any near-term plans to finish off this idea. But it may give you some ideas on how you can solve some of the problems that you have encountered.

@rgrinberg rgrinberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disregarding the caveats already mentioned, I think we should try to keep the display code as centralized as possible to avoid UI drift in the various build reporting code.

Comment thread bin/rpc/rpc_common.ml Resolved
Comment thread bin/rpc/rpc_common.ml Resolved

@rgrinberg rgrinberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to approve this on agreement on the following:

  1. We'd like to consolidate the display code so that we don't have to chase various ends of the code base to update things. This is a thing we'd like to be easy to iterate and improve

  2. We accept the limitation that progress is shared.

  3. Stick to dense, informative data in the status line. Telling that goals are shared isn't all that helpful or actionable. The number of active goals is sufficient.

@mefyl

mefyl commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

The main disadvantage of subscribing to the global count is that it will show unrelated progress on a busy server.

Good point. Solving this the 100% correct way by attributing each rule to the target(s) it contributes to seems indeed like a big endeavor, if doable at all without impacting performances too much.

May I suggest this compromise, until we assess whether your work can give us the perfect number: if multiple goals are being built, we still display the total progress but indicate that it's shared:

Connected to RPC server | Done: 94% (89/94, 5 left) | shared with 1 other build

I think it achieves most of the feature with almost none of the complexity:

  • In a basic setup without concurrent builds it just works (ngl it's 95% of my own usage so I'm mainly dogfooding here).
  • With concurrent builds, it might not even be too far off if both goals depend on the main library / executable. Iow the error may be marginal.
  • Even if it is way off, I can at least see something moving and check it's making progress instead of being faced with complete silence that leaves me wondering whether it's stuck.

All in all I feel like reporting the progress with the limitation that we may aggregate it with another build is better than not reporting anything.

Signed-off-by: mefyl <quentin@tarides.com>
@mefyl

mefyl commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Following the discussions, this PR evolved into:

  • Add the number of goals in the status line (if > 1)
  • When building over RPCs, display the same status line as the server. This does not necessarily correspond to the goal we're targeting over this RPC, but this limitation is accepted for now.

The work by @Alizter could make this output better in the future by showing only the progress for the current goal.

@rgrinberg

Copy link
Copy Markdown
Member

To clarify one more thing: the fact that RPC and regular build display should match is not a hard rule. It's just that differences should be clearly motivated as to why is something is only appropriate for one and not the other. Even with this mind, I would still prefer if the entire UX component was consolidated into one place and we handled the differences via conditionals in this component.

@mefyl
mefyl force-pushed the feat/rpc-client-progress branch from fbcd7b6 to 1c2f4c5 Compare October 29, 2026 15:45
mefyl added 2 commits October 30, 2026 10:34
…goals.

Signed-off-by: mefyl <quentin@tarides.com>
Signed-off-by: mefyl <quentin@tarides.com>
@mefyl
mefyl force-pushed the feat/rpc-client-progress branch from 1c2f4c5 to 77f17a2 Compare October 30, 2026 09:35
mefyl added 2 commits October 30, 2026 11:30
Signed-off-by: mefyl <quentin@tarides.com>
RPCs round floats to 12 significant digits, so the build start time may be
rounded by up to 5ms in the future, which can cause an initial build time of
-5ms to be displayed. An imprecision of 5ms is not important for this
informative data, so just clamp it to 0 so it does not look weird.

Signed-off-by: mefyl <quentin@tarides.com>
@mefyl
mefyl merged commit 46944f6 into main Oct 30, 2026
37 checks passed
@mefyl
mefyl deleted the feat/rpc-client-progress branch October 30, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants