fix(dune): reconcile promotions by diagnostic - #2089
Open
rgrinberg wants to merge 1 commit into
Open
Conversation
rgrinberg
force-pushed
the
push-urspztqutuvq
branch
from
August 2, 2026 14:10
9a55f3d to
8c4f762
Compare
rgrinberg
force-pushed
the
push-urspztqutuvq
branch
4 times, most recently
from
August 4, 2026 20:43
ea8c9a6 to
c5071e8
Compare
Use the tracker for Dune diagnostic batches and reconcile registrations from the batch endpoints so diagnostics sharing a source keep one balanced dynamic registration. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
rgrinberg
force-pushed
the
push-urspztqutuvq
branch
from
August 6, 2026 11:32
c5071e8 to
45075f3
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.
Dune attaches promotion metadata to individual diagnostics, but the server currently stores promotions only in a map keyed by source path. When two rules produce diagnostics that promote the same source, inserting the second promotion hits an assertion, aborts the whole diagnostic batch, and disconnects that Dune instance. #2087 records the resulting missing diagnostics, registration, and code action.
Introduce a promotion tracker that retains promotions by diagnostic identity while deriving the active source-path map used by code actions and cleanup. Each diagnostic batch is applied to the tracker first, then its previous and final active source sets are compared. A capability is registered when the first diagnostic for a source appears and unregistered only when the last one disappears, avoiding duplicate registrations and premature unregistration when diagnostics overlap.
With this reconciliation, both diagnostics are published without internal errors while the client receives one balanced promotion registration and one promotion code action.