Files
sisi/verifiers/real-world/lighthouse-budget.md
T
swaitsandClaude Fable 5.2 2fc1fe9c2d
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s
sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:29:02 -07:00

2.5 KiB

id, title, answers, rung, section, languages, kinds, cost, detect, ran_here, verified
id title answers rung section languages kinds cost detect ran_here verified
lighthouse-budget Lighthouse CI budgets and score assertions Is this page still within its performance, accessibility and best-practice budgets? 4 real-world javascript, any ui medium npx lhci --version no docs

Use when

  • Page weight, load time or Lighthouse scores matter and you changed scripts, images, fonts or markup.
  • You want a number with a limit, checked on every change.

Do not use when

  • The page needs a login you cannot script around; Lighthouse measures a single loaded page.
  • You want a verdict on user experience. Scores are a proxy.

Set up

npm i -D @lhci/cli

Create lighthouserc.json. Run it in an environment you can repeat (a CI container); local laptops give different timings.

Minimal example

lighthouserc.json

{
  "ci": {
    "collect": { "url": ["http://localhost:3000/"], "numberOfRuns": 3, "startServerCommand": "npm run start" },
    "assert": {
      "assertions": {
        "categories:performance": ["error", { "minScore": 0.9 }],
        "categories:accessibility": ["error", { "minScore": 1 }],
        "total-byte-weight": ["error", { "maxNumericValue": 500000 }]
      }
    }
  }
}

Several runs and the median handle noise. Prefer hard resource budgets (bytes, request counts), which do not wobble, over timing metrics. Record the current scores BEFORE you edit so you know the margin. lhci assert --preset=lighthouse:recommended is available as a starting set and individual assertions can be switched off (--assertions.uses-webp-images=off).

Run

npx lhci autorun (collect, assert, upload), or npx lhci collect && npx lhci assert.

Passing looks like: all assertions pass and exit 0. Failure prints each failed assertion with expected and actual values and exits nonzero.

As a contract check

{"id": "lighthouse", "claim": "The home page meets its Lighthouse budgets", "kind": "ui", "rung": 4,
 "cmd": "npx lhci autorun", "expect": {"exit": 0}, "tier": "deep", "timeout_s": 600}

What a pass does not prove

  • Lab results on one URL and one machine, not real users' devices and networks.
  • Timing scores vary between runs; a pass on three runs is not a guarantee.
  • Lowering a threshold to pass is a change to review, as in ratchet-floor.
  • Not run here (lhci is not installed). lhci assert, --preset and --assertions appear in the Lighthouse CI configuration docs; the JSON shape follows those docs.
  • Check the check: set minScore to 1 on performance and confirm it can fail.