Skip to content

ci: handle SARIF polling disabled errors#69

Merged
haasonsaas merged 1 commit intomainfrom
fix/sarif-polling-errors
Apr 30, 2026
Merged

ci: handle SARIF polling disabled errors#69
haasonsaas merged 1 commit intomainfrom
fix/sarif-polling-errors

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

Summary

  • share Code Scanning disabled-error handling between the SARIF upload request and SARIF processing poll
  • return cleanly when the polling endpoint reports Code Scanning is disabled
  • add focused tests for disabled and non-disabled HTTP errors

Test

  • uv tool run black scripts/upload-sarif-to-code-scanning.py tests/test_upload_sarif_to_code_scanning.py
  • uv tool run pytest tests/test_upload_sarif_to_code_scanning.py
  • python -m py_compile scripts/upload-sarif-to-code-scanning.py tests/test_upload_sarif_to_code_scanning.py

Note: local pre-commit was skipped because the installed macOS bash 3.2 lacks mapfile used by the hook; this change has no staged Go files and Python checks above passed.

Fixes missed review feedback from #67.

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 30, 2026

PR Summary

Low Risk
Low risk: small error-handling refactor in a CI helper script plus new unit tests; behavior only changes for specific 403 "code scanning disabled" responses.

Overview
Refactors SARIF upload error handling into shared helpers (is_code_scanning_disabled_error/handle_code_scanning_http_error) and reuses them for both the initial upload request and the subsequent processing-status polling.

When GitHub returns a 403 indicating Code Scanning/Advanced Security is disabled, the script now exits cleanly with a GitHub Actions warning instead of failing during polling; all other HTTP errors still surface the response body on stderr and are re-raised.

Adds focused tests covering the skip-on-disabled behavior and the re-raise path for non-disabled HTTP errors.

Reviewed by Cursor Bugbot for commit a84dfb0. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas changed the title Handle SARIF polling disabled errors ci: handle SARIF polling disabled errors Apr 30, 2026
@haasonsaas haasonsaas merged commit d510853 into main Apr 30, 2026
9 checks passed
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Misleading return type creates latent UnboundLocalError risk
    • Updated the helper to return Literal[True] and removed the fragile false-branch handling at both call sites so unbound variables cannot be reached.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit a84dfb0. Configure here.

Comment thread scripts/upload-sarif-to-code-scanning.py
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.

1 participant