Skip to content

Extend init complete status report #2394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

rvermeulen
Copy link
Contributor

To gain insights into how users are using CodeQL in combination with packs, query filters, and registries we extend the init complete status report. This report now includes the packs, query-filters, and registries that are used in the CodeQL setup.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

To support both the single language and multi language case we turn
the single language case into a multi language case using the
configured language.
The entire packs record is then stored as a stringified JSON object.
Registries might require authentication, before we add it to the
report we remove any credentials.
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Looks good. This PR is missing the updated map files and minified JS files.

@aeisenberg aeisenberg added the Rebuild Re-transpile JS & re-generate workflows label Jul 29, 2024
@aeisenberg
Copy link
Contributor

The rebuild action is failing because this is in a fork. @rvermeulen, if you remove and then add the Rebuild label, a job will run to automatically transpile the javascript (it fails for me). Or you can do it locally.

@rvermeulen rvermeulen added Rebuild Re-transpile JS & re-generate workflows and removed Rebuild Re-transpile JS & re-generate workflows labels Jul 31, 2024
@rvermeulen rvermeulen added Rebuild Re-transpile JS & re-generate workflows and removed Rebuild Re-transpile JS & re-generate workflows labels Jul 31, 2024
@aeisenberg
Copy link
Contributor

Can you run npm build locally and then commit/push the changes?

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Apologies...something I didn't catch the first time I reviewed.

@rvermeulen rvermeulen force-pushed the rvermeulen/extend-init-complete-status-report branch from ed2e214 to ba3ac6f Compare August 1, 2024 01:00
aeisenberg
aeisenberg previously approved these changes Aug 1, 2024
angelapwen
angelapwen previously approved these changes Aug 2, 2024
Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

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

Just a few questions from my end 😄

Comment on lines +887 to +890
return parseRegistries(registriesInput)?.map((r) => {
const { url, packages } = r;
return { url, packages };
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the logic here 🤔 do you mind explaining it here or in a code comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we use destructuring assignment to unpack the properties of a registry we need to create a new RegistryConfigNoCredentials object.

Initially I had:

const { token: _, ...registryWithoutCredentials } = r;

but this triggered an ESLint unused variable error for _.
In hindsight, selecting the properties we actually care about instead of removing current sensitive properties is a better solution in case we add more sensitive properties in the future or rename the current sensitive property.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see! That makes sense 👍 I was missing the context that we were selecting for url and packages (it looked to me like we were just returning everything in registriesInput)

Comment on lines +89 to +101
/** Stringified JSON object of packs, from the 'packs' config field or workflow input. */
packs: string;
/** Comma-separated list of languages for which we are using TRAP caching. */
trap_cache_languages: string;
/** Size of TRAP caches that we downloaded, in bytes. */
trap_cache_download_size_bytes: number;
/** Time taken to download TRAP caches, in milliseconds. */
trap_cache_download_duration_ms: number;
/** Stringified JSON array of registry configuration objects, from the 'registries' config field
or workflow input. **/
registries: string;
/** Stringified JSON object representing a query-filters, from the 'query-filters' config field. **/
query_filters: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 Is it possible that any of these field values are undefined or empty before we pass them to JSON.stringify? If so, what's the output & is that we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they might be undefined, but the value of those properties cannot be.
That being said, let me explicitly use their initialization values according to their type, that is an empty array for registries and query_filters.

@rvermeulen rvermeulen marked this pull request as ready for review August 2, 2024 21:47
@rvermeulen rvermeulen requested a review from a team as a code owner August 2, 2024 21:47
@rvermeulen rvermeulen dismissed stale reviews from angelapwen and aeisenberg via 6a78363 August 2, 2024 21:47
Both are arrays, so we will use an empty array if they are undefined.
@rvermeulen rvermeulen force-pushed the rvermeulen/extend-init-complete-status-report branch from b34eb51 to e6c9383 Compare August 2, 2024 22:11
Signed-off-by: Remco Vermeulen <rvermeulen@github.com>
@rvermeulen rvermeulen requested a review from angelapwen August 2, 2024 23:44
@rvermeulen rvermeulen requested a review from aeisenberg August 2, 2024 23:44
aeisenberg
aeisenberg previously approved these changes Aug 3, 2024
angelapwen
angelapwen previously approved these changes Aug 5, 2024
Copy link
Contributor

@angelapwen angelapwen left a comment

Choose a reason for hiding this comment

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

Thanks for answering my questions ❣️

@rvermeulen rvermeulen dismissed stale reviews from angelapwen and aeisenberg via 7c2bec0 August 6, 2024 16:12
@rvermeulen rvermeulen merged commit 5c02493 into github:main Aug 6, 2024
304 checks passed
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.

3 participants