RFC-027: Live semantic resolution (LSP-assisted incremental Phase B) - #795
Open
Abhishek5517 wants to merge 2 commits into
Open
RFC-027: Live semantic resolution (LSP-assisted incremental Phase B)#795Abhishek5517 wants to merge 2 commits into
Abhishek5517 wants to merge 2 commits into
Conversation
…se B) Draft RFC proposing a live semantic resolution lane that closes the between-commits "mid-edit degradation" gap without regressing the commit-gated Phase B guarantee. Core model is a strict separation of responsibilities: Tree-sitter detects a reference exists SCIP graph owns node identity (Kythe VName) LSP disambiguates a specific position (surgical, optional) Commit SCIP ratifies the region and heals drift LSP is used only as a disambiguation oracle over SCIP-identified candidates, never as a symbol/identity source. The lane is precision-first and fail-closed: it emits an edge only when resolution is provably correct and abstains (marks the reference pending) otherwise. When no language server is present the system degrades to today's commit-gated behavior with zero regression. Includes an inline mermaid sequence diagram covering the live path and the commit ratification path, the reverse-dependency closure invalidation model, the ADR-009 Rule 4 fencing rule (live edges never enter the bridge registry), the Invariant #4 convergence property, and a continuous precision meter that diffs live edges against SCIP truth at each commit.
Benchmark comparison (master → PR)Threshold: p95 regression ≥ +10% fails this check. |
…harden convergence Applies the flagged PR-review fixes, all doc-only: - Fix ADR-002 citation: the provenance-tag requirement is Rule 1 (provenance NOT NULL column), not Rule 5 (SQL upsert logic). Corrected in section 4 and section 9.1. - Note the de-facto provenance enum in the shipped store (tree-sitter/lsif/scip) already diverged from ADR-002's written value list (tree-sitter/lsif/merged); live extends the de-facto set. - Rename the proposed reference field resolution_state to ref_resolution_state to avoid colliding with the daemon's existing record_dart_resolution_state bookkeeping (unrelated Dart concept). - Replace the phantom project_phase_b_commit_gated_decision citation with the real source: the commit-gated comments in travsr-daemon. - Harden the section 8.3 convergence flow against the delete-old / insert-new transient-gap hazard (review-ask 1): insert SCIP first (it wins by ADR-002 precedence), then delete leftover live edges, all in one WAL transaction. Sequence diagram updated to match. - Answer review-ask 3 in section 16.4: the edges table already carries a confidence column, so graded confidence can ride that field without touching the boolean provenance enum.
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.
Closes #794.
What this is
Draft RFC-027, proposing a live semantic resolution lane that closes the between-commits "mid-edit degradation" gap without regressing the commit-gated Phase B guarantee. Documentation only; no code changes.
File:
docs/rfcs/RFC-027-live-semantic-resolution.mdWhy
Phase B (SCIP) is commit-gated by deliberate decision, so between commits only Tree-sitter updates the graph. It sees that a reference exists but not which symbol it resolves to, so
get_callers,get_blast_radius, andfind_referencesdegrade on the exact code being edited. This was hit repeatedly while dogfooding Travsr on itself.The model
A strict separation of responsibilities:
LSP is used only as a disambiguation oracle over SCIP-identified candidates, never as a symbol or identity source. This is the key distinction from earlier LSP proposals that failed on identity: SCIP already gives every node a stable VName, so LSP is asked for a location, and SCIP owns location-to-node. When no server is present, behavior is exactly today's commit-gated path (zero regression).
What the RFC covers
location_to_node(current Tree-sitter spans for dirty files, SCIP ranges for clean).liveprovenance value (ADR-002 Rule 1) and aref_resolution_statefor pending references.live_overlayfreshness note; no new tool).Correctness guarantees (the load-bearing ones)
pending, never as a fabricated edge.liveedge is deleted and replaced by SCIP at commit, so the committed graph contains no live edges.Revisions since first push (commit f9d1d62)
Before sending this out for the sign-off reviews below, I fact-checked the draft's own citations against the codebase and the referenced ADRs/RFCs and tightened a few things. No external review yet; these are author corrections. All doc-only:
provenance NOT NULLcolumn), not Rule 5 (which is the SQL-upsert rule). Fixed in section 4 and section 9.1.tree-sitter/lsif/scip) already diverged from ADR-002's originally written list (tree-sitter/lsif/merged);liveextends the de-facto set and does not reinstatemerged.resolution_stateis renamedref_resolution_stateto avoid colliding with the daemon's existingrecord_dart_resolution_statebookkeeping (an unrelated Dart Phase B concept).project_phase_b_commit_gated_decisionwas not a real artifact; section 2.2 now cites the real source, the commit-gated comments intravsr-daemon/src/lib.rs. (The commit-gated premise itself is confirmed in that code.)liveedges, all in one WAL transaction, closing the transient-gap window. The sequence diagram is updated to match.edgestable already carries aconfidencecolumn, so graded confidence can ride that field without touching the booleanprovenanceenum.Status
Draft. Not for merge-to-ship of behavior; this PR lands the design doc for review. Sign-offs required before the RFC moves to Accepted: Principal Architect (schema + convergence proof), Principal Security Engineer (spawn path + IDE-piggyback trust), Solution Architect (MCP surface).