Migrate TextDocumentSyncHandler onto SymbolSink - #378
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #378 +/- ##
============================================
- Coverage 98.14% 98.13% -0.01%
+ Complexity 1712 1707 -5
============================================
Files 107 107
Lines 4310 4297 -13
============================================
- Hits 4230 4217 -13
Misses 80 80 ☔ View full report in Codecov by Harness. |
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.
Slice S2.5 — Migrate
TextDocumentSyncHandlerontoSymbolSinkSlice: S2.5 (
docs/architecture/build-manifest.md, Wave 1)Plan step:
docs/architecture/0002-execution-plan.mdStep 2 (§5.5 consumer-migrationtable,
TextDocumentSyncHandlerrow; §5.2SymbolSinkwrite interface) — a consumermigration onto the S2.1 seam, no behavior change.
Depends on: S2.1 (
SymbolSource/SymbolSink+ delegating facade, #374) — merged.RFC sections: 0001 §4.2 (Symbol Discovery Authority), §4.3 (one write path for
symbol state), §5.2.
Routes the document write path through the
SymbolSinkseam instead of naming thewrite-side collaborators directly.
TextDocumentSyncHandlerpreviously assembled thedouble write itself — parsing the document, registering its class-likes on
ClassRepository, and callingDocumentIndexer— plus removing from both on close.It now depends on a single
SymbolSinkand callsopenDocument/updateDocument/closeDocument; the parse, the class registration, and the index write live behind theDelegatingSymbolSourcefacade (which has reproduced this exact double write sinceS2.1).
Server.phpwires the one shared facade instance as the sink.The handler no longer names
DocumentIndexer,ClassInfoFactory,ClassRepository,ParserService, orScopeFinder;ParserServiceand the class-registration traversalleave the handler entirely (they already exist inside the facade).
Behavior preservation
The facade's write path is byte-for-byte the handler's old one (same parse, same
ClassRepository::updateDocument, sameDocumentIndexer::index, same close order), sono observable output changes. The frozen
WritePathParityTestgolden is unchanged andgreen, and the full sync-handler suite — which pins class registration on open/change,
class replacement on change, class removal on close, and the Step-0 single-parse
invariant — stays green against the migrated handler.
Test wiring for the five downstream suites that also construct the sync handler now
feeds it a
DelegatingSymbolSource(via the sharedBuildsSymbolSourceTrait, matchingproduction's one-facade wiring) rather than re-assembling the write collaborators by
hand;
CompletionHandlerTestfeeds a facade over its real sharedSymbolIndexsoopened documents still surface in completion.
Acceptance criteria
SymbolSink.TextDocumentSyncHandlerno longer namesDocumentIndexer,ClassInfoFactory,or
ClassRepositorydirectly (norParserService/ScopeFinder).WritePathParityTestgolden is unchanged and green.composer testgreen.Candidate closes (pending review verification): none (manifest
Closesis—).🤖 Generated with Claude Code