migrate-code-scanning-alerts fails with OverflowException: analysis IDs now exceed Int32.MaxValue

未关闭 适合新手
#1,640 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
cli

调研方向

从 src/Octoshift/Models/CodeScanningAnalysis.cs 以及 src/Octoshift/Services/GithubApi.cs 中与解析和 GetSarifReport 相关的引用入手;检查与分析 ID 类型相关的测试。使用大于 2,147,483,647 的 code scanning 分析 ID 重现问题,然后验证迁移能够越过溢出问题,并且相关测试通过。

由索引模型根据 Issue 内容生成。

描述

Summary

gh gei migrate-code-scanning-alerts (v1.35.0, latest) now fails with:

[ERROR] System.OverflowException: Value was either too large or too small for an Int32.

right after Migrating Code Scanning Analyses from '<source>' to '<target>', before any SARIF is downloaded or uploaded.

Cause

Code scanning analysis IDs returned by the REST API now exceed Int32.MaxValue (2,147,483,647). Across many repositories we see IDs above that limit starting around 2026-11-11 (for example 2153368829, 2155212725), while older analyses are below it.

GEI parses analysis IDs as 32-bit integers:

  • src/Octoshift/Models/CodeScanningAnalysis.cs: public int Id { get; set; }
  • src/Octoshift/Services/GithubApi.cs: Id = (int)codescan["id"], (casting the JSON value overflows)
  • src/Octoshift/Services/GithubApi.cs: GetSarifReport(string org, string repo, int analysisId)

Any repository whose source or target has at least one analysis with an ID above Int32.MaxValue on the default branch fails immediately. Repositories whose analyses all predate the rollover still migrate successfully, so the failure rate grows as repositories are re-scanned.

Steps to reproduce
  1. Use a source repository with any code scanning analysis created recently (ID > 2147483647).
  2. Run gh gei migrate-code-scanning-alerts --source-org <org> --source-repo <repo> --target-org <org> --target-repo <repo>.
  3. GEI exits with status 1 and the OverflowException above.
Suggested fix

Use long for code scanning analysis IDs: CodeScanningAnalysis.Id, the (int)codescan["id"] cast in GithubApi, and the analysisId parameter of GetSarifReport (plus related tests). Other REST IDs parsed as int may need the same review.

Environment
  • gh-gei v1.35.0 (latest release)
  • GitHub Enterprise Cloud (github.com), code scanning migration between organizations
主要语言
C#
星标
482
派生
151
平均合并
2 天 18 小时
30 天内合并 PR
5

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/gh-gei 的其他 Issue

查看 github/gh-gei 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。