Skip to content

chore(ci): enhance ci performance profiling and add new scripts - #197

Open
coryrylan wants to merge 1 commit into
mainfrom
topic-ci-checks
Open

chore(ci): enhance ci performance profiling and add new scripts#197
coryrylan wants to merge 1 commit into
mainfrom
topic-ci-checks

Conversation

@coryrylan

@coryrylan coryrylan commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

The median cold pnpm run ci duration is 84.20 seconds, down 19.25 seconds (18.6%) from the previous 103.45-second audit. All three samples completed 130 scripts without an incomplete command.

  • Introduced a new CI performance audit document to analyze and optimize the CI pipeline.
  • Added a ci:profile script to facilitate performance profiling.
  • Updated package.json and pnpm-lock.yaml to include new dependencies and scripts.
  • Enhanced existing scripts for better performance tracking and reporting.
  • Updated various project configurations to improve build and test processes.

Summary by CodeRabbit

  • New Features

    • Added CI performance profiling and reporting to help identify slow build steps.
    • Added optional bundle visualization for core builds.
    • Added dedicated type-checking support to the Nuxt starter.
  • Bug Fixes

    • Improved element detection so similarly named custom elements no longer trigger incorrect imports.
    • Prevented development-only example scripts and local bundles from appearing in production builds.
  • Improvements

    • Updated Next.js and Nuxt starter build configurations and dependencies.
    • Improved version reporting and expanded documentation for CI optimization workflows.

- Introduced a new CI performance audit document to analyze and optimize the CI pipeline.
- Added a `ci:profile` script to facilitate performance profiling.
- Updated `package.json` and `pnpm-lock.yaml` to include new dependencies and scripts.
- Enhanced existing scripts for better performance tracking and reporting.
- Updated various project configurations to improve build and test processes.

Signed-off-by: Cory Rylan <crylan@nvidia.com>
@coryrylan
coryrylan requested a review from johnyanarella July 29, 2026 22:20
@coryrylan coryrylan self-assigned this Jul 29, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds a cold CI profiling workflow and optimization guidance, updates CI and build configuration, refines site rendering behavior, fixes complete element-tag matching, and changes Next.js and Nuxt starter pipelines.

Changes

CI profiling workflow

Layer / File(s) Summary
Profiling workflow and analysis contract
.agents/skills/profile-ci/SKILL.md
Defines profiling modes, safety checks, artifact validation, analysis requirements, report structure, and validation commands.
Cold CI profiling engine
projects/internals/ci/ci-profile.js
Parses Wireit logs, aggregates repeated cold CI samples, collects metadata, persists logs, and writes JSON and Markdown reports.
CI target and profiling integration
package.json, projects/internals/ci/package.json, projects/core/package.json, projects/internals/vite/src/configs/build.bundle.js
Adds the profiling command, includes internals CI in the root CI target, configures internals tests, and makes bundle visualization explicitly opt-in.
Optimization guidance and vocabulary support
.agents/skills/profile-ci/references/optimization-playbook.md, config/vale/styles/config/vocabularies/Elements/accept.txt
Adds evidence-based optimization guidance and accepts profiling, build, and tooling terminology.

Site rendering and version data

Layer / File(s) Summary
Site assets and package version data
projects/site/eleventy.config.js, projects/site/src/_11ty/utils/version.js
Adjusts Eleventy passthrough behavior by run mode and derives package versions from project data.
Serve-only example rendering
projects/site/src/examples/index.11ty.js, projects/site/src/examples/index.test.ts
Extracts serve-mode example script rendering into a helper and tests build-mode omission and serve-mode injection.

Tooling and starter pipelines

Layer / File(s) Summary
Complete element tag matching
projects/internals/tools/src/internal/utils.ts, projects/internals/tools/src/internal/utils.test.ts
Uses complete extracted tag names for element imports and tests that longer tag names do not partially match.
Next starter build configuration
projects/starters/nextjs/eslint.config.js, projects/starters/nextjs/package.json
Adds generated-directory lint ignores, updates Next, and changes the build command and configuration input.
Nuxt typecheck and build wiring
projects/starters/nuxt/package.json, projects/styles/package.json
Separates Nuxt typechecking from building, updates package versions, and removes Lighthouse from the styles CI dependency chain.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested labels: scope(markdown)

Suggested reviewers: johnyanarella

Sequence Diagram(s)

sequenceDiagram
  participant ProfileCLI
  participant Mise
  participant WireitCI
  participant Metrics
  ProfileCLI->>Mise: run ci:reset and cold CI
  Mise->>WireitCI: execute CI with cache disabled
  WireitCI-->>ProfileCLI: stream Wireit timing logs
  ProfileCLI->>Metrics: aggregate samples and write reports
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: CI performance profiling plus new scripts and related CI updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch topic-ci-checks

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

projects/core/package.json

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

projects/internals/tools/src/internal/utils.test.ts

Parsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'.

projects/site/eleventy.config.js

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

  • 6 others

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.agents/skills/profile-ci/SKILL.md:
- Around line 31-36: Update the profiling instructions around ci:profile and
ci:reset to require explicit user approval after reviewing git clean -ndX
output, rather than treating the preview as consent. Allow an explicit
destructive-reset flag as an alternative, and do not invoke ci:reset until one
of these approvals is provided.

In `@projects/internals/ci/ci-profile.js`:
- Around line 203-205: The getMetadata() function reads Wireit’s package
metadata too early, before ci:reset reinstalls dependencies. Keep initial
worktree metadata separate from the Wireit version lookup, then read
node_modules/wireit/package.json only after the first reset or at profiling
completion, while preserving the initial worktree state.

In `@projects/internals/tools/src/internal/utils.ts`:
- Line 31: Update the tag-matching regular expression used to build elementTags
so the captured custom-element name must be immediately followed by whitespace,
"/", or ">". Preserve matching valid hyphenated tag names while excluding
namespaced or otherwise extended names such as nve-button:example.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 03f706fe-f624-4a8d-bd6a-cd0aec21c9dc

📥 Commits

Reviewing files that changed from the base of the PR and between 1521595 and 9d47583.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .agents/skills/profile-ci/SKILL.md
  • .agents/skills/profile-ci/references/optimization-playbook.md
  • config/vale/styles/config/vocabularies/Elements/accept.txt
  • package.json
  • projects/core/package.json
  • projects/internals/ci/ci-profile.js
  • projects/internals/ci/package.json
  • projects/internals/tools/src/internal/utils.test.ts
  • projects/internals/tools/src/internal/utils.ts
  • projects/internals/vite/src/configs/build.bundle.js
  • projects/site/eleventy.config.js
  • projects/site/src/_11ty/utils/version.js
  • projects/site/src/examples/index.11ty.js
  • projects/site/src/examples/index.test.ts
  • projects/starters/nextjs/eslint.config.js
  • projects/starters/nextjs/package.json
  • projects/starters/nuxt/package.json
  • projects/styles/package.json
💤 Files with no reviewable changes (1)
  • projects/styles/package.json

Comment on lines +31 to +36
3. Stop and ask before profiling if that preview includes user data, local assets, secrets, or other non-reproducible files. The profiler runs `pnpm run ci:reset`, which deletes ignored files and reinstalls dependencies before every sample.
4. Never stash, commit, discard, or clean tracked changes merely to make the profiler accept the worktree.
5. Use the clean command when the worktree is clean:

```shell
mise exec -- pnpm run ci:profile

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Require explicit approval before the destructive reset.

The ignored-file preview is not consent to delete every ignored path. Require confirmation after git clean -ndX (or an explicit destructive-reset flag) before invoking ci:reset; otherwise the skill can delete local data based on its own classification.

🧰 Tools
🪛 SkillSpector (2.4.4)

[warning] 114: [EA2] Autonomous Decision Making: Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Remediation: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.

(Excessive Agency (EA2))

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agents/skills/profile-ci/SKILL.md around lines 31 - 36, Update the
profiling instructions around ci:profile and ci:reset to require explicit user
approval after reviewing git clean -ndX output, rather than treating the preview
as consent. Allow an explicit destructive-reset flag as an alternative, and do
not invoke ci:reset until one of these approvals is provided.

Source: Linters/SAST tools

Comment on lines +203 to +205
function getMetadata() {
const cpuList = cpus();
const wireitPackage = JSON.parse(readFileSync(path.join(ROOT_DIR, 'node_modules/wireit/package.json'), 'utf8'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

jq -r '.devDependencies.wireit // .dependencies.wireit // empty' package.json

if test -f node_modules/wireit/package.json; then
  jq -r '.version' node_modules/wireit/package.json
else
  echo 'Wireit is unavailable before installation.'
fi

Repository: NVIDIA/elements

Length of output: 169


Delay the Wireit version lookup until after ci:reset. getMetadata() reads node_modules/wireit/package.json before dependencies are reinstalled, so a clean checkout can fail with ENOENT before the reset that installs Wireit runs. Keep the initial worktree state separately and read the installed version after the first reset or at the end of profiling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/internals/ci/ci-profile.js` around lines 203 - 205, The
getMetadata() function reads Wireit’s package metadata too early, before
ci:reset reinstalls dependencies. Keep initial worktree metadata separate from
the Wireit version lookup, then read node_modules/wireit/package.json only after
the first reset or at profiling completion, while preserving the initial
worktree state.

}

export function getElementImports(html: string, elements: Element[], lazy = false) {
const elementTags = new Set(Array.from(html.matchAll(/<([a-z][\w.-]*-[\w.-]+)/g), match => match[1]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Require a complete tag-name boundary.

The regex can extract nve-button from malformed or namespaced markup such as <nve-button:example>, causing an import even though the complete tag is not nve-button. Add a lookahead for whitespace, /, or > after the captured name.

Suggested fix
-  const elementTags = new Set(Array.from(html.matchAll(/<([a-z][\w.-]*-[\w.-]+)/g), match => match[1]));
+  const elementTags = new Set(
+    Array.from(html.matchAll(/<([a-z][\w.-]*-[\w.-]+)(?=[\s/>])/g), match => match[1])
+  );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const elementTags = new Set(Array.from(html.matchAll(/<([a-z][\w.-]*-[\w.-]+)/g), match => match[1]));
const elementTags = new Set(
Array.from(html.matchAll(/<([a-z][\w.-]*-[\w.-]+)(?=[\s/>])/g), match => match[1])
);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/internals/tools/src/internal/utils.ts` at line 31, Update the
tag-matching regular expression used to build elementTags so the captured
custom-element name must be immediately followed by whitespace, "/", or ">".
Preserve matching valid hyphenated tag names while excluding namespaced or
otherwise extended names such as nve-button:example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants