Skip to content

fix(reactcompat): bound react-detect output - #772

Merged
academo merged 1 commit into
mainfrom
fix/reactcompat-output-limit
Aug 21, 2026
Merged

fix(reactcompat): bound react-detect output#772
academo merged 1 commit into
mainfrom
fix/reactcompat-output-limit

Conversation

@academo

@academo academo commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Prevents failed or oversized react-detect output from producing oversized validator results.

Valid JSON is still reported after process failures. Serialized reports are capped at 32 KiB with omitted issue counts, and process output capture is bounded.

@academo academo self-assigned this Aug 20, 2026
@academo academo moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Aug 20, 2026
@academo
academo marked this pull request as ready for review August 20, 2026 17:13
@academo
academo requested a review from a team as a code owner August 20, 2026 17:13
@academo
academo requested review from andresmgot, leventebalogh and toddtreece and a lite review from Copilot and removed request for a team August 20, 2026 17:13

Copilot AI 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.

Pull request overview

This PR hardens the reactcompat analysis pass so @grafana/react-detect cannot cause oversized validator output, while still preserving useful diagnostics when the process fails or is killed.

Changes:

  • Adds bounded stdout/stderr capture and truncated previews for react-detect execution failures.
  • Caps serialized React compatibility diagnostics to 32 KiB and emits a truncation summary when results exceed the limit.
  • Tightens JSON parsing to require the expected sourceCodeIssues/dependencyIssues fields, with new tests covering truncation and malformed/partial outputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/analysis/passes/reactcompat/reactcompat.go Implements bounded process output capture, stream previewing, diagnostic size limiting, and stricter react-detect JSON validation.
pkg/analysis/passes/reactcompat/reactcompat_test.go Adds tests ensuring output stays within the report cap and that malformed/partial JSON is rejected.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +256 to +260
if len(fields.SourceCodeIssues) == 0 || len(fields.DependencyIssues) == 0 ||
bytes.Equal(bytes.TrimSpace(fields.SourceCodeIssues), []byte("null")) ||
bytes.Equal(bytes.TrimSpace(fields.DependencyIssues), []byte("null")) {
return nil, fmt.Errorf("parse react-detect output: missing required result fields")
}
@academo
academo merged commit 20f08b2 into main Aug 21, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Aug 21, 2026
@academo
academo deleted the fix/reactcompat-output-limit branch August 21, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

3 participants