@@ -3,7 +3,10 @@ import {
33 defaultFilterSortState ,
44 filterAndSortRepositoriesWithResults ,
55} 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" ;
710import type { Credentials } from "../common/authentication" ;
811import type { NotificationLogger } from "../common/logging" ;
912import type { App } from "../common/app" ;
@@ -16,6 +19,7 @@ import { tryGetQueryMetadata } from "../codeql-cli/query-metadata";
1619import { window as Window } from "vscode" ;
1720import { pluralize } from "../common/word" ;
1821import { glob } from "glob" ;
22+ import { readRepoTask } from "./repo-tasks-store" ;
1923
2024// Limit to three repos when generating autofixes so not sending
2125// too many requests to autofix. Since we only need to validate
@@ -282,6 +286,17 @@ async function processSelectedRepositories(
282286 progressForRepo ( progressUpdate ( 1 , 3 , `Getting sarif` ) ) ;
283287 const repoStoragePath = join ( variantAnalysisIdStoragePath , nwo ) ;
284288 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+ }
285300 } ,
286301 {
287302 title : `Processing ${ nwo } ` ,
0 commit comments