Skip to content

feat: carry diagnostic severity and codes through collected-error channel - #141

Closed
jonkwheeler wants to merge 4 commits into
tsrx-org:mainfrom
jonkwheeler:feat/diagnostic-code-propagation
Closed

jonkwheeler wants to merge 4 commits into
tsrx-org:mainfrom
jonkwheeler:feat/diagnostic-code-propagation

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Carries diagnostic severity and codes through the collected-error channel end to end, so consumer compilers (e.g. Octane's <style> diagnostics) can publish warning-severity findings and have them reach every surface with their code intact.

  • CompileError gains an optional severity: 'error' | 'warning' (absent = error); error() accepts it as a trailing parameter.
  • tsrx-tsc prints collected diagnostics in tsc convention — [tsrx-tsc] file(line,col): <error|warning> <code>: message — instead of dropping code.
  • A fatal .tsrx compile failure under tsrx-tsc emits a valid stub module so sibling files keep their semantic diagnostics; the raw-source fallback stays editor-only.
  • The language server's compile-diagnostic plugin maps severity: 'warning' to real editor warnings.
  • Pins the literal-key class-map emit contract: unknown keys reject same-module and cross-module (TS2339/TS2551); non-class-map apply targets reject through the synthesized $class read.

Downstream consumer: octanejs/octane#1195 (typed native styling — warning-severity findings like octane-css-unused-selector and octane-style-token-contract-unresolved need this transport to reach the editor).

Validation

  • vitest --project tsrx-utils — 630 tests pass (incl. new errors.test.js, style-class-types.test.js emit pins)
  • vitest --project typescript-plugin --project language-server — 250 tests pass (incl. new tsc-error-logging.test.js, compileErrorDiagnosticPlugin.test.js)
  • prettier --check clean on all touched files
  • Changeset: patch bumps for @tsrx/core, @tsrx/typescript-plugin, @tsrx/language-server

Follow-ups

  • After publish, octane's catalog bump to the new @tsrx/* versions lands separately.

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Changes tsrx-tsc exit semantics and compile-failure stubbing, which affects CI and multi-file typecheck behavior; diagnostic severity is new public API on CompileError.

Overview
Extends the collected-error pipeline so consumer compilers can emit warnings (with stable codes) that show up correctly in the editor and CLI.

CompileError / error() gain optional severity: 'error' | 'warning' (missing means error). The language-server compile-error plugin maps 'warning' to real LSP warnings instead of errors.

tsrx-tsc logs collected diagnostics in tsc-style lines — [tsrx-tsc] file(line,col): <error|warning> <code>: message — and tracks error-severity prints so the process still exits nonzero when a fatal .tsrx compile fails even though the broken file is stubbed to export {}. That stub (CLI-only) replaces feeding raw TSRX as generated TSX, so sibling files keep their semantic diagnostics; editors still get the raw-source fallback for squiggles.

Also adds/extends tests for severity passthrough, CLI logging, stub behavior, and pins class-map typecheck behavior (unknown keys, cross-module apply targets).

Reviewed by Cursor Bugbot for commit fb5d4dd. Bugbot is set up for automated code reviews on this repo. Configure here.

…nnel

CompileError gains an optional severity ('error' | 'warning') so consumer
compilers can publish warning-severity diagnostics; error() accepts it as
a trailing parameter. tsrx-tsc now prints collected diagnostics in tsc
convention — file(line,col): <error|warning> <code>: message — instead of
dropping the code, and a fatal .tsrx compile failure emits a valid stub
module under TSRX_TSC so sibling files keep their semantic diagnostics
(the raw-source fallback stays editor-only). The language server's
compile-diagnostic plugin maps severity 'warning' to real editor warnings.

Also pins the literal-key class-map emit contract: unknown keys reject
same-module and cross-module (TS2339/TS2551), and non-class-map apply
targets reject through the synthesized $class read.
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

@jonkwheeler is attempting to deploy a commit to the Ripple Team Team on Vercel.

A member of the Team first needs to authorize it.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@jonkwheeler
jonkwheeler marked this pull request as ready for review September 21, 2026 09:52
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

def not ready for review

@jonkwheeler
jonkwheeler marked this pull request as draft September 21, 2026 10:06
The stub module a failed file compiles to under TSRX_TSC type-checks
clean, so a printed failure no longer reached tsc's exit code — CI and
--noEmitOnError treated a broken module as clean. logTSRXErrors now
tracks error-severity entries (warnings stay non-fatal) and tsc.js
rewrites the exit code accordingly, covering both sys.exit and
return-without-exit paths.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 19b5c88. Configure here.

The exit-code test planted TS diagnostics in main.ts, so tsrx-tsc exited
nonzero regardless of the logged-failure signal — the wrap could regress
without the test noticing. Include broken.tsrx as a root file with no
imports and a clean main.ts, so the nonzero exit can only come from
loggedErrorDiagnostic(); keep the sibling-diagnostics coverage as its
own test.

Reported-by: Cursor Bugbot (tsrx-org#141)
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

this pr is being split into manageable chunks

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