Skip to content

Adopt upstream #2232: tsc - handle pretty diagnostics - #44

Merged
kylehgc merged 2 commits into
developfrom
adopt-upstream-2232
Jul 22, 2026
Merged

kylehgc merged 2 commits into
developfrom
adopt-upstream-2232

Conversation

@kylehgc

@kylehgc kylehgc commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #32.

Adopts rtk-ai/rtk#2232 (fix for upstream #1772): tsc --pretty / ANSI output broke diagnostic parsing, producing a false "TypeScript: No errors found" on non-zero compiler exit.

Commits

  • a7998ad fix(tsc): handle pretty diagnostics — cherry-pick of upstream f7e806c, authorship preserved (xiaozh [email protected])
  • 842ffeb test(tsc): add real-fixture token savings test for pretty output — fork amendment (cli-testing.md requires a >=60% savings assertion; module had none)

Repro (pre-cherry-pick binary, develop @ e110adc)

> rtk tsc --noEmit --pretty -p tsconfig.json    # project with 1 type error
TypeScript: No errors found
RTK_EXIT=1

Fixed (post-cherry-pick)

> rtk tsc --noEmit --pretty -p tsconfig.json
bad.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'.
TypeScript: 1 errors in 1 files
RTK_EXIT=1

Quality gate (local — fork CI does not run; this is the merge gate)

  • cargo fmt --all -- --check ✅
  • cargo clippy --all-targets ✅ (0 warnings)
  • cargo test --all ✅ 2495 passed, 0 failed (one unrelated flake in core::tracking::tests::test_timed_execution_passthrough under load; 5/5 green in isolation, green on clean rerun)

Two-axis code review (Standards / Spec)

  • Standards: no hard violations; missing savings test flagged → fixed by amendment 842ffeb. Minor smells (TsDiagnostic/TsError field duplication, duplicated fallback format strings) judged acceptable as-is.
  • Spec: upstream PR scope fully implemented; Windows drive-letter paths verified safe against TSC_PRETTY_ERROR. Two pre-existing gaps noted as follow-ups, out of scope for this adoption:
    • buffered filter_tsc_output (pipe mode) has no exit-code input and can still print "TypeScript compilation completed" for unparsed failing output
    • streaming path echoes diagnostic lines with ANSI intact (matching is stripped, display is not)

🤖 Generated with Claude Code

jsiu93 and others added 2 commits July 22, 2026 15:21
Strip ANSI before parsing tsc diagnostics and fall back to raw output when a non-zero compiler exit produces no parsed errors.

Fixes rtk-ai#1772.
Amendment to adopted upstream rtk-ai#2232: cli-testing.md requires filters to
verify >=60% token savings against real fixtures. Fixture is real
'tsc --noEmit --pretty' output (ANSI, code frames) from a two-file
TypeScript project with 9 diagnostics. Savings measured with
core::tracking::estimate_tokens (chars/4) — the metric rtk gain reports;
whitespace-based counting is blind to the ANSI escapes this filter strips.

Co-Authored-By: Claude Fable 5 <[email protected]>
@kylehgc
kylehgc merged commit 818cb55 into develop Jul 22, 2026
@kylehgc
kylehgc deleted the adopt-upstream-2232 branch July 22, 2026 19:31
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.

Adopt upstream #2232: tsc - handle pretty diagnostics

2 participants