Skip to content

[code-infra] Update renderMarkdownReport #345

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 17 commits into from
Jun 4, 2025
Merged

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented May 30, 2025

  • add track option to declare a predefined set of bundles as a summary, it will always show statistics for these bundles
  • add a fallbackDepth option to specify how many commits to go back on the base branch in case a snapshot isn't found. (can be useful when the base branch is still building)

Example:

@mui/material/Button/index.jsparsed: 🔺+400B(+2.67%) gzip: 🔺+100B(+2.22%)

Show details for 2 more bundles

@mui/icons-material/Add.jsparsed: 🔺+100B(+10.00%) gzip: 🔺+50B(+16.67%)
@mui/icons-material/Delete.jsparsed: 🔺+100B(+8.33%) gzip: 🔺+50B(+14.29%)

Details of bundle changes

@Janpot Janpot added the enhancement This is not a bug, nor a new feature label May 30, 2025
@Janpot Janpot requested a review from a team June 3, 2025 09:15
@michaldudak
Copy link
Member

The example above shows the same bundles in and above the expandable details. Can we show tracked bundles above and all measured ones in details?

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

LGTM besides the suggestion from Michal. 👍
Thanks for adding the fallbackDepth feature. 🙏 💯

@Janpot
Copy link
Member Author

Janpot commented Jun 3, 2025

@michaldudak Updated, I'm also filtering out the already tracked bundles as they're shown at the top

@Janpot Janpot marked this pull request as ready for review June 3, 2025 12:02
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 3, 2025
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 3, 2025
@Janpot Janpot merged commit acf4dd4 into master Jun 4, 2025
7 checks passed
@Janpot Janpot deleted the render-markdown-report branch June 4, 2025 08:50
@oliviertassinari oliviertassinari added the scope: code-infra Specific to the core-infra product label Jun 8, 2025
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

A side

* @param {number} [fallbackDepth=3] - How many parent commits to try as fallback
* @returns {Promise<{snapshot: import('./sizeDiff').SizeSnapshot | null, actualCommit: string | null}>}
*/
export async function fetchSnapshotWithFallback(repo, commit, fallbackDepth = 3) {
Copy link
Member

Choose a reason for hiding this comment

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

This reminds me of the Argos CI logic I wrote in the past, we had to walk the git commit tree to find a usable snapshot.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's also possible, but wouldn't work on the frontend

const summaryText = hasMore
? `Show details for ${cappedEntries.length} more ${bundleWord} (${detailsEntries.length - maxDetailsLines} more not shown)`
: `Show details for ${cappedEntries.length} more ${bundleWord}`;
markdownContent += `<details>\n<summary>${summaryText}</summary>\n\n`;
Copy link
Member

Choose a reason for hiding this comment

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

A markdown table formatting could probably help the readability. I kind of feel that only the link to the web view is readable. But maybe we don't even need to list the details in markdown. Only having the web view seems fine. So maybe to delete in the first place.

@oliviertassinari oliviertassinari changed the title Update renderMarkdownReport [code-infra] Update renderMarkdownReport Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature scope: code-infra Specific to the core-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants