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

Abierto Apto para principiantes
#1,640 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
cli

Línea de trabajo

Empieza por src/Octoshift/Models/CodeScanningAnalysis.cs y las referencias al análisis y a GetSarifReport en src/Octoshift/Services/GithubApi.cs; revisa las pruebas relacionadas con los tipos de ID de análisis. Reproduce el problema con un ID de análisis de code scanning superior a 2,147,483,647 y, después, verifica que la migración supere el desbordamiento y que pasen las pruebas relacionadas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
C#
Estrellas
482
Forks
151
Merge medio
2 d 18 h
PR fusionados (30 d)
5

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/gh-gei

Todos los issues de github/gh-gei

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.