@@ -3,7 +3,10 @@ import {
3
3
defaultFilterSortState ,
4
4
filterAndSortRepositoriesWithResults ,
5
5
} from "./shared/variant-analysis-filter-sort" ;
6
- import type { VariantAnalysis } from "./shared/variant-analysis" ;
6
+ import type {
7
+ VariantAnalysis ,
8
+ VariantAnalysisRepositoryTask ,
9
+ } from "./shared/variant-analysis" ;
7
10
import type { Credentials } from "../common/authentication" ;
8
11
import type { NotificationLogger } from "../common/logging" ;
9
12
import type { App } from "../common/app" ;
@@ -16,6 +19,7 @@ import { tryGetQueryMetadata } from "../codeql-cli/query-metadata";
16
19
import { window as Window } from "vscode" ;
17
20
import { pluralize } from "../common/word" ;
18
21
import { glob } from "glob" ;
22
+ import { readRepoTask } from "./repo-tasks-store" ;
19
23
20
24
// Limit to three repos when generating autofixes so not sending
21
25
// too many requests to autofix. Since we only need to validate
@@ -282,6 +286,17 @@ async function processSelectedRepositories(
282
286
progressForRepo ( progressUpdate ( 1 , 3 , `Getting sarif` ) ) ;
283
287
const repoStoragePath = join ( variantAnalysisIdStoragePath , nwo ) ;
284
288
const sarifFile = await getSarifFile ( repoStoragePath , nwo ) ;
289
+
290
+ // Read the contents of the variant analysis' `repo_task.json` file,
291
+ // and confirm that the `databaseCommitSha` and `resultCount` exist.
292
+ const repoTask : VariantAnalysisRepositoryTask =
293
+ await readRepoTask ( repoStoragePath ) ;
294
+ if ( ! repoTask . databaseCommitSha ) {
295
+ throw new Error ( `Missing database commit SHA for ${ nwo } ` ) ;
296
+ }
297
+ if ( ! repoTask . resultCount ) {
298
+ throw new Error ( `Missing variant analysis result count for ${ nwo } ` ) ;
299
+ }
285
300
} ,
286
301
{
287
302
title : `Processing ${ nwo } ` ,
0 commit comments