Skip to content

Migrate TextDocumentSyncHandler onto SymbolSink - #378

Merged
Firehed merged 1 commit into
mainfrom
slice/S2.5
Jul 28, 2026
Merged

Migrate TextDocumentSyncHandler onto SymbolSink#378
Firehed merged 1 commit into
mainfrom
slice/S2.5

Conversation

@Firehed

@Firehed Firehed commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Slice S2.5 — Migrate TextDocumentSyncHandler onto SymbolSink

Slice: S2.5 (docs/architecture/build-manifest.md, Wave 1)
Plan step: docs/architecture/0002-execution-plan.md Step 2 (§5.5 consumer-migration
table, TextDocumentSyncHandler row; §5.2 SymbolSink write interface) — a consumer
migration 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 SymbolSink seam instead of naming the
write-side collaborators directly. TextDocumentSyncHandler previously assembled the
double write itself — parsing the document, registering its class-likes on
ClassRepository, and calling DocumentIndexer — plus removing from both on close.
It now depends on a single SymbolSink and calls openDocument / updateDocument /
closeDocument; the parse, the class registration, and the index write live behind the
DelegatingSymbolSource facade (which has reproduced this exact double write since
S2.1). Server.php wires the one shared facade instance as the sink.

The handler no longer names DocumentIndexer, ClassInfoFactory, ClassRepository,
ParserService, or ScopeFinder; ParserService and the class-registration traversal
leave 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, same DocumentIndexer::index, same close order), so
no observable output changes. The frozen WritePathParityTest golden is unchanged and
green, 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 shared BuildsSymbolSourceTrait, matching
production's one-facade wiring) rather than re-assembling the write collaborators by
hand; CompletionHandlerTest feeds a facade over its real shared SymbolIndex so
opened documents still surface in completion.

Acceptance criteria

  • The document write path (open / change / close) flows through SymbolSink.
  • TextDocumentSyncHandler no longer names DocumentIndexer, ClassInfoFactory,
    or ClassRepository directly (nor ParserService / ScopeFinder).
  • Behavior identical — the WritePathParityTest golden is unchanged and green.
  • Full composer test green.

Candidate closes (pending review verification): none (manifest Closes is ).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.13%. Comparing base (f73e582) to head (bc56f6c).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

@Firehed
Firehed merged commit 3201395 into main Jul 28, 2026
7 checks passed
@Firehed
Firehed deleted the slice/S2.5 branch July 28, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant