feat(tasks): add act-on-lhci-artifact (data-driven perf companion)#19
Open
havardljohansen wants to merge 1 commit into
Open
feat(tasks): add act-on-lhci-artifact (data-driven perf companion)#19havardljohansen wants to merge 1 commit into
havardljohansen wants to merge 1 commit into
Conversation
New task that reads the real Lighthouse CI artifact (per docs/lighthouse-ci-vercel.md) and opens a PR fixing one concrete measured violation. Complements improve-performance (heuristic, source-read) without replacing it. ## What it does 1. Pre-flight: skip if open night-shift/lhci-fix PR exists for this scope. 2. Download the latest successful LHCI workflow artifact via `gh run download`. 3. Parse `lhr-*.json` reports for failing audits with concrete `details.items[]` pointing at specific files / resources. 4. Pick the highest-leverage one (mobile beats desktop, earlier key pages beat later, larger measured savings beats smaller). 5. Apply a small fix only — single component / image / config tweak. Exit silently on multi-file refactors. 6. Open a PR titled `night-shift/lhci-fix: <one-line>` with the audit ID, measured value, predicted impact, and verification checklist. ## Why a new task instead of folding into improve-performance - `improve-performance` is agent heuristic — it reads source and finds opportunities. Generic. Default-on. - `act-on-lhci-artifact` is data-driven — it consumes real Lighthouse measurements from preview deploys. Opt-in via `LHCI enabled: yes` in the project's Night Shift Config since not all projects have LHCI set up. - They catch different things and can coexist on the same project without conflict (each has its own slug-based dedup pre-flight). ## Config gating Project's `CLAUDE.md` Night Shift Config: ``` - LHCI enabled: yes - LHCI artifact source: github-actions # default; `vercel-comment` exits silently - LHCI workflow: lighthouseci.yml # filename; defaults to this ``` If `LHCI enabled` isn't `yes`, the task exits silently. Setup for LHCI itself lives in `docs/lighthouse-ci-vercel.md` (PR #4, still open). ## Manifest Slotted at `order: 4.5` (between improve-performance@4 and dep-audit@5) in the `audits` bundle. Same `scope: app`, `mode: pull-request`, `slug: lhci-fix`. ## Version Bumps NIGHT_SHIFT_VERSION 2026-05-19b → 2026-05-20a per AGENTS.md. Context for Per Andre: this is the response to "do you want to do a PR on using the Lighthouse CI artifact for Merkur project? Could also be a separate, new task" — went with the separate-task path since the existing improve-performance task is heuristic, not artifact-driven, and folding them would force every project to choose one or the other. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Response to your Slack question — "do you want to do a PR on using the Lighthouse CI artifact for Merkur project? Could also be a separate, new task, rather than merging into another". Went with separate task: the existing
improve-performanceis heuristic (agent reads source), this one is data-driven (real Lighthouse measurements). Folding them would force every project to pick one mode or the other.What lands
tasks/act-on-lhci-artifact.md— new task. Reads the latest LHCI workflow artifact viagh run download, parseslhr-*.json, picks one concrete failing audit (LCP > budget, CLS > 0.1, render-blocking, unused-JS > 50 KB, etc.) with a knowable root cause fromdetails.items[], opens a small PR with a targeted fix.manifest.yml— slotted atorder: 4.5(betweenimprove-performanceanddep-audit) in theauditsbundle.scope: app,mode: pull-request,slug: lhci-fix.skills/night-shift/SKILL.md— version bump 2026-05-19b → 2026-05-20a perAGENTS.mdrule.Why opt-in, not default-on
The task gates on project's
CLAUDE.mdNight Shift Config:If
LHCI enabledisn'tyes→ exit silently. Setup for LHCI itself stays indocs/lighthouse-ci-vercel.md(your PR #4, still open) — this task assumes that's already done.How it relates to existing tasks
improve-performanceact-on-lhci-artifact(new)LHCI enabled)perflhci-fixBoth can run on the same project without stacking — each has its own slug-based pre-flight.
Both rules from #18 applied to the new task spec
gh pr list --search "night-shift/lhci-fix in:title" --state open→ exit silently if one exists.Test plan
LHCI enabled: yesinmerkur-frontend's CLAUDE.md Night Shift ConfigRefs
docs/lighthouse-ci-vercel.md(PR docs: Lighthouse CI on Vercel preview deploys #4, still open)🤖 Generated with Claude Code