Skip to content

ci: harden Lighthouse budget execution - #1746

Merged
cursor[bot] merged 8 commits into
mainfrom
codex/lighthouse-hardening
Aug 8, 2026
Merged

ci: harden Lighthouse budget execution#1746
cursor[bot] merged 8 commits into
mainfrom
codex/lighthouse-hardening

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Restore the known-good CI-derived HeadlessChrome 151 Lighthouse baseline after the accidental Chrome 150 overwrite.
  • Bound the advisory local Lighthouse runner: 10 minutes for build, 2 for readiness, 28 for the complete measurement suite, and 120 seconds per Lighthouse child. Deadline exhaustion leaves missing evidence and fails closed while retaining artifacts.
  • Pin both CHROME_PATH and Playwright's executable path, expand perf-scope coverage for runner dependencies, and guard a mixed or empty browser baseline refresh.
  • Harden dispatch-only live Web Vitals input validation, cap the matrix at 30 Lighthouse calls, and bound each live child to 80 seconds with a 10-second termination grace. The PR budget remains advisory.

Verification

  • npm run test:ci-workflows — 13 files passed; 248 passed, 11 skipped.
  • npm run check:ci-scope, npm run check:github-actions, npm run check:branch-review-ledger, npm run verify:lighthouse -- --dry-run, and formatting checks.
  • npm run verify:pr-local reached its full unit suite but exited 1 only on 12 pre-existing Windows host assumptions: 11 pr-handoff-stop failures require Unix ln, and one mode-nav-addon-slot failure expects POSIX relative paths. The exact two suites reproduce the same 12 failures from clean origin/main at eda8fe872de040e304621bce49535e1dfebb091e.
  • UI verification not run: no UI, routing, styling, or browser-journey behavior changed.

Risk and rollout

  • Risk: Medium; CI timing, browser selection, baseline evidence, and dispatch-only live measurement limits change. Missing or expired evidence deliberately remains red rather than becoming a false pass.
  • Rollback: Revert cb2e7622e57e712ea155f1ad93adcf957384f483 to restore the previous runner and workflow behavior.
  • Provider or production effects: No deployment, production mutation, or live Web Vitals dispatch was performed. Opening this PR is the only GitHub-side action.

Notes

  • The Lighthouse review record is appended for eda8fe872de040e304621bce49535e1dfebb091e; no retrieval, ranking, clinical output, or provider-facing application behavior changed.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Lighthouse and Web Vitals reliability with consistent browser detection, validated routes, bounded execution times, and safer handling of individual measurement failures.
    • Preserved diagnostic artifacts and clearer warnings when measurements cannot complete.
    • Extended Chromium path compatibility across supported environments.
  • Documentation

    • Documented performance-testing time limits, validation rules, and failure behavior.
    • Updated script inventory and review records.
  • Tests

    • Added coverage for input validation, browser consistency, timeout handling, process cleanup, and CI safety checks.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:44 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: db2a989d-e222-4b28-b00e-347086d4b193

📥 Commits

Reviewing files that changed from the base of the PR and between 5186e0c and 967989a.

📒 Files selected for processing (1)
  • docs/branch-review-ledger.md
📝 Walkthrough

Walkthrough

This change hardens Lighthouse execution with shared deadlines, process cleanup, and bounded retries. It adds live Web Vitals input validation, enforces a single Chrome baseline, exports both Chromium path variables, and expands workflow tests and documentation.

Changes

Lighthouse hardening

Layer / File(s)Summary
Live measurement input validation
scripts/live-web-vitals-inputs.mjs, tests/live-web-vitals-inputs.test.ts, .github/workflows/live-web-vitals.yml, package.json
Validates origins, routes, slug collisions, samples, and total invocations before the matrix runs.
Lighthouse time budgets and process control
scripts/lighthouse-time-budget.mjs, scripts/run-lighthouse-budget.mjs, tests/check-lighthouse-budget.test.ts
Adds shared deadlines, bounded process timeouts, asynchronous measurements, process-tree cleanup, and deadline-aware retries.
Workflow and browser baseline enforcement
.github/actions/setup-lighthouse-chromium/action.yml, .github/workflows/ci.yml, .github/workflows/live-web-vitals.yml, tests/ci-cache-safety.test.ts
Exports both Chromium path variables, requires one Chrome baseline version, and bounds live workflow execution.
CI coverage and operational documentation
scripts/ci-change-scope.mjs, docs/testing.md, docs/scripts-index.md, docs/branch-review-ledger.md
Updates performance-change detection, timing documentation, script counts, review records, and validation coverage.

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

Sequence Diagram(s)

sequenceDiagram
participant Workflow as live-web-vitals.yml
participant Validator as live-web-vitals-inputs.mjs
participant Runner as run-lighthouse-budget.mjs
participant Lighthouse as Lighthouse process
Workflow->>Validator: Validate origin, routes, samples, and matrix size
Validator-->>Workflow: Export normalized inputs and timeout settings
Workflow->>Runner: Run bounded Lighthouse measurement cells
Runner->>Lighthouse: Start each cell with remaining suite timeout
Lighthouse-->>Runner: Return result or failure
Runner-->>Workflow: Preserve results and warnings until suite deadline
Loading

Possibly related PRs

Suggested reviewers:claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% 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 nameStatusExplanation
Title check✅ PassedThe title clearly and concisely describes the main change: hardening Lighthouse budget execution in CI.
Description check✅ PassedThe description includes the required summary, verification, risk and rollout, and notes sections with relevant evidence and scope details.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck 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 codex/lighthouse-hardening

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

@supabase

supabaseBot commented Aug 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:cb2e7622e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadscripts/run-lighthouse-budget.mjs Outdated
Comment thread.github/workflows/live-web-vitals.yml Outdated
Comment threadscripts/live-web-vitals-inputs.mjs
cursoragentand others added 5 commits August 8, 2026 16:44
- run-lighthouse-budget: spawn Lighthouse in an owned process group and
stopOwnedProcessTree on per-cell timeout instead of spawnSync timeout
(which only stopped the npx wrapper).
- live-web-vitals: export normalized ROUTES/SAMPLES to GITHUB_ENV; cap the
measurement loop with a 32-minute suite deadline inside the 45-minute job.
- Update contract tests for spawn-based measurement and whitespace samples.
The workflow now uses a dynamic run_timeout under the suite deadline;
update the focused CI contract test to match.
Conflict on lighthouse-budget.json: took main's fresher baseline numbers and
updatedAt; preserved this PR's runner hardening (time budget, process-tree
kill, live-web-vitals inputs, chrome-version uniqueness check, perf scope).
…resume)
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursorBot enabled auto-merge (squash) August 8, 2026 20:14
@cursor
cursorBot disabled auto-merge August 8, 2026 20:19
Resolve docs/scripts-index.md count-line conflict via docs:update after
absorbing main.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursorBot enabled auto-merge (squash) August 8, 2026 20:24

@coderabbitaicoderabbitaiBot 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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/run-lighthouse-budget.mjs (1)

143-155: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Enforce a wall-clock timeout for each readiness request.

http.get(..., { timeout }) only limits socket inactivity. Periodic response data can keep get() pending for 242 ms with a 100 ms timeout, so waitForServer can exceed its deadline. Add a timer that destroys the request, resolves once, and clears on every terminal path.

🤖 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 `@scripts/run-lighthouse-budget.mjs` around lines 143 - 155, Update get(url,
timeoutMs) to enforce a wall-clock timeout using a timer that destroys the
request and resolves with null when the deadline expires. Ensure resolution
occurs only once, and clear the timer on response completion, request timeout,
and request error while preserving the existing successful-response behavior.

Source: MCP tools

🤖 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 @.github/workflows/live-web-vitals.yml:
- Around line 137-155: Update the deadline calculation around run_timeout to
reserve the timeout command’s 10-second kill grace: define or reuse a kill-grace
value, stop the suite when remaining time is less than or equal to that grace,
and cap run_timeout at remaining minus the grace period before invoking
Lighthouse. Preserve the existing suite_expired handling and warning behavior.
In `@docs/testing.md`:
- Around line 200-204: Update the provider-access statement in the live workflow
documentation to clarify that neither workflow requires application secrets or
authenticated application-provider access. Remove the broader claim that neither
uses providers while preserving the surrounding descriptions of GitHub Actions,
npm, and deployed-origin access.
In `@scripts/run-lighthouse-budget.mjs`:
- Around line 401-403: Update the timeout handling around
stopOwnedProcessTree(child) to schedule a short-grace-period fallback that sends
SIGKILL to the same process group if the child remains alive after SIGTERM.
Track and clear both the existing termination timer and the force-kill timer
when the child closes, preserving the current Windows behavior and process-group
ownership logic.
---
Outside diff comments:
In `@scripts/run-lighthouse-budget.mjs`:
- Around line 143-155: Update get(url, timeoutMs) to enforce a wall-clock
timeout using a timer that destroys the request and resolves with null when the
deadline expires. Ensure resolution occurs only once, and clear the timer on
response completion, request timeout, and request error while preserving the
existing successful-response behavior.
🪄 Autofix

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: CHILL

Plan: Pro

Run ID: 89a9e8cd-cf05-45cf-a5fe-6e772a992b90

📥 Commits

Reviewing files that changed from the base of the PR and between 65cd909 and 5186e0c.

📒 Files selected for processing (14)
  • .github/actions/setup-lighthouse-chromium/action.yml
  • .github/workflows/ci.yml
  • .github/workflows/live-web-vitals.yml
  • docs/branch-review-ledger.md
  • docs/scripts-index.md
  • docs/testing.md
  • package.json
  • scripts/ci-change-scope.mjs
  • scripts/lighthouse-time-budget.mjs
  • scripts/live-web-vitals-inputs.mjs
  • scripts/run-lighthouse-budget.mjs
  • tests/check-lighthouse-budget.test.ts
  • tests/ci-cache-safety.test.ts
  • tests/live-web-vitals-inputs.test.ts

Comment thread.github/workflows/live-web-vitals.yml
Comment threaddocs/testing.md
Comment threadscripts/run-lighthouse-budget.mjs
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursorBot merged commit 7dd5540 into mainAug 8, 2026
26 checks passed
@cursor
cursorBot deleted the codex/lighthouse-hardening branch August 8, 2026 20:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@BigSimmo@cursoragent