Sema code review and GitHub pull requests: how is analysis bounded on very large diffs?
0 reputation · 17 Jan 2022, 23:27 UTC
0 reputation · 17 Jan 2022, 23:27 UTC
We are evaluating the Sema code-review tool connected to GitHub, where automated review comments are posted directly onto pull requests. The boundary in question is between Sema's analysis engine and the GitHub pull-request API.
Understand what happens when a pull request exceeds a practical size — many changed files, a very large diff, or long analysis time. The goal is to know whether analysis is bounded (by file count, diff size, or a time limit) and, if so, how the delivered review comments are truncated or ordered once a limit is reached.
Public documentation does not appear to state a versioned contract for these limits, so behavior may be product- and version-specific. We also want to avoid assuming behavior from unrelated tools with similar names (semaphore libraries, Semgrep). Assume a current Sema release and a standard GitHub App installation; exact permission scopes and limits should be confirmed against the vendor's current documentation.
30275 reputation · 18 Jan 2022, 04:30 UTC
Because Sema operates as an integrated analysis engine interacting with the GitHub API, its boundaries are defined by both the tool's internal resource allocation and GitHub's API rate limits. When a pull request exceeds practical size limits, the analysis is typically bounded to prevent worker timeouts and API throttling.
In the absence of a versioned public contract, the behavior for oversized diffs generally follows these patterns:
When the number of identified issues exceeds the capacity of the GitHub API or the tool's internal output limit, results are usually truncated. While specific ordering varies by configuration, the standard industry approach is as follows:
Since documented limits are often internal or version-specific, the recommended method for verification is a sandbox test. This allows you to establish a baseline for your specific environment and configuration.
skipped, truncated, or resource exhausted.To provide a more precise recommendation, please specify: Are you using a self-hosted analysis runner or the Sema cloud-managed service? This determines whether the boundary is governed by your own infrastructure limits or the vendor's multi-tenant quotas.
Use comments to ask for clarification. Post a solution as an answer.
30,275 reputation · 18 Jan 2022, 04:58 UTC
To build on the discussion of resource caps, it is important to distinguish between full-scan analysis and incremental analysis. Most modern static analysis engines attempt to bound the problem by evaluating only the modified Abstract Syntax Tree (AST) nodes and their immediate dependencies rather than the entire codebase.
When a pull request is exceptionally large, this incremental approach can still hit boundaries in two specific ways:
To verify this behavior, check your tool's configuration for parameters like max-files or timeout, and inspect the CI logs for "truncated" or "skipped" warnings when testing with synthetic oversized PRs.