fix(lsp-gate): lint-tagged diagnostics never fail a stage (#311)

tsserver tags TS6133 (unused import) Unnecessary, but a tsconfig with
noUnusedLocals promotes it to error severity — which hard-failed whole
runs no rewrite could clear. Carry LSP DiagnosticTag through the
LspDiagnostic event and gate on untagged errors only; lint diagnostics
stay recorded and visible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 21:16:33 +04:00
parent c32445b8a8
commit f61864ff1d
4 changed files with 38 additions and 2 deletions
@@ -97,7 +97,9 @@ internal suspend fun SessionOrchestrator.runLspDiagnostics(
sessionId,
LspDiagnosticsCompletedEvent(sessionId, stageId, result.server, diagnostics, result.skippedReason),
)
val errors = diagnostics.filter { it.severity.equals("error", ignoreCase = true) }
// Lint-class diagnostics (unused import, deprecated) are recorded above but never gate: a
// tsconfig with noUnusedLocals promotes them to "error" severity, which no rewrite can clear.
val errors = diagnostics.filter { it.severity.equals("error", ignoreCase = true) && !it.isLint }
if (errors.isEmpty()) return StageExecutionResult.Success(emptyList())
val detail = errors.joinToString("\n") {
"- ${it.path}:${it.line + 1}:${it.character + 1} ${it.code.orEmpty()} ${it.message}".trim()