Skip to content

Report Semgrep file-level parse errors as a partial scan - #475

Merged
chrisknvidia merged 4 commits into
mainfrom
fix/semgrep-parse-errors
Nov 13, 2026
Merged

chrisknvidia merged 4 commits into
mainfrom
fix/semgrep-parse-errors

Conversation

@chrisknvidia

@chrisknvidia chrisknvidia commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Semgrep file-level parse errors now produce one partial-scan message that names up to 20 unparsed files, relative to the skill and with the line of the first error, instead of the first three truncated errors. Every unparsed file is listed in the semgrep_unparsed_files field of the JSON report. The check stays incomplete because Semgrep skips the code it cannot parse; findings for other files are kept and other Semgrep errors are reported as before.

Closes #463

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran ruff check
  • Ran make test (full python -m pytest -n 4 on 38f7480: 23,201 passed. 494 failed and 141 errors are in Tier 3, Harbor and CLI tests; they fail the same way on the unmodified branch because my local environment has Harbor 0.13.2 instead of the pinned 0.25.0, and none are in files this PR touches)
  • Ran make build (python -m build: sdist and wheel built)
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • Updated CHANGELOG.md

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Semgrep file-level parse errors now produce one partial-scan error that
names up to 20 unparsed files, relative to the skill and with the line of
the first error, instead of the first three truncated errors. The check
stays incomplete because Semgrep skips the code it cannot parse; findings
for other files are kept and other Semgrep errors are reported as before.

- Count files rather than path:line entries, and say the file is not fully
  parsed: Semgrep reports most syntax errors as PartialParsing and still
  scans the rest of the file.
- Treat OtherParseError and AstBuilderError as file-level parse errors.
- Write the unparsed files to the JSON report as semgrep_unparsed_files
  (up to 1,000, with semgrep_unparsed_files_omitted counting the rest) and
  restore them from retained reports.
- Keep each skill's list when a folder scan merges per-skill results.

Closes #463

Signed-off-by: Christopher Kevin <[email protected]>
@chrisknvidia
chrisknvidia force-pushed the fix/semgrep-parse-errors branch from 3e55a77 to 9f068de Compare November 13, 2026 08:14
devin-ai-integration[bot]

This comment was marked as resolved.

A report restored from JSON kept the first 1,000 unparsed Semgrep files but
lost semgrep_unparsed_files_omitted, so a combined report made the cut list
look complete. Validate and restore the count in retained reports, add a
restored count to any new overflow when rendering JSON, and add the counts
up when a folder scan merges per-skill results.

Signed-off-by: Christopher Kevin <[email protected]>
@lucas-saldanha-werneck

Copy link
Copy Markdown
Contributor

Thanks for this. I opened #496 for the same issue and have closed it in favor of this PR. Listing every unparsed file in the report is very helpful on our side (we hit #463 with a valid bash exec 3<>/dev/tcp/... line).

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 821d5ed65f73, including Semgrep parse-error grouping, findings retention, merged scan metadata, report caps, and retained-result round trips. The selected validator and incomplete-report suites passed (90 tests). Previous fixes are present; no new actionable finding. Validation used captured responses/mocks rather than a live Semgrep invocation.

@chrisknvidia
chrisknvidia merged commit 957e8ff into main Nov 13, 2026
27 checks passed
@chrisknvidia
chrisknvidia deleted the fix/semgrep-parse-errors branch November 13, 2026 17:06
rng1995 added a commit that referenced this pull request Nov 13, 2026
Resolve the CHANGELOG conflict by keeping this branch's moves and adding
main's new entries where main has them: #500 under Unreleased, and #369
and #475 under 0.9.0 (moved to Unreleased in the next commit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Nov 13, 2026
#369 and #475 merged after v0.9.0 was cut, but their entries landed in
the 0.9.0 section. Move them to Unreleased (Changed and Fixed) so 0.9.0
matches the released notes again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Nov 13, 2026
Resolve the CHANGELOG conflict with #503 by putting its entry at the top
of Unreleased > Fixed, above the moved #475 entry it merged after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Nov 13, 2026
* docs(changelog): move post-0.9.0 entries to Unreleased

#497 and #459 merged after v0.9.0 was cut, but their entries landed in the
0.9.0 section that the release prep had just created. Move them, unchanged, to
Unreleased. The 0.9.0 section now matches the released v0.9.0 notes exactly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>

* docs(changelog): move #369 and #475 entries out of 0.9.0

#369 and #475 merged after v0.9.0 was cut, but their entries landed in
the 0.9.0 section. Move them to Unreleased (Changed and Fixed) so 0.9.0
matches the released notes again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>

---------

Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

[FEA]: Distinguish Semgrep file-level parse errors from a failed scan in Code Risk Analysis

3 participants