ID |
|
|---|---|
Status |
Backlog |
Bucket |
test |
Priority |
5 |
Theme |
lsp |
Created |
2026-05-12 |
Updated |
2026-05-12 |
End-to-end LSP publish-diagnostics test and buildOutput report-population test for R147
R147’s spec called for two tests that the implementation deferred:
-
End-to-end LSP test under
graphitron-rewrite/graphitron-lsp/src/test/…that drives a schema throughWorkspace.setBuildOutputand asserts the publishedPublishDiagnosticsParamson the client side carries the expected diagnostic. The currentValidatorDiagnosticsTestexercisesDiagnostics.computedirectly per-call; the wire-shape contract ; thatsetBuildOutput → markAllForRecalculation → drainRecalculate → publishDiagnosticsForRecalculateactually fires aclient.publishDiagnostics(PublishDiagnosticsParams); is unverified. The "empty report clears previous diagnostics" assertion in particular was reduced from "two successivesetBuildOutputcalls produce a non-empty then an emptyPublishDiagnosticsParams.diagnostics`" to "two successive `Diagnostics.computecalls produce non-empty then empty lists"; the wire-level clearing signal isn’t pinned. -
GraphQLRewriteGeneratorTestassertingbuildOutput()populatesBuildOutput.report().errors()and.warnings()end-to-end. The currentValidationReportTestcovers thefrom(…)factory in isolation andValidatorDiagnosticsTestcovers the consumer side, but the producer-side wiring (validator pass +bundle.model().warnings()flow throughbuildOutput) is unverified. Skipped in R147 because drivingbuildOutput()requires a real jOOQ catalog and the existing pipeline tests stop atloadAttributedRegistry.
Failure mode if these tests are skipped permanently: a future refactor breaking the publish path or the warnings-into-report wiring would slip through; the LSP client would silently stop receiving diagnostics, or warnings would disappear from editor squiggles. The build-time log surface stays correct because that path still exists, but the LSP-only regression has no other test gate.
Implementation hooks:
- For the end-to-end LSP test: instantiate a GraphitronTextDocumentService with a captured LanguageClient stub (record publishDiagnostics calls in a List<PublishDiagnosticsParams>), call setClient, drive didOpen then setBuildOutput with a hand-built ValidationReport, and assert the captured params.
- For the buildOutput test: either set up a minimal RewriteContext against the test jOOQ catalog (no.sikt.graphitron.rewrite.test.jooq) or stub JooqCatalog behind a test-only seam. The cheaper option is the test catalog since pipeline tests already wire it.