fix: bind broker requests and diagnostics to source snapshots - #254
Draft
ejgallego wants to merge 3 commits into
Draft
fix: bind broker requests and diagnostics to source snapshots#254ejgallego wants to merge 3 commits into
ejgallego wants to merge 3 commits into
Conversation
This PR prevents stale requests from succeeding against replacement documents after refresh, close/reopen, backend restart, or workspace recreation. Public requests now round-trip an opaque snapshot token from update or sync, and pending document results are rejected if their source snapshot has changed. Replace numeric version arguments with snapshot strings across the wrapper, MCP, sync/save results, diagnostics, and open-file reporting. Allocate fresh internal document revisions within each backend session and keep completed request progress from overwriting a replacement document. Require reading the current source and resolving the intended target again before retrying contentModified failures.
Reject a completed sync barrier when its document was edited, closed, or reopened while the backend response was pending. Share the current-document check with probe completion so validation and state updates happen under the same lock. Filter diagnostic publications by the tracked document revision and include snapshot identity in stream deduplication. Cover stale completions and diagnostic observations with deterministic fixtures, and make the macOS fixture path and foreground startup checks respect their actual boundaries.
Consolidate document and position records, parsing, and broker conversion while preserving the flat wrapper and MCP interfaces. Remove unused default values and redundant token checks, and keep native request revisions tied to the accepted document. Clarify source tokens versus elaboration snapshots, link the canonical recovery contract, and replace shell token placeholders with explicit extraction and quoted variables.
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.
This PR prevents stale requests and diagnostics from being accepted for replacement documents after refresh, close/reopen, backend restart, or workspace recreation. Public requests round-trip an opaque source snapshot token, and document requests and sync barriers reject results whose tracked source has changed.
versionarguments and result fields with opaquesnapshotstrings across the wrapper and MCP. Clients must pass the exact token returned by update or sync; numeric fields are removed.contentModified, require reading the current source and resolving the intended target again before retrying with a fresh token.