Skip to content

perf(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish#13098

Merged
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-80edca81-289e-4be4-a045-61b1ee59ea8f
Aug 15, 2025
Merged

perf(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish#13098
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-80edca81-289e-4be4-a045-61b1ee59ea8f

Conversation

Copy link
Contributor

Copilot AI commented Aug 14, 2025

This PR resolves the TODO comment at line 126 in apps/oxlint/src/tsgolint.rs by implementing streaming diagnostics for tsgolint instead of waiting for the entire process to complete.

Problem

Previously, the tsgolint integration would:

  1. Spawn the tsgolint process
  2. Wait for the entire process to complete using child.wait_with_output()
  3. Parse all output at once
  4. Send all diagnostics to the diagnostic service

This approach meant users had to wait for tsgolint to process all files before seeing any feedback, which could be slow for large codebases.

Solution

The implementation now streams diagnostics as they are emitted:

  1. Streaming stdout reader: Reads from the tsgolint process stdout in 4KB chunks as data becomes available
  2. Incremental message parsing: Uses the existing binary protocol parser to process complete messages as they arrive in the buffer
  3. Immediate diagnostic sending: Sends diagnostics to the diagnostic service via the error_sender channel as soon as they are parsed
  4. Proper buffering: Keeps incomplete messages in the buffer for the next iteration to handle message boundaries correctly

Key Changes

  • Replaced child.wait_with_output() with streaming stdout reading in a separate thread
  • Added incremental buffer processing that identifies complete messages using the binary protocol format
  • Maintained backward compatibility - all existing tests pass
  • Removed unused parse_tsgolint_output() function since parsing now happens incrementally
  • Added proper error handling for both process exit status and stdout processing

Benefits

  • Faster feedback: Users see diagnostics as soon as tsgolint emits them, rather than waiting for completion
  • Better user experience: Especially beneficial for large codebases where tsgolint processing takes significant time
  • Same reliability: All existing functionality and error handling is preserved
  • No breaking changes: The API and behavior remain the same from the user's perspective

The streaming implementation provides a more responsive experience while maintaining full compatibility with existing tsgolint integration.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 14, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added the A-cli Area - CLI label Aug 14, 2025
Copilot AI changed the title [WIP] Add streaming for tsgolint diagnostics instead of waiting for output to finish. Resolve the TODO in apps/oxlint/src/tsgolint.rs:126. Implement streaming diagnostics for tsgolint instead of waiting for output to finish Aug 14, 2025
Copilot AI requested a review from camchenry August 14, 2025 18:26
@camchenry camchenry changed the title Implement streaming diagnostics for tsgolint instead of waiting for output to finish feat(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish Aug 15, 2025
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Aug 15, 2025
@camchenry camchenry changed the title feat(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish perf(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish Aug 15, 2025
@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Aug 15, 2025
@camchenry camchenry force-pushed the copilot/fix-80edca81-289e-4be4-a045-61b1ee59ea8f branch from b6213e6 to 951a70b Compare August 15, 2025 04:37
@camchenry camchenry marked this pull request as ready for review August 15, 2025 04:38
Copilot AI review requested due to automatic review settings August 15, 2025 04:38
@camchenry camchenry requested a review from camc314 as a code owner August 15, 2025 04:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements streaming diagnostics for the tsgolint integration, allowing users to see diagnostics as they are emitted rather than waiting for the entire process to complete. This addresses the TODO comment and improves responsiveness for large codebases.

  • Replaces blocking wait_with_output() with streaming stdout reading in a separate thread
  • Implements incremental message parsing using existing binary protocol parser
  • Maintains backward compatibility while providing faster user feedback

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 15, 2025
Copy link
Member

Boshen commented Aug 15, 2025

Merge activity

… waiting for output to finish (#13098)

This PR resolves the TODO comment at line 126 in `apps/oxlint/src/tsgolint.rs` by implementing streaming diagnostics for tsgolint instead of waiting for the entire process to complete.

## Problem

Previously, the tsgolint integration would:
1. Spawn the tsgolint process
2. Wait for the entire process to complete using `child.wait_with_output()`
3. Parse all output at once
4. Send all diagnostics to the diagnostic service

This approach meant users had to wait for tsgolint to process all files before seeing any feedback, which could be slow for large codebases.

## Solution

The implementation now streams diagnostics as they are emitted:

1. **Streaming stdout reader**: Reads from the tsgolint process stdout in 4KB chunks as data becomes available
2. **Incremental message parsing**: Uses the existing binary protocol parser to process complete messages as they arrive in the buffer
3. **Immediate diagnostic sending**: Sends diagnostics to the diagnostic service via the `error_sender` channel as soon as they are parsed
4. **Proper buffering**: Keeps incomplete messages in the buffer for the next iteration to handle message boundaries correctly

## Key Changes

- Replaced `child.wait_with_output()` with streaming stdout reading in a separate thread
- Added incremental buffer processing that identifies complete messages using the binary protocol format
- Maintained backward compatibility - all existing tests pass
- Removed unused `parse_tsgolint_output()` function since parsing now happens incrementally
- Added proper error handling for both process exit status and stdout processing

## Benefits

- **Faster feedback**: Users see diagnostics as soon as tsgolint emits them, rather than waiting for completion
- **Better user experience**: Especially beneficial for large codebases where tsgolint processing takes significant time
- **Same reliability**: All existing functionality and error handling is preserved
- **No breaking changes**: The API and behavior remain the same from the user's perspective

The streaming implementation provides a more responsive experience while maintaining full compatibility with existing tsgolint integration.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey.
@graphite-app graphite-app bot force-pushed the copilot/fix-80edca81-289e-4be4-a045-61b1ee59ea8f branch from 951a70b to 3bfb235 Compare August 15, 2025 09:07
@graphite-app graphite-app bot merged commit 3bfb235 into main Aug 15, 2025
17 checks passed
@graphite-app graphite-app bot deleted the copilot/fix-80edca81-289e-4be4-a045-61b1ee59ea8f branch August 15, 2025 09:13
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI C-enhancement Category - New feature or request C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants