Fix size-limit workflow output parsing#304
Conversation
Co-authored-by: yamyam263 <yamyam263@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@yamcodes has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 12 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughExtends size-limit output parsing to handle multiple formats including table lines, direct per-file sizes, Turbo-style prefixes (colon and hash formats), and generic "X kB of Y kB" patterns. Adds new parsing routes, improves package context tracking, handles additional error indicators, and adjusts final output formatting based on parsing success. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
size-limit workflow output parsing
Updated regex patterns in the size-limit output parsing logic for improved readability and maintainability. This change includes formatting adjustments to multi-line regex expressions for better clarity.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/actions/size-limit/run-size-check.ts (1)
89-94: Don't strip npm scopes innormalizePackageName.Splitting on
/and returning only the second segment means scoped packages like@scope/pkgcollapse topkg, so different packages can be conflated and the rendered table shows incorrect names. Please preserve the scope while still trimming workspace prefixes. For example:-const normalizePackageName = (pkgName: string) => { - if (pkgName.includes("/")) { - return pkgName.split("/")[1] ?? pkgName; - } - return pkgName; -}; +const normalizePackageName = (pkgName: string) => { + const cleaned = pkgName.replace(/^[./]+/, ""); + if (cleaned.startsWith("@")) { + return cleaned; + } + if (cleaned.includes("/")) { + const segments = cleaned.split("/"); + const scopeIndex = segments.findIndex((part) => part.startsWith("@")); + return scopeIndex >= 0 + ? segments.slice(scopeIndex).join("/") + : segments.at(-1) ?? cleaned; + } + return cleaned; +};
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/actions/size-limit/run-size-check.ts(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
Modified the regex pattern used for detecting package names in the size-limit output to allow for more flexible version matching. This change enhances the script's ability to parse package information accurately.
Updated the package name normalization logic to improve handling of scoped packages and relative paths. This change ensures more accurate parsing of package names, enhancing the script's functionality.
Enhance the size-limit output parser to support more formats and improve package name detection, fixing parsing errors.
The previous parser struggled with various
size-limitoutput formats, especially when not wrapped by Turbo, leading to "Could not parse size-limit output" errors. This update introduces more robust pattern matching for different size/limit expressions, table formats, direct file-based outputs, and better inference of package names from context or filter patterns, ensuring more reliable size reporting.Closes #303
Summary by CodeRabbit
Release Notes