Repository navigation
Conversation
An overlay that covers a file hides every stored edge recorded there, and the file's re-parse holds its calls as unresolved references until relations are rebuilt. Reading an edited file through an overlay would therefore drop the edited function's callees and remove it from the callers of everything it calls, although none of those calls changed. CarryBaseEdges returns copies of the stored call edges whose source still calls the same target name in the re-parse, at the new call's line and marked with the new Edge.Provisional flag. Repeated calls pair up in line order, and a call the edit removed is not carried. Provisional is never persisted and stays out of the edge identity, like NameOnly, so the wire-contract fingerprint and the delta writer's field count record it as an in-memory field. Refs #1014
A read that finds a file drifted from the index has to tell a tracked file apart from one an editor or git created after indexing, and a tracked file missing on disk apart from an untracked one. The existing helpers fold an untracked path into "fresh" and stat the file to do it. IsTracked answers from the recorded mtimes alone. Refs #1014
Five read handlers refresh a drifted file by reindexing it synchronously, with no deadline, repeating the watcher's work for the same file and waiting behind the edit pipeline. Before reads go through pending edits instead, list every read tool whose handler can reach reindexFile, IncrementalReindexRepo or IncrementalReindexPaths. The guard builds a reference graph of the package's non-test files, follows each read tool's registered handler through it and reports the shortest chain to a reindex. It only reports for now and becomes a gate once read handlers stop reindexing; a fixture shows it catches a read handler that reindexes through a helper. Refs #1014
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.
Draft, partial. Groundwork for reads that go through pending edits instead of reindexing (#1014). No handler changes behaviour yet: the wiring waits for the pending-edit projection (#1011).
Changes
internal/graph/overlay.go,internal/graph/edge.go). An overlay that covers a file hides every stored edge recorded there, and the file's re-parse holds its calls as unresolved references until relations are rebuilt. Reading an edited file through an overlay would therefore drop the edited function's callees and remove it from the callers of everything it calls, although none of those calls changed.CarryBaseEdgesreturns copies of the stored call edges whose source still calls the same target name in the re-parse. Each copy sits at the new call's line and carries the newEdge.Provisionalflag.Provisionalis never persisted and stays out of the edge identity, likeNameOnly. The wire-contract fingerprint forgraph.Edgeand the delta writer's field count record it as an in-memory field.IsTracked(internal/indexer/tracked.go). A read that finds a file drifted from the index has to tell a tracked file from one an editor or git created after indexing, and a tracked file missing on disk from an untracked one. The existing helpers fold an untracked path into "fresh" and stat the file to do it.IsTrackedanswers from the recorded mtimes alone.internal/mcp/read_path_guard_test.go, report mode). It builds a reference graph of the package's non-test files, follows each read tool's registered handler, and reports the shortest chain toreindexFile,IncrementalReindexRepoorIncrementalReindexPaths. A read tool is one the daemon does not mark effectful, the same table that drives the MCPreadOnlyHint. Today it reports five handlers, all throughensureFresh:get_cfg,get_editing_context,get_file_summary,get_symbolandget_symbol_source. A fixture shows it catches a read handler that reindexes through a helper. It becomes a failing gate once read handlers stop reindexing.Status
IsTracked, and the guard in report mode.ensureFreshfrom the five read handlers;Tests
-race:TestIsTracked,TestCarryBaseEdgesKeepsEditedCallerRelations,TestReadHandlersNeverReachReindex, and the existingTestOverlay*tests in graph, indexer and mcp pass.go vetpasses, and golangci-lint 2.14.0 on graph, indexer and mcp reports 0 issues.Edge has 17 fields; deltaEdgeContentEqual accounts for 16). The fix is in the carry commit, and theTestDelta*,TestOverlay*,TestEdge*and carry tests then pass under-race.graph.Edgewire-contract fingerprint stale.TestWireContractFingerprint/graph.Edgefails without the fix. At this head it passes, along with the graph field-count and carry tests, and golangci-lint on./cmd/gortex/...reports 0 issues.The branch is based on 017db84 and merges cleanly with main at 7096db7.
Refs #1014