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

Aperta Adatta ai principianti
#1,640 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
cli

Direzione di ricerca

Inizia da src/Octoshift/Models/CodeScanningAnalysis.cs e dai riferimenti al parsing e a GetSarifReport in src/Octoshift/Services/GithubApi.cs; controlla i test correlati ai tipi degli ID di analisi. Riproduci il problema usando un ID di analisi di code scanning superiore a 2,147,483,647, quindi verifica che la migrazione superi l’overflow e che i test correlati passino.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
482
Fork
151
Merge medio
2g 18h
PR unite (30g)
5

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/gh-gei

Tutte le issue di github/gh-gei

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.