Skip to content

feat(codecov): add query params to test analytics hooks #93473

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

Merged
merged 3 commits into from
Jun 13, 2025

Conversation

adrianviquez
Copy link
Contributor

This PR adds query params to the test analytics table and summary components. This PR doesn't include pagination.

Notes

  • Adds query params for useInfiniteTestResults and useTestResultsAggregates
    • Adds sortValueToSortKey to help map table column selected values to the values expected by the backend for data sorting and filtering
  • Types date and sorting variables for type safety
  • Adds representative mock selector data
  • Minor data quality adjustments

@adrianviquez adrianviquez requested a review from a team as a code owner June 12, 2025 19:55
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 12, 2025
Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

seems legit ✅ Nice work

*/
function sortValueToSortKey(value: string) {
const word = value.replace(/^[+-]/, '') as SortableTAOptions;
const sign = value.startsWith('-') ? '-' : '';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think value[0] === "-" might be marginally faster

queryKey: [
`/prevent/owner/${integratedOrg}/repository/${repository}/test-results/`,
{},
{query: {branch, codecovPeriod, signedSortBy}},
Copy link
Contributor

@ajay-sentry ajay-sentry Jun 12, 2025

Choose a reason for hiding this comment

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

Does Sentry hold things like a repository's default branch in their DB or nah? Otherwise maybe we'll need to bake it in somewhere eventually 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if they do because not everything is set to a repo/provider. We do have a defaultBranch field or something like that that we could surface, so we can have be the default for sure

...other
}) => {
const isBrokenTest =
totalFailCount === totalPassCount + totalFlakyFailCount + totalSkipCount;
return {
...other,
testName: name,
averageDurationMs: avgDuration,
averageDurationMs: avgDuration * 1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

is ms what we want? Looking at the figma and its in seconds, which is also a prop we can pass into the performanceDuration component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can do either or. If you provide seconds, and you get sub seconds, ill be displayed as 0.43 s, whereas if you supply milliseconds, it'll show as 43 ms, and on top of that show seconds if over seconds, so it's a nicer UI that way :]

Copy link
Contributor

Choose a reason for hiding this comment

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

oh cool! Yeah agreed that's a nicer UI

@adrianviquez adrianviquez merged commit d2f2fd7 into master Jun 13, 2025
45 checks passed
@adrianviquez adrianviquez deleted the adrian/add-query-params-to-test-analytics-hooks branch June 13, 2025 20:39
billyvg pushed a commit that referenced this pull request Jun 18, 2025
This PR adds query params to the test analytics table and summary
components. This PR doesn't include pagination.

Notes
-
- Adds query params for `useInfiniteTestResults` and
`useTestResultsAggregates`
- Adds `sortValueToSortKey` to help map table column selected values to
the values expected by the backend for data sorting and filtering
- Types date and sorting variables for type safety
- Adds representative mock selector data 
- Minor data quality adjustments
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
This PR adds query params to the test analytics table and summary
components. This PR doesn't include pagination.

Notes
-
- Adds query params for `useInfiniteTestResults` and
`useTestResultsAggregates`
- Adds `sortValueToSortKey` to help map table column selected values to
the values expected by the backend for data sorting and filtering
- Types date and sorting variables for type safety
- Adds representative mock selector data 
- Minor data quality adjustments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants