Skip to content

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

Closed
jonkwheeler wants to merge 1 commit into
tsrx-org:mainfrom
jonkwheeler:feat/diagnostic-severity-codes
Closed

jonkwheeler wants to merge 1 commit into
tsrx-org:mainfrom
jonkwheeler:feat/diagnostic-severity-codes

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Slice T-A of the typed-native-styling decomposition (tracked in octanejs/octane#1204). Re-cut from #141 — this PR carries severity/code transport only; the fatal-failure stub emit, exit-path behavior, and class-map emit/type pins land in a follow-up slice (T-B) once this merges.

  • CompileError gains an optional severity: 'error' | 'warning' (absent means error) and error() accepts it as a trailing parameter, so consumer compilers (Octane's style analyzer) can publish warning-severity diagnostics instead of everything being an error.
  • tsrx-tsc prints collected diagnostics in tsc convention — [tsrx-tsc] file(line,col): <error|warning> <code>: message — instead of dropping code.
  • The language server's compile-diagnostic plugin maps severity: 'warning' entries to real editor warnings.

Why: Octane's typed-styling work emits warning-severity diagnostics (octane-css-unused-selector, unresolved token contracts). Without severity transport they surface as errors in the editor and tsrx-tsc, which would make the warnings unshippable.

Test plan

  • pnpm test --project typescript-plugin (incl. new tsc-error-logging.test.js — 262 tests)
  • pnpm test --project language-server
  • packages/tsrx/tests/utils/errors.test.js
  • pnpm typecheck, pnpm format:check
  • CI

Provenance

  • An agent produced this diff (agent-authored)

Re-cut mechanically from the validated diff in #141; no redesign.


Note

Low Risk
Additive API on the diagnostic collection path and presentation-only changes in the language server and tsrx-tsc logging; no auth or build-failure semantics changed unless callers opt into warning severity.

Overview
Extends the collected-diagnostics pipeline so warning-severity issues from consumer compilers (e.g. Octane style analysis) are not forced to show as errors in the editor or CLI.

CompileError and error() now support an optional severity: 'error' | 'warning' (omitted still means error). Types and JSDoc on compile results document that errors may include warnings.

The language server compile-error plugin maps severity: 'warning' to DiagnosticSeverity.Warning instead of always using Error.

tsrx-tsc stderr output follows tsc-style lines: [tsrx-tsc] file(line,col): <error|warning> <code>: message, including diagnostic codes and 1-based positions when loc is present; dedupe keys now account for position, severity, code, and message.

Tests cover error() passthrough, plugin warning surfacing, and logTSRXErrors formatting/deduping.

Reviewed by Cursor Bugbot for commit 4463ac7. 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 — [tsrx-tsc] file(line,col): <error|warning> <code>: message —
instead of dropping the code. The language server's compile-diagnostic plugin
maps severity 'warning' to real editor warnings.

Re-cut from feat/diagnostic-code-propagation (slice T-A, tracked in
octanejs/octane#1204; the fatal-stub emit, exit-path, and class-map emit pins
land in a follow-up).

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

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

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 4463ac7. Configure here.

const position =
typeof start?.line === 'number' && typeof start?.column === 'number'
? `(${start.line},${start.column + 1})`
: '';

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.

Parse errors skip tsc position

Medium Severity

logTSRXErrors only reads loc.start.line and loc.start.column, so Acorn-raised fatals (this.raise) that attach loc as { line, column } omit the new file(line,col) prefix. Typical parse failures therefore never become greppable tsc-style positions, even though they carry loc.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4463ac7. Configure here.

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Closing this slice draft for now: the typed-styling work is moving to an RFC first so the approach can be discussed with maintainers before asking for slice review. The branch and this re-cut remain intact; slices may be reopened or re-cut once the RFC settles the direction. Still tracked in the decomposition index (octanejs/octane#1204).

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