Skip to content

502 fix size limit frequent failures#508

Merged
yamcodes merged 2 commits intomainfrom
502-fix-size-limit-frequent-failures
Dec 8, 2025
Merged

502 fix size limit frequent failures#508
yamcodes merged 2 commits intomainfrom
502-fix-size-limit-frequent-failures

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Dec 8, 2025

Closes #502

Summary by CodeRabbit

  • Chores
    • Enhanced package detection logic for improved accuracy in change tracking during CI workflows
    • Refined bundle size analysis configuration to better account for peer dependency handling

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 8, 2025

⚠️ No Changeset found

Latest commit: f1648dc

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
Copy link

vercel bot commented Dec 8, 2025

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

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Dec 8, 2025 2:08pm

@github-actions github-actions bot added the github actions Pull requests that update GitHub Actions code label Dec 8, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

This PR addresses size-limit workflow failures by improving package resolution logic and adjusting bundler configuration. The package detection now climbs upward from changed files to find the nearest package.json with regex fallback, and the bundler configuration expands the external ignore list to include peer dependencies.

Changes

Cohort / File(s) Summary
Size-limit package detection & bundler config
​.github/actions/size-limit/src/package/changes.ts, ​.github/actions/size-limit/src/size-limit/package.ts
Enhanced package resolution with upward directory traversal to locate nearest package.json; added regex fallback for scoped and unscoped package extraction on failure. Removed explicit webpack disabling and expanded bundler external ignore list to exclude peerDependencies keys.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Package traversal logic involves directory climbing and regex pattern matching that requires careful verification
  • Bundler configuration changes are straightforward but benefit from understanding how size-limit externals affect output
  • Interaction between upward search and fallback regex paths warrants close attention

Possibly related PRs

Suggested labels

github_actions

Poem

🐰 Hopping through paths with a curious nose,
Climbing up directories—that's how it goes!
Package.json whispers from parent to child,
Size-limit flows smoothly, no longer beguiled! 🚀

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 directly references issue #502 and describes the main objective of fixing size-limit frequent failures, which aligns with the changeset.
Linked Issues check ✅ Passed The changes address the core issue by improving package resolution logic and external handling in size-limit configuration, which should reduce parsing failures mentioned in issue #502.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing size-limit issues: package mapping logic improvements and configuration adjustments for bundler externals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 502-fix-size-limit-frequent-failures

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/actions/size-limit/src/package/changes.ts (1)

65-109: Workspace package detection via nearest package.json looks correct; only minor edge‑case ideas

This new “walk up to nearest package.json and use its name” approach should fix the earlier mismatch between directory names (e.g. vite-plugin) and actual workspace package names (e.g. @arkenv/vite-plugin), and the regex fallback for deleted/invalid package.json paths is a good safety net.

Two optional refinements you might consider, not blockers:

  • To avoid accidentally picking a nested fixture package.json under packages/<root>/..., you could stop the upward search once you’ve successfully checked packages/<firstSegment> (the canonical workspace package root) rather than iterating all the way from deepest to shallowest. This would better match the “packages/*/package.json are real packages” convention. Based on learnings, workspace packages live directly under packages/.
  • If this logic ever needs to scale to larger diffs, you could memoize the mapping from potentialPackageDir → resolved package name so multiple changed files under the same directory don’t repeatedly hit the filesystem.

Overall, the change looks sound and should make changed‑package detection far more reliable.

.github/actions/size-limit/src/size-limit/package.ts (1)

95-115: Externalizing Node built‑ins and peerDependencies in ignore aligns with size‑limit goals

Treating Node built‑ins and peerDependencies as ignored (i.e., external) when using the esbuild preset is a good fit for measuring just the library’s own bundle size, and it complements the temp package.json that still installs peerDependencies for resolution.

Two small, optional tweaks:

  • You could precompute the peer dependency keys once (e.g. const peerDepNames = packageJson.peerDependencies ? Object.keys(packageJson.peerDependencies) : [];) and reuse inside the map to avoid recomputing per‑config.
  • It’s worth double‑checking against the versioned size‑limit docs that ignore is still the right knob for feeding esbuild’s external list in @size-limit/preset-small-lib 11.2.0, just to ensure behavior doesn’t change subtly on upgrade.

Functionally this looks correct and should reduce spurious bundling and output parsing issues.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10f7f4a and f1648dc.

📒 Files selected for processing (2)
  • .github/actions/size-limit/src/package/changes.ts (1 hunks)
  • .github/actions/size-limit/src/size-limit/package.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Consider bundle size impact when adding new dependencies - aspirational goal: <1kB gzipped, enforced limit: 2kB gzipped
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to packages/*/package.json : Packages in packages/ directory must be published to npm and require changesets for versioning, proper exports, and type definitions

Applied to files:

  • .github/actions/size-limit/src/package/changes.ts
  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Always run `pnpm changeset` for version bumps in published packages - never skip changesets

Applied to files:

  • .github/actions/size-limit/src/package/changes.ts
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Only packages in packages/ directory are published to npm; publishing is handled by changesets using pnpm release

Applied to files:

  • .github/actions/size-limit/src/package/changes.ts
📚 Learning: 2025-11-29T08:00:08.044Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-29T08:00:08.044Z
Learning: Organize workspace packages into appropriate directories: `packages/` for published npm packages, `apps/` for applications, `tooling/` for development tools (not published), and `examples/` for example projects

Applied to files:

  • .github/actions/size-limit/src/package/changes.ts
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to tooling/*/package.json : Tooling in tooling/ directory contains development and testing tools that are not published to npm and excluded from changesets

Applied to files:

  • .github/actions/size-limit/src/package/changes.ts
  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-29T08:00:08.044Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-29T08:00:08.044Z
Learning: Applies to package.json : Configure only built dependencies (native modules) in `pnpm.onlyBuiltDependencies`, including: biomejs/biome, sentry/cli, swc/core, tailwindcss/oxide, vercel/speed-insights, esbuild, and sharp

Applied to files:

  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Prefer tree-shakeable exports for better bundling

Applied to files:

  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Consider bundle size impact when adding new dependencies - aspirational goal: <1kB gzipped, enforced limit: 2kB gzipped

Applied to files:

  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling

Applied to files:

  • .github/actions/size-limit/src/size-limit/package.ts
📚 Learning: 2025-11-29T08:57:24.056Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: examples/with-bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-29T08:57:24.056Z
Learning: Applies to examples/with-bun-react/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`

Applied to files:

  • .github/actions/size-limit/src/size-limit/package.ts
🧬 Code graph analysis (2)
.github/actions/size-limit/src/package/changes.ts (2)
.github/actions/size-limit/src/results.ts (3)
  • results (71-93)
  • result (86-87)
  • results (5-66)
.github/actions/size-limit/src/utils/parser.ts (1)
  • currentPackage (42-69)
.github/actions/size-limit/src/size-limit/package.ts (3)
.github/actions/size-limit/src/output.ts (1)
  • Promise (40-51)
.github/actions/size-limit/src/results.ts (1)
  • results (5-66)
.github/actions/size-limit/src/npm/baseline.ts (1)
  • filter (11-139)

@yamcodes yamcodes merged commit 374a563 into main Dec 8, 2025
15 checks passed
@yamcodes yamcodes deleted the 502-fix-size-limit-frequent-failures branch December 8, 2025 14:14
@coderabbitai coderabbitai bot mentioned this pull request Dec 8, 2025
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 frequent failures

1 participant