refactor(e2e): split the session half of a worker from the runner

Merged
KD
10h ago
+1345-1139

Stack 1/3: this PR → move into @e2e-dev/core → @e2e-dev/core API.

2026-11-15: rebased onto main 235986078 and the package renamed from e2e-core to @e2e-dev/core. Command output quoted below predates the rename.

A refactor inside packages/e2e with no behavior change. It separates the half of a worker that drives an engine from the half that runs tests, so the next PR can move the first half into its own package.

flowchart LR
  subgraph engine["session half (moves to @e2e-dev/core in 2/3)"]
    ES["EngineSessions<br/>engine init and dispose,<br/>attempt launch and close"]
    W["openWorker + WorkerPolicy"]
    A["launchAttempt + AttemptPolicy"]
    P["resolveProjectConfig"]
  end
  subgraph runner["runner half (stays in e2e)"]
    TE["TargetExecutor"]
    K["standalone-kinds.ts<br/>hosted, one-shot"]
    R["resolveConfig<br/>reporters, filters"]
  end
  TE -- extends --> ES
  K -- policy --> W
  K -- policy --> A
  R -- over --> P
  • run/engine-sessions.ts: EngineSessions takes engine init and dispose, and each attempt's session from launch to close, out of TargetExecutor, which now extends it.
  • run/standalone.ts and run/standalone-attempt.ts: the standalone worker takes a WorkerPolicy (who claims the engine, what runs its sessions) and an AttemptPolicy (identity, reserve, launched, closed hooks). The hosted (openHost) and one-shot (MCP) kinds move to run/standalone-kinds.ts, with the publication, soft failures, and host trace they own.
  • Config: resolveProjectConfig (config/resolve.ts) resolves everything but reporters and test filters. resolveConfig in the new config/resolve-run.ts adds those on top.
  • Types: ProjectConfig (types.ts) is E2EConfig without reporters and filters. E2EConfig, Report, Reporter, and the filter types move to src/run-types.ts. e2e exports ProjectConfig (changeset).
  • Smaller moves: describeTarget → run/provision.ts, TestIdentity/SkipInfo → run/records.ts, and pairRecording → internal/recording-modes.ts, so the session side never imports collect/.

Verified

Ran it locally: yes. A refactor shows no behavior on screen, so the evidence is the existing suites, unchanged, against the built packages:

  • pnpm test: e2e 4624 passed (unit and integration), web 810, mobile 531, every other package green.
  • Testbed through the built CLI (pnpm --filter @e2e-dev/testbed test): 588 passed, 1 skipped.
  • pnpm check passes.

🤖 Generated with Claude Code