Skip to content

Conversation

cklin
Copy link
Contributor

@cklin cklin commented Sep 15, 2025

This PR adds getStoredSupportedLanguageMap() and refactors getLanguages() so that the init action can get the list of supported languages (along with their aliases) even when the CodeQL CLI is unavailable.

getStoredSupportedLanguageMap() is currently unused. It will be used in a future PR.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

This workflow checks that src/resolved-languages.json exists and is
up-to-date with respect to the default (linked) CodeQL version.
This commit fixes the BetterResolveLanguagesOutput interface, which
currently defines the `extractors` map values as tuples:

  [ { extractor_root: string; ... }, ]

Instead of arrays (which are what the CodeQL CLI produces):

  Array<{ extractor_root: string; ... }>
@cklin cklin force-pushed the cklin/languages-without-cli branch from d2d866e to 376055c Compare September 15, 2025 21:01
@cklin cklin marked this pull request as ready for review September 15, 2025 21:48
@cklin cklin requested a review from a team as a code owner September 15, 2025 21:48
@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 21:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to resolve supported languages without requiring the CodeQL CLI to be available. It introduces getStoredSupportedLanguageMap() function and refactors the existing language resolution logic to support both CLI-based and stored language maps.

Key changes:

  • Added a stored language map functionality using a static JSON file
  • Refactored getLanguages() to accept a pre-computed language map instead of generating it internally
  • Added validation workflow to ensure the stored language data stays current

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/resolved-languages.json New static file containing pre-resolved language and extractor information
src/config-utils.ts Added getStoredSupportedLanguageMap(), refactored getLanguages() signature, and extracted buildSupportedLanguageMap() helper
src/config-utils.test.ts Updated test calls to match new getLanguages() signature
src/codeql.ts Updated BetterResolveLanguagesOutput interface to use consistent array type
lib/init-action.js Generated JavaScript reflecting the TypeScript changes
.github/workflows/validate-resolved-languages.yml New workflow to validate the stored language file stays current

@@ -27,6 +27,7 @@ import {
OverlayDatabaseMode,
} from "./overlay-database-utils";
import { RepositoryNwo } from "./repository";
import * as resolvedLanguages from "./resolved-languages.json";
Copy link
Preview

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement assumes the JSON file will always be valid. Consider adding runtime validation to ensure the imported data conforms to the expected BetterResolveLanguagesOutput structure, or handling potential parsing errors gracefully.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant