Skip to content

Fix size-limit workflow output parsing#304

Merged
yamcodes merged 5 commits into
mainfrom
cursor/respond-to-github-fix-message-3b8e
Nov 9, 2025
Merged

Fix size-limit workflow output parsing#304
yamcodes merged 5 commits into
mainfrom
cursor/respond-to-github-fix-message-3b8e

Conversation

@yamcodes

@yamcodes yamcodes commented Nov 9, 2025

Copy link
Copy Markdown
Owner

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-limit output 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


Open in Cursor Open in Web

Summary by CodeRabbit

Release Notes

  • Improvements
    • Enhanced size-limit output parsing to support multiple build tool formats and configurations.
    • Added support for Turbo monorepo projects with improved prefix handling.
    • Improved error detection with enhanced error indicators for better visibility.
    • Better formatted size-limit reports displayed as Markdown tables for improved readability.

Co-authored-by: yamyam263 <yamyam263@gmail.com>
@cursor

cursor Bot commented Nov 9, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot

changeset-bot Bot commented Nov 9, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 526eb41

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Nov 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Nov 9, 2025 8:16pm

@coderabbitai

coderabbitai Bot commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between b95c2c1 and 526eb41.

📒 Files selected for processing (1)
  • .github/actions/size-limit/run-size-check.ts (5 hunks)

Walkthrough

Extends 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

Cohort / File(s) Summary
Size-limit output parsing enhancement
\.github/actions/size-limit/run-size-check.ts
Extends parsing to handle multiple output formats: table lines, direct per-file sizes with limit syntax, generic size patterns, and Turbo-style prefixes. Introduces tableMatch, directMatch, and sizeLimitMatch parsing routes. Adds support for hash and colon prefixes with package context management. Improves error detection with "❌" indicator. Adjusts final output to print Markdown table on successful parsing or raw output on failure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Parsing route logic: Verify each regex pattern (tableMatch, directMatch, sizeLimitMatch) correctly captures intended output formats across Turbo and non-Turbo outputs
  • State management: Trace currentPackage, currentFile, currentSize, currentLimit updates through all parsing branches to ensure correct aggregation per package
  • Edge cases: Review handling of indented lines, empty lines, package context inference, and transitions between different output format styles
  • Error detection: Validate that both existing error keywords and new "❌" indicator are properly recognized and set currentStatus

Poem

🐰 The parser hops through lines with glee,
Turbo, tables, formats three!
With hash and colon, size in sight,
The workflow output shines so bright!
No more raw dumps, just tables clean,
The prettiest parsing ever seen! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix size-limit workflow output parsing' clearly and concisely describes the main change: fixing the output parser for size-limit in GitHub workflows.
Linked Issues check ✅ Passed The PR directly addresses all requirements from issue #303: improves parser to handle multiple size-limit output formats, resolves parsing failures, and eliminates the 'Could not parse size-limit output' warnings.
Out of Scope Changes check ✅ Passed All changes are scoped to the size-limit output parsing logic in the GitHub action, directly addressing the parsing failures described in issue #303 with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the github actions Pull requests that update GitHub Actions code label Nov 9, 2025
@yamcodes yamcodes changed the title Respond to github fix message Fix size-limit workflow output parsing Nov 9, 2025
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.
@yamcodes
yamcodes marked this pull request as ready for review November 9, 2025 19:36
@yamcodes

yamcodes commented Nov 9, 2025

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 9, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 in normalizePackageName.

Splitting on / and returning only the second segment means scoped packages like @scope/pkg collapse to pkg, 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

📥 Commits

Reviewing files that changed from the base of the PR and between d52770a and b95c2c1.

📒 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)

Comment thread .github/actions/size-limit/run-size-check.ts Outdated
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.
@yamcodes
yamcodes merged commit 2c3fdc8 into main Nov 9, 2025
15 checks passed
@yamcodes
yamcodes deleted the cursor/respond-to-github-fix-message-3b8e branch November 9, 2025 20:34
@coderabbitai coderabbitai Bot mentioned this pull request Nov 10, 2025
@coderabbitai coderabbitai Bot mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix size-limit workflow output parsing

2 participants