Skip to content

Count SARIF results without reparsing the upload payload - #4296

Open
dsyme wants to merge 1 commit into
github:mainfrom
dsyme:perf/count-sarif-results-without-reparse
Open

dsyme wants to merge 1 commit into
github:mainfrom
dsyme:perf/count-sarif-results-without-reparse

Conversation

@dsyme

@dsyme dsyme commented Nov 3, 2026

Copy link
Copy Markdown

Summary

Count results directly from the SARIF object already available in uploadPostProcessedFiles instead of parsing the serialized upload payload again. Keep the existing missing-runs and missing-results array validation errors and continue reporting the same result count in upload telemetry.

Serialization, schema validation, compression, and upload behavior are unchanged. The counter is exported for direct unit coverage, and the action bundle and change note are included.

Validation

  • Add direct tests for zero results, counts across multiple runs, and malformed runs/results arrays.
  • npm run ava -- src/upload-lib.test.ts: all 48 upstream upload-library tests passed; the command also typechecks/transpiles the project.
  • ESLint on changed TypeScript passed.
  • Regenerated lib/entry-points.js with node build.mjs and validated the change note.
  • Repeated the tests and bundle generation after a frozen npm ci using npm 11; the generated bundle was identical and no dependency/lockfile changes are included.

Validated locally with Node 24.22.2. This removes one redundant parse/allocation, not SARIF serialization, CodeQL query work, compression, or network transfer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme
dsyme requested a review from a team as a code owner November 3, 2026 18:42
Copilot AI auto review requested due to automatic review settings November 3, 2026 18:42

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.

🟢 Approval recommended

No active review issues are reported, and the change includes focused coverage for empty, multi-run, and malformed SARIF inputs while preserving validation behavior.

No open issues 🎉

1 file not reviewed
What changed in this PR

This pull request updates SARIF upload telemetry to count results directly from the materialized SARIF object, avoiding redundant parsing while preserving validation behavior and telemetry values.

Changes:

  • Exported and refactored countResultsInSarif.
  • Added coverage for empty, multi-run, and malformed SARIF inputs.
  • Added a changenote documenting the optimization.
File Description
unreleased-change-notes/​count-materialized-sarif-results.md Documents the upload post-processing efficiency improvement.
src/​upload-lib.ts Counts results directly from the existing SARIF object for upload telemetry.
src/​upload-lib.test.ts Tests result counting across runs and malformed SARIF arrays.

Review effort: Lite (auto)

This branch has not been deployed

No deployments
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.

2 participants