Problem
When the decision tree fires a follow-up snippet (e.g. LCP-Subparts when LCP > 2.5s), the runner closes and relaunches the browser, re-navigating the page. This wastes time and risks different results across measurements.
Current flow
launch browser → navigate → evaluate [LCP, CLS] → close browser
→ launch browser → navigate → evaluate [LCP-Subparts] → close browser
Proposed flow
launch browser
→ navigate + waitMs
→ evaluate initial steps [LCP, CLS]
→ apply nextSteps(results) → follow-up items
→ evaluate follow-ups [LCP-Subparts] in same page (no re-navigation)
→ close browser
→ return { url, navMs, results: [...initial, ...followUps], pageErrors }
Implementation
runner.js current signature:
export async function runSnippets({ url, items, waitMs, headless, viewport })
New signature:
export async function runMeasurement({ url, workflow, rules, waitMs, headless, viewport })
Where rules is the array from decision-tree.js. The runner applies nextSteps() internally after the first round, within the same browser session.
Files
cli/src/runner.js — main refactor
cli/src/bin.js — update call site
Acceptance criteria
Problem
When the decision tree fires a follow-up snippet (e.g. LCP-Subparts when LCP > 2.5s), the runner closes and relaunches the browser, re-navigating the page. This wastes time and risks different results across measurements.
Current flow
Proposed flow
Implementation
runner.jscurrent signature:New signature:
Where
rulesis the array fromdecision-tree.js. The runner appliesnextSteps()internally after the first round, within the same browser session.Files
cli/src/runner.js— main refactorcli/src/bin.js— update call siteAcceptance criteria