Skip to content

Split browser command runners into reusable browser execution primitives #764

@chubes4

Description

@chubes4

Problem

packages/runtime-playground/src/browser-command-runners.ts has become a large browser execution god module.

Evidence on current origin/main:

  • File is about 3453 lines.
  • Browser probe/action/editor/scenario flows all manage overlapping browser lifecycle, capture, summary, and artifact behavior.
  • browserProbePreviewRouting() is defined inside this module at packages/runtime-playground/src/browser-command-runners.ts:3123.
  • Preview routing is called with real args for probe/scenario at :235 and :1037, but editor/action paths call it with [] at :1524, :2016, :2207, and :2437.

Why It Matters

Browser evidence behavior can drift between command families. Preview routing, liveness, network capture, error handling, and artifact summary generation should be consistent unless a command explicitly opts out.

Suggested Refactor

Extract focused browser primitives:

  • browser-preview-routing.ts for local/public/secure preview routing.
  • browser-capture-session.ts for launch/context/page lifecycle and common artifact writes.
  • A typed browser run plan that probe/actions/editor/scenario commands can build from their input.

Keep legacy scenario/action field normalization at input boundaries only.

Acceptance Criteria

  • Preview routing has one owner and all browser commands pass through it consistently.
  • Browser lifecycle/capture setup is not repeated per command family.
  • Existing browser smoke tests continue to pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions