You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ci: add Codecov bundle analysis via vite plugin - #3532
Adds Codecov bundle analysis with @codecov/vite-plugin. The plugin only runs on production builds (vite build) in GitHub Actions, and authenticates via GitHub OIDC (no upload token). The source-package job gets id-token: write for this. Local and dev/watch builds are unaffected. Plugin telemetry is disabled.
Concerns/issues
Forks: GitHub does not issue OIDC tokens to fork PRs, so the plugin stays off there.
Vite 7 override: the plugin declares vite 4–6 as peer dependency, the app uses vite 7. An npm overrides entry maps the peer to our vite version. Upstream issue: Support vite v7 codecov/codecov-javascript-bundler-plugins#264. Tested locally: the build works.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The project adds the Codecov Vite plugin as a development dependency and configures Vite to enable bundle analysis for production builds when ACTIONS_ID_TOKEN_REQUEST_URL is truthy. The plugin uses the bundle name cookbook, GitHub OIDC, and disabled telemetry. The source-package job now grants contents: read and id-token: write permissions. A new workflow runs on pushes to master or manual dispatch, installs the Node.js and npm versions specified in package.json, installs dependencies, and runs the build.
Priority: Low
Merge Risk: Low · previous review 8c97f
Bundle analysis is mergeable with owner awareness, but dependency installation should eventually be isolated from the OIDC-enabled upload to protect Codecov data integrity.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Linked Issues check
Issue #3502 requires installing and configuring Codecov Vite bundle analysis. The PR adds @codecov/vite-plugin, sets bundle name cookbook, and enables analysis for production builds with GitHub OI…
Configure the plugin with the issue's CODECOV_TOKEN and uploadToken requirements, or update issue #3502 to explicitly accept the implemented GitHub OIDC configuration as the replacement.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: adding Codecov bundle analysis through the Vite plugin.
Description check
The description includes the required Topic and Scope, Concerns/issues, and Formal requirements sections. It explains the OIDC setup, workflow behavior, Vite override, fork behavior, testing, and API …
Out of Scope Changes check
The dependency, Vite plugin configuration, OIDC permission, and bundle-analysis workflow all support the bundle-analysis objective in issue #3502. The workflow installs dependencies and runs the produ…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Description check
Explanation
The description includes the required Topic and Scope, Concerns/issues, and Formal requirements sections. It explains the OIDC setup, workflow behavior, Vite override, fork behavior, testing, and API impact.
Full details: Out of Scope Changes check
Explanation
The dependency, Vite plugin configuration, OIDC permission, and bundle-analysis workflow all support the bundle-analysis objective in issue #3502. The workflow installs dependencies and runs the production build that supplies the bundle data. No unrelated change is shown in the reviewed files.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)
Full details: Linked Issues check
Explanation
Issue #3502 requires installing and configuring Codecov Vite bundle analysis. The PR adds @codecov/vite-plugin, sets bundle name cookbook, and enables analysis for production builds with GitHub OIDC. However, the issue specifies CODECOV_TOKEN-based enablement and uploadToken: process.env.CODECOV_TOKEN. The reviewed configuration does not use either setting.
Resolution
Configure the plugin with the issue's CODECOV_TOKEN and uploadToken requirements, or update issue #3502 to explicitly accept the implemented GitHub OIDC configuration as the replacement.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Nitpick comments: 1
.github/workflows/tests.yml: 1
469-470: Trivial · Security & Privacy · Quick win
Pin the source-package job to least-privilege permissions.
The job runs for both pull_request and workflow_dispatch, checks out code, and runs make npm with CODECOV_TOKEN. Without permissions, its GITHUB_TOKEN scopes depend on repository or organization defaults. A manual dispatch is not subject to the fork pull-request read-only adjustment.
This does not prove that the current repository default grants write access, but the workflow should not depend on that external setting.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 10a2f55c-fd6d-4769-87c7-8071955ca1b1
Commits
Reviewing files that changed from the base of the PR and between 56213cf and df92407.
Files ignored due to path filters: 1
package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 3
.github/workflows/tests.yml
package.json
vite.config.js
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
@christianlupus the plugin is in place, but nothing gets uploaded yet. CODECOV_TOKEN is only set up for the codecov environment, which is limited to master, so PR builds get an empty token.
Would you be OK with making it available to PR builds? Either:
add CODECOV_TOKEN as a repo secret, or
allow all branches in the codecov environment (fork are not supported, which is what is wanted)
If you don't want to change the token scope, there is an other option actually:
Leave the token as it is and we could upload from the "Annotate test results" workflow, the same way coverage is uploaded, using Codecov's bundle analyzer on the built app. No token change, no vite override, but we only get file sizes, without the module breakdown (so less detailed report)
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: fdbc30ee-e7f3-42df-b427-a52dd42987c0
Commits
Reviewing files that changed from the base of the PR and between aa85fc8 and 13437fb.
Files selected for processing: 2
.github/workflows/tests.yml
vite.config.js
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
Disable lifecycle scripts during dependency installation.
Removing id-token: write disables the intended Codecov upload because vite.config.js requires ACTIONS_ID_TOKEN_REQUEST_URL. Keep the permission for make npm, but prevent dependency lifecycle scripts from running with it:
Suggested fix
- name: Install the NPM dependencies
shell: bash
run: >-
- npm ci+ npm ci --ignore-scripts
The locked esbuild packages still obtain the Linux binary through optional dependencies when scripts are disabled. The other install-script packages are optional platform support or unrelated development dependencies. The production command has no pre-build or post-build hook, so this preserves the intended build and upload flow.
A compromised dependency could otherwise upload forged bundle metrics. This could mislead bundle-regression analysis and review decisions, but it does not establish repository modification or broader compromise.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 00a0b198-de78-47a4-ada9-e0bcc2b75024
Commits
Reviewing files that changed from the base of the PR and between 13437fb and 77d0e38.
Files selected for processing: 1
.github/workflows/bundle-analysis.yml
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Topic and Scope
Closes #3502
Adds Codecov bundle analysis with
@codecov/vite-plugin. The plugin only runs on production builds (vite build) in GitHub Actions, and authenticates via GitHub OIDC (no upload token). Thesource-packagejob getsid-token: writefor this. Local and dev/watch builds are unaffected. Plugin telemetry is disabled.Concerns/issues
vite4–6 as peer dependency, the app uses vite 7. An npmoverridesentry maps the peer to our vite version. Upstream issue: Support vite v7 codecov/codecov-javascript-bundler-plugins#264. Tested locally: the build works.Bundle analysisworkflow builds on eachmasterpush (no tests) to upload the baseline bundle stats. Coverage baseline stays in Reactivate Codecov actions on trunk branches #3074.Formal requirements
AI disclosure
I used Ai for code gen