Skip to content

Add repository metadata to row#1692

Merged
koesie10 merged 6 commits intomainfrom
koesie10/add-metadata-to-repo-row
Nov 3, 2022
Merged

Add repository metadata to row#1692
koesie10 merged 6 commits intomainfrom
koesie10/add-metadata-to-repo-row

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Nov 1, 2022

Please review this PR commit-by-commit. There were some missing types on the stories, so to properly use Storybook those needed to be fixed, resulting in a large diff. Only the first and third commit are relevant for the repository metadata display.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This adds the new `stargazers_count` and `updated_at` fields in the
repositories to the appropriate `gh-api` and `shared` types.

To make testing easier this also moves the
`variant-analysis-processor.test.ts` to the pure tests since it doesn't
and shouldn't depend on any `vscode` APIs.
It seems like the Storybook stories were not being type-checked by CI
and got out-of-sync with the required types. This fixes the types and
also uses the factories to reduce the chance of this happening with
future changes.
This will add the star count and last updated fields to the repository
row. We are able to re-use some components from remote queries, but we
cannot re-use `LastUpdated` since it requires a numeric duration, while
we are dealing with an ISO8601 date.
@koesie10 koesie10 added the secexp label Nov 1, 2022
This uses a script to add the new `stargazers_count` and `updated_at` to
the scenario files. This is done by using the GitHub API to get the
information for each repo and then updating the scenario file.

The `updated_at` values are not completely representative since they are
the `updated_at` at time of running the script, rather than at the time
the variant analysis was run. However, this should not really matter in
practice. An alternative for scanned repositories might be getting the
creation time of the `database_commit_sha` commit.
The tests were expecting the wrong results, except for the case where
the time was less than a second. For less than a second ago, it makes
sense to return "this minute". For times that are 2.001 minutes ago, it
makes sense to return "2 minutes ago" rather then the previous behaviour
of "3 minutes ago".
@koesie10 koesie10 marked this pull request as ready for review November 2, 2022 13:26
@koesie10 koesie10 requested review from a team as code owners November 2, 2022 13:26
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

I haven't gone over every line of code change with a fine toothed comb, but I've looked through quickly and the code changes look fine to me. I've also tried it out locally, checking the storybooks, and trying running a real variant analysis and a mocked analysis and everything works.

@charisk, I don't know if you want to look over the scripts / scenarios changes? I don't have much context on those yet.

Copy link
Copy Markdown
Contributor

@elenatanasoiu elenatanasoiu left a comment

Choose a reason for hiding this comment

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

This is awesome! 🙌

Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

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

Scenario changes LGTM!

@koesie10 koesie10 merged commit 26e2021 into main Nov 3, 2022
@koesie10 koesie10 deleted the koesie10/add-metadata-to-repo-row branch November 3, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants