Switch size-limit to JSON-based results for better reliability#719
Switch size-limit to JSON-based results for better reliability#719
size-limit to JSON-based results for better reliability#719Conversation
|
WalkthroughAdds JSON-first size reporting: new Changes
Sequence DiagramsequenceDiagram
participant Turbo as Turbo Task
participant CLI as size-limit CLI
participant RepoFS as .size-limit.json files
participant Runner as GH Action (run.ts)
participant Parser as parseJsonFiles()
Turbo->>CLI: run "size-limit --json > .size-limit.json"
CLI->>RepoFS: write `.size-limit.json` per package
Runner->>Parser: call parseJsonFiles()
Parser->>RepoFS: glob scan `packages/**/.size-limit.json`
RepoFS-->>Parser: return JSON contents
Parser-->>Runner: SizeLimitResult[] (parsed)
alt JSON results exist
Runner->>Runner: use parsed JSON results
else
Runner->>CLI: parse stdout via parseSizeLimitOutput()
CLI-->>Runner: stdout parsed fallback results
end
Runner->>Runner: return final results (hasErrors, rawOutput, results)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
commit: |
📦 Bundle Size Report
✅ All size limits passed! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 4
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/src/utils/parser.ts (1)
180-183: Address the linter warning about control characters in regex.The pipeline is failing because the linter detects control characters in the regular expression. While these control characters (
\u001band\u009b) are intentional for matching ANSI escape sequences, the linter warning should be addressed.🔧 Proposed fix: Add suppression comment
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: Intentionally matching ANSI escape sequences const ansiRegex = new RegExp( "[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]", "g", );
🤖 Fix all issues with AI agents
In @.github/actions/size-limit/package.json:
- Line 10: The package.json currently pins "@types/bun" to "latest", which
breaks reproducible builds; replace the "latest" tag with an explicit version or
tight semver range by checking the published version (e.g., run `npm view
@types/bun version` or consult your lockfile), update the "@types/bun" entry in
package.json to that exact version or a fixed range, reinstall to update
lockfile, and commit the updated package.json and package-lock.json/yarn.lock so
CI uses a deterministic dependency.
In @.github/actions/size-limit/src/utils/parser.ts:
- Around line 10-46: parseJsonFiles calls formatBytes(item.size) and
formatBytes(item.limit) without ensuring those fields are numbers; validate that
item.size and item.limit are numbers before calling formatBytes (e.g., typeof
item.size === "number" ? item.size : 0) and similarly for item.limit, or
skip/mark the entry if invalid so you pass a number to formatBytes; update the
object pushed to results (in parseJsonFiles) to use the validated/fallback
numeric values and keep the package/file/status logic unchanged.
In @.github/actions/size-limit/src/utils/size.ts:
- Around line 64-71: The formatBytes function can index past the sizes array
when bytes >= 1024^5; clamp the computed index i to the last valid index
(sizes.length - 1) before using it so extremely large values map to the largest
unit ("TB") and the numeric value scales accordingly; modify the calculation in
formatBytes to compute i as Math.min(Math.floor(Math.log(bytes) / Math.log(k)),
sizes.length - 1) and then use that clamped i with the sizes array.
In @packages/vite-plugin/package.json:
- Line 59: Add the generated .size-limit.json to the repository ignore list:
update the root .gitignore to include a line for .size-limit.json so the output
of the "size" npm script ("size": "size-limit --json > .size-limit.json") is
explicitly ignored and cannot be accidentally committed.
🧹 Nitpick comments (1)
.github/actions/size-limit/src/utils/parser.ts (1)
10-12: Consider using async glob for consistency.The function is declared
asyncbut usesglob.sync(), which is synchronous. While not incorrect, using the async version would be more consistent.♻️ Optional refactor to use async glob
-export async function parseJsonFiles(): Promise<SizeLimitResult[]> { +export async function parseJsonFiles(): Promise<SizeLimitResult[]> { const results: SizeLimitResult[] = []; - const files = glob.sync("packages/**/.size-limit.json"); + const files = await glob("packages/**/.size-limit.json");
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
.github/actions/size-limit/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
.github/actions/size-limit/package.json.github/actions/size-limit/src/size-limit/run.ts.github/actions/size-limit/src/utils/parser.ts.github/actions/size-limit/src/utils/size.tspackages/arkenv/package.jsonpackages/bun-plugin/package.jsonpackages/vite-plugin/package.jsonturbo.json
🧰 Additional context used
📓 Path-based instructions (4)
packages/*/package.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Packages in packages/ directory must be published to npm and require changesets for versioning, proper exports, and type definitions
Files:
packages/vite-plugin/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
**/package.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use workspace:* protocol for workspace dependencies between packages
Files:
packages/vite-plugin/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
{packages,apps,tooling}/**/package.json
📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)
When referencing workspace packages in dependencies, use the
workspace:*protocol instead of version numbers
Files:
packages/vite-plugin/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
turbo.json
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
Files:
turbo.json
🧠 Learnings (23)
📓 Common learnings
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 turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
📚 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:
packages/vite-plugin/package.json.github/actions/size-limit/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json.github/actions/size-limit/src/utils/parser.ts.github/actions/size-limit/src/size-limit/run.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Always run `pnpm changeset` for version bumps in published packages instead of manually modifying package.json versions
Applied to files:
packages/vite-plugin/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 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:
packages/vite-plugin/package.jsonturbo.json.github/actions/size-limit/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 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 turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
Applied to files:
packages/vite-plugin/package.jsonturbo.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 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:
packages/vite-plugin/package.json.github/actions/size-limit/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Use Vitest for unit and integration tests
Applied to files:
packages/vite-plugin/package.jsonpackages/bun-plugin/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests
Applied to files:
packages/vite-plugin/package.json.github/actions/size-limit/package.jsonpackages/bun-plugin/package.json
📚 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 examples/*/package.json : Examples in examples/ directory are not published, may have their own lock files, and are used as test fixtures
Applied to files:
packages/vite-plugin/package.jsonturbo.jsonpackages/bun-plugin/package.json
📚 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/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` in package.json scripts
Applied to files:
packages/vite-plugin/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 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/**/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests
Applied to files:
packages/vite-plugin/package.jsonpackages/bun-plugin/package.json
📚 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 : The project uses `pnpm10.20.0` as specified in the `packageManager` field
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,js} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running scripts
Applied to files:
.github/actions/size-limit/package.json
📚 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} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript and JavaScript files
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management
Applied to files:
.github/actions/size-limit/package.jsonpackages/bun-plugin/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Applied to files:
.github/actions/size-limit/package.json
📚 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/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts
Applied to files:
.github/actions/size-limit/package.jsonpackages/arkenv/package.jsonpackages/bun-plugin/package.json
📚 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 : Use `bun --hot` to run TypeScript entry files with hot module reloading enabled
Applied to files:
.github/actions/size-limit/package.json
📚 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/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
Applied to files:
.github/actions/size-limit/package.json
📚 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/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts
Applied to files:
packages/bun-plugin/package.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Avoid adding new dependencies without considering bundle size impact (target: <2kB gzipped, enforced limit: 2kB gzipped)
Applied to files:
packages/bun-plugin/package.json
🧬 Code graph analysis (2)
.github/actions/size-limit/src/utils/parser.ts (2)
.github/actions/size-limit/src/types.ts (1)
SizeLimitResult(1-8).github/actions/size-limit/src/utils/size.ts (1)
formatBytes(65-71)
.github/actions/size-limit/src/size-limit/run.ts (1)
.github/actions/size-limit/src/utils/parser.ts (2)
parseJsonFiles(10-46)parseSizeLimitOutput(104-284)
🪛 GitHub Actions: autofix.ci
.github/actions/size-limit/src/utils/parser.ts
[error] 180-180: lint/suspicious/noControlCharactersInRegex: Unexpected control character in a regular expression.
⏰ 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). (6)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
- GitHub Check: test-build (lts/*)
- GitHub Check: test-build (latest)
- GitHub Check: test-typesafety
- GitHub Check: Deploy-Preview
🔇 Additional comments (9)
packages/arkenv/package.json (1)
16-16: LGTM!The JSON output redirection aligns with the PR's objective to improve reliability through structured data parsing. The output file
.size-limit.jsonmatches the turbo task configuration.packages/bun-plugin/package.json (1)
59-59: LGTM!Consistent with the JSON-based size reporting introduced across the monorepo.
turbo.json (1)
67-70: LGTM!The new "size" task correctly depends on upstream builds and declares the
.size-limit.jsonoutput, enabling proper caching and task orchestration for size analysis..github/actions/size-limit/package.json (1)
11-11: Update @types/node to version 25.0.3 or verify intended version.@types/node version 25.0.6 does not exist on the npm registry. The latest 25.x release is 25.0.3. Confirm whether 25.0.3 is the intended version or select another available version.
glob@13.0.0 exists and is the current latest version.
⛔ Skipped due to learnings
Learnt from: yamcodes Repo: yamcodes/arkenv PR: 132 File: packages/arkenv/README.md:13-14 Timestamp: 2025-09-09T17:35:45.000Z Learning: Current Node.js LTS version is v22 'Jod' (entered LTS October 2024). Node.js v24 will become LTS in October 2025. Always verify current Node.js LTS status rather than assuming version numbers..github/actions/size-limit/src/size-limit/run.ts (2)
3-7: LGTM! Import changes support JSON-first parsing.The addition of
parseJsonFilesto the imports is necessary for the new JSON-based parsing strategy.
48-58: Well-designed fallback strategy for gradual migration.The JSON-first approach with stdout parsing fallback provides excellent backward compatibility. This allows the new JSON-based parsing to be adopted gradually while maintaining support for branches that haven't been updated yet.
.github/actions/size-limit/src/utils/parser.ts (3)
3-5: LGTM! New imports support JSON file parsing.The
globandformatBytesimports are necessary for the newparseJsonFilesfunctionality.
95-95: LGTM! Unused error variable removed.The change from
catch (error)tocatchis a good cleanup since the error isn't used in the silent fail pattern.
101-103: LGTM! Comment accurately reflects the new fallback role.The updated comment correctly describes that
parseSizeLimitOutputis now used for fallback support when JSON parsing isn't available.
- Ignore node_modules and .turbo in glob search - Improve size and limit value parsing - Add path as fallback for file name
- Ignore .size-limit.json in .gitignore - Correctly parse sizeLimit from JSON output
size-limit to JSON-based results for better reliability
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/actions/size-limit/src/utils/parser.ts (3)
10-61: Removeasynckeyword—no asynchronous operations are performed.The function is declared
asyncbut uses only synchronous operations (glob.sync(),fs.readFileSync()). This creates unnecessary overhead and misleading function signature.♻️ Proposed fix to make the function synchronous
-export async function parseJsonFiles(): Promise<SizeLimitResult[]> { +export function parseJsonFiles(): SizeLimitResult[] { const results: SizeLimitResult[] = [];
195-198: Address the control character warning in the ANSI regex.The regex contains control characters (
\u001b,\u009b) which triggers a linter warning. Consider using a well-tested library likestrip-ansiinstead of maintaining a custom regex pattern.♻️ Proposed fix using strip-ansi library
First, install the package:
npm install strip-ansiThen update the imports at the top of the file:
+import stripAnsi from 'strip-ansi';And replace the regex usage:
- const ansiRegex = new RegExp( - "[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]", - "g", - ); - for (const line of lines) { - const cleanLine = line.replace(ansiRegex, ""); + const cleanLine = stripAnsi(line);
119-299: Consider extracting helper functions to reduce complexity.The
parseSizeLimitOutputfunction handles multiple parsing formats in ~180 lines. While it works correctly, extracting helpers (e.g.,parseTableFormat,parseDirectFormat,stripFormatting) would improve maintainability and testability.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/actions/size-limit/src/utils/parser.ts.gitignore
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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 turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Avoid adding new dependencies without considering bundle size impact (target: <2kB gzipped, enforced limit: 2kB gzipped)
Applied to files:
.gitignore
📚 Learning: 2025-12-22T19:44:11.474Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.
Applied to files:
.github/actions/size-limit/src/utils/parser.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: Applies to **/*.{ts,tsx} : Prefer `Number.parseInt` over global `parseInt` (`useNumberNamespace` error)
Applied to files:
.github/actions/size-limit/src/utils/parser.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 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/utils/parser.ts
🧬 Code graph analysis (1)
.github/actions/size-limit/src/utils/parser.ts (3)
.github/actions/size-limit/src/types.ts (1)
SizeLimitResult(1-8)bin/sync-lib/fs-utils.js (1)
files(54-54).github/actions/size-limit/src/utils/size.ts (1)
formatBytes(65-71)
🪛 GitHub Actions: autofix.ci
.github/actions/size-limit/src/utils/parser.ts
[warning] 195-195: lint/suspicious/noControlCharactersInRegex: Unexpected control character in a regular expression.
⏰ 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). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (4)
.gitignore (1)
45-45: LGTM!The addition of
.size-limit.jsonto the ignore list is appropriate—it's a generated output file from the JSON-based size reporting workflow and should not be committed to version control. Placement is consistent with the existing size-limit section..github/actions/size-limit/src/utils/parser.ts (3)
51-51: Verify thatundefinedshould be treated as passing.The expression
item.passed !== falsetreatsundefined,null, andtrueall as passing (✅). Confirm this is the intended behavior for JSON outputs that may lack apassedfield.If you want to require an explicit
passedfield, consider:-status: item.passed !== false ? "✅" : "❌", +status: item.passed === true ? "✅" : "❌",
66-89: LGTM!The normalization logic correctly handles timestamps, symbols, parentheses, task patterns, and separators to extract clean package names.
94-114: LGTM!The function correctly discovers monorepo packages by reading top-level directories in the
packages/folder and extracting names frompackage.jsonfiles.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/actions/size-limit/src/utils/parser.ts (2)
11-19: Removeasynckeyword from function signature.The function is declared as
asyncbut contains no asynchronous operations—only synchronousglob.sync()andfs.readFileSync()calls. This is misleading and can cause confusion.♻️ Remove async keyword
-export async function parseJsonFiles(): Promise<SizeLimitResult[]> { +export function parseJsonFiles(): SizeLimitResult[] { const results: SizeLimitResult[] = []; const files = glob.sync("packages/**/.size-limit.json", {
56-58: Consider using stderr for debug output.Debug and error messages conventionally go to
stderrrather thanstdoutto avoid mixing with regular output.♻️ Use stderr for debug messages
} catch (error) { - process.stdout.write(`DEBUG: Failed to parse ${file}: ${error}\n`); + process.stderr.write(`DEBUG: Failed to parse ${file}: ${error}\n`); }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/actions/size-limit/src/package/names.ts.github/actions/size-limit/src/size-limit/run.ts.github/actions/size-limit/src/utils/parser.ts
✅ Files skipped from review due to trivial changes (1)
- .github/actions/size-limit/src/package/names.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/actions/size-limit/src/size-limit/run.ts
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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 turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
📚 Learning: 2025-12-22T19:44:11.474Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.
Applied to files:
.github/actions/size-limit/src/utils/parser.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: Applies to **/*.{ts,tsx} : Prefer `Number.parseInt` over global `parseInt` (`useNumberNamespace` error)
Applied to files:
.github/actions/size-limit/src/utils/parser.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
.github/actions/size-limit/src/utils/parser.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 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/utils/parser.ts
🧬 Code graph analysis (1)
.github/actions/size-limit/src/utils/parser.ts (2)
.github/actions/size-limit/src/types.ts (1)
SizeLimitResult(1-8).github/actions/size-limit/src/utils/size.ts (1)
formatBytes(65-71)
⏰ 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). (6)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
- GitHub Check: test-build (lts/*)
- GitHub Check: test-build (latest)
- GitHub Check: test-typesafety
- GitHub Check: Deploy-Preview
🔇 Additional comments (2)
.github/actions/size-limit/src/utils/parser.ts (2)
3-3: No changes needed.arkregexis actively maintained by the ArkType team and is properly declared as a dependency (v0.0.5 in package.json). The library is appropriate for ANSI escape sequence stripping, and the implementation is correct.
32-54: Clarify the expected JSON schema and remove unnecessary defensive checks.According to the official size-limit documentation, the
--jsonoutput includesname,passed(as a boolean), andsizefields. The code at line 36 checks for bothitem.sizeLimitanditem.limit, neither of which appear in size-limit's documented output. Similarly, the status logic at line 52 (item.passed !== false) is overly defensive—sincepassedis documented as a boolean, it will never be undefined or null in valid size-limit output.Confirm whether this code is intentionally designed to parse a non-standard schema, or if it should be simplified to match the documented size-limit format.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/actions/size-limit/src/utils/size.ts (1)
64-74: Consider aligning unit notation with the calculation base.The function uses 1024-based (binary) calculations but labels units with decimal notation ("kB", "MB"). For consistency with IEC standards, binary units should use "KiB", "MiB", "GiB", "TiB" notation.
♻️ Proposed fix to use IEC binary notation
// Format bytes to human readable string export const formatBytes = (bytes: number): string => { if (bytes === 0) return "0 B"; const k = 1024; - const sizes = ["B", "kB", "MB", "GB", "TB"]; + const sizes = ["B", "KiB", "MiB", "GiB", "TiB"]; const i = Math.min( Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1, ); return `${Number.parseFloat((bytes / k ** i).toFixed(2))} ${sizes[i]}`; };Alternatively, if you prefer SI decimal units, change the base to 1000 and keep the current labels.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
.github/actions/size-limit/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
.github/actions/size-limit/package.json.github/actions/size-limit/src/utils/size.ts
🧰 Additional context used
🧠 Learnings (19)
📓 Common learnings
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 turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management
Applied to files:
.github/actions/size-limit/package.json
📚 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/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts
Applied to files:
.github/actions/size-limit/package.json
📚 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/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` in package.json scripts
Applied to files:
.github/actions/size-limit/package.json
📚 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/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,js} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running scripts
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts
Applied to files:
.github/actions/size-limit/package.json
📚 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} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript and JavaScript files
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Avoid adding new dependencies without considering bundle size impact (target: <2kB gzipped, enforced limit: 2kB gzipped)
Applied to files:
.github/actions/size-limit/package.json
📚 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/package.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Always run `pnpm changeset` for version bumps in published packages instead of manually modifying package.json versions
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2026-01-09T19:22:20.281Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 704
File: examples/with-standard-schema/package.json:12-16
Timestamp: 2026-01-09T19:22:20.281Z
Learning: Examples in the examples/ directory should use version ranges (e.g., "^4.2.1") for dependencies, not exact version pins (e.g., "4.2.1").
Applied to files:
.github/actions/size-limit/package.json
📚 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/package.json
📚 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} : Use `Bun.$` template literal syntax for shell commands instead of `execa`
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Applied to files:
.github/actions/size-limit/package.json
📚 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 : Use `bun --hot` to run TypeScript entry files with hot module reloading enabled
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
Applied to files:
.github/actions/size-limit/package.json
📚 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/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module
Applied to files:
.github/actions/size-limit/package.json
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests
Applied to files:
.github/actions/size-limit/package.json
⏰ 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 (a11y)
- GitHub Check: test-e2e (e2e)
🔇 Additional comments (2)
.github/actions/size-limit/package.json (2)
10-10: Good change: pinned version improves reproducibility.Replacing
"latest"with a specific version range prevents unpredictable builds and ensures consistent type definitions across environments.
11-11: Both@types/node@25.0.6andglob@13.0.0are valid and available on npm as the latest versions of their respective packages. No action needed.
Summary by CodeRabbit
Chores
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.