Skip to content

FE-1110: Consolidate executor sandbox port internals#276

Merged
kostandinang merged 4 commits into
ka/fe-1109-cook-sandboxfrom
ka/fe-1110-executor-port-internals
Jul 1, 2026
Merged

FE-1110: Consolidate executor sandbox port internals#276
kostandinang merged 4 commits into
ka/fe-1109-cook-sandboxfrom
ka/fe-1110-executor-port-internals

Conversation

@kostandinang

Copy link
Copy Markdown
Contributor

Follow-up cleanup on top of #275. No behavior change.

What changed

  • Drop dead cwd field from TestRunArgs — it was never read.
  • Share one subprocess runner — extracted src/app/command-runner.ts so the git worktree port and test runner port stop duplicating spawn logic. Git spawn-error behavior preserved (covered by a new test).
  • Share test fakes — port test doubles that were copied across three test files now live in src/executor/__tests__/fake-ports.ts.

Verification

npm run verify passes: 165 test files, 1111 tests, build ok.

@cursor

cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Refactor and interface narrowing only; behavior preserved and covered by existing port and executor tests plus a new git spawn-error case.

Overview
Follow-up cleanup that deduplicates executor sandbox plumbing without changing cook run behavior.

Shared subprocess runner: New src/app/command-runner.ts centralizes spawn-based execution with a spawnError field on spawn failures. createGitWorktreePort and createTestRunnerPort both use it instead of copy-pasted runCommand helpers. Git failure messages now fall back to spawnError when stderr/stdout are empty (new test covers spawn git ENOENT).

Narrower test port contract: TestRunArgs drops unused cwd; verify still runs with cwd: worktreeDir. ingestTestResult and port tests call testRunner.run({ worktreeDir }) only.

Shared test doubles: createFakeGitWorktreePort / createFakeTestRunnerPort live in src/executor/__tests__/fake-ports.ts (git fake accepts an optional custom create); registry and worktree tests import them instead of local copies.

Also removes obsolete memory/REFACTOR.md planning doc.

Reviewed by Cursor Bugbot for commit a3edf51. Bugbot is set up for automated code reviews on this repo. Configure here.

@kostandinang kostandinang self-assigned this Jul 1, 2026
The test runner runs inside the worktree, so the repo-root cwd was dead
weight carried only for shape-symmetry with GitWorktreeCreateArgs. Remove
it from the port arg type, the executor call site, and the port tests.
Pure interface tidy; no behavior change. (REFACTOR.md commit 1/3)
Both execution ports duplicated the same spawn-based subprocess runner.
Extract it into a single command-runner module (spawn wrapper +
CommandResult carrying an explicit spawnError signal); the git-worktree
and test-runner ports now keep only their command/args and result mapping.

Behavior preserved: the git port still surfaces its spawn-error text, now
via a spawnError fallback, locked by a new git spawn-failure test.
(REFACTOR.md commit 2/3)
Three copies of the port fakes existed: the shared fake-ports helper, a
parametrized inline fake in the worktree test, and local copies in the
extension registry test. Parametrize the shared git-worktree fake with an
optional create override, then point the worktree and registry tests at
the shared helpers and delete their local duplicates. (REFACTOR.md commit 3/3)
REFACTOR.md was a temporary execution aid; all three commits landed.
@kostandinang kostandinang force-pushed the ka/fe-1109-cook-sandbox branch from 8ee8fe2 to 4434358 Compare July 1, 2026 02:33
@kostandinang kostandinang force-pushed the ka/fe-1110-executor-port-internals branch from ec60195 to a3edf51 Compare July 1, 2026 02:33
@kostandinang kostandinang merged commit c2bf4bc into ka/fe-1109-cook-sandbox Jul 1, 2026
6 checks passed
@kostandinang kostandinang deleted the ka/fe-1110-executor-port-internals branch July 1, 2026 02:35
kostandinang added a commit that referenced this pull request Jul 1, 2026
The FE-1089 handoff described the descriptive scaffold as still in
progress; it is now superseded (PRs #274/#275/#276 open, executor arc
underway). Handoff files are volatile transfer state, so retire it.
kostandinang added a commit that referenced this pull request Jul 1, 2026
* FE-1110: Drop unused cwd from TestRunArgs

The test runner runs inside the worktree, so the repo-root cwd was dead
weight carried only for shape-symmetry with GitWorktreeCreateArgs. Remove
it from the port arg type, the executor call site, and the port tests.
Pure interface tidy; no behavior change. (REFACTOR.md commit 1/3)

* FE-1110: Extract shared app-layer command-runner

Both execution ports duplicated the same spawn-based subprocess runner.
Extract it into a single command-runner module (spawn wrapper +
CommandResult carrying an explicit spawnError signal); the git-worktree
and test-runner ports now keep only their command/args and result mapping.

Behavior preserved: the git port still surfaces its spawn-error text, now
via a spawnError fallback, locked by a new git spawn-failure test.
(REFACTOR.md commit 2/3)

* FE-1110: Consolidate port test fakes onto shared fake-ports

Three copies of the port fakes existed: the shared fake-ports helper, a
parametrized inline fake in the worktree test, and local copies in the
extension registry test. Parametrize the shared git-worktree fake with an
optional create override, then point the worktree and registry tests at
the shared helpers and delete their local duplicates. (REFACTOR.md commit 3/3)

* FE-1110: Remove completed refactor plan

REFACTOR.md was a temporary execution aid; all three commits landed.
kostandinang added a commit that referenced this pull request Jul 1, 2026
* FE-1110: Drop unused cwd from TestRunArgs

The test runner runs inside the worktree, so the repo-root cwd was dead
weight carried only for shape-symmetry with GitWorktreeCreateArgs. Remove
it from the port arg type, the executor call site, and the port tests.
Pure interface tidy; no behavior change. (REFACTOR.md commit 1/3)

* FE-1110: Extract shared app-layer command-runner

Both execution ports duplicated the same spawn-based subprocess runner.
Extract it into a single command-runner module (spawn wrapper +
CommandResult carrying an explicit spawnError signal); the git-worktree
and test-runner ports now keep only their command/args and result mapping.

Behavior preserved: the git port still surfaces its spawn-error text, now
via a spawnError fallback, locked by a new git spawn-failure test.
(REFACTOR.md commit 2/3)

* FE-1110: Consolidate port test fakes onto shared fake-ports

Three copies of the port fakes existed: the shared fake-ports helper, a
parametrized inline fake in the worktree test, and local copies in the
extension registry test. Parametrize the shared git-worktree fake with an
optional create override, then point the worktree and registry tests at
the shared helpers and delete their local duplicates. (REFACTOR.md commit 3/3)

* FE-1110: Remove completed refactor plan

REFACTOR.md was a temporary execution aid; all three commits landed.
kostandinang added a commit that referenced this pull request Jul 1, 2026
* FE-1110: Drop unused cwd from TestRunArgs

The test runner runs inside the worktree, so the repo-root cwd was dead
weight carried only for shape-symmetry with GitWorktreeCreateArgs. Remove
it from the port arg type, the executor call site, and the port tests.
Pure interface tidy; no behavior change. (REFACTOR.md commit 1/3)

* FE-1110: Extract shared app-layer command-runner

Both execution ports duplicated the same spawn-based subprocess runner.
Extract it into a single command-runner module (spawn wrapper +
CommandResult carrying an explicit spawnError signal); the git-worktree
and test-runner ports now keep only their command/args and result mapping.

Behavior preserved: the git port still surfaces its spawn-error text, now
via a spawnError fallback, locked by a new git spawn-failure test.
(REFACTOR.md commit 2/3)

* FE-1110: Consolidate port test fakes onto shared fake-ports

Three copies of the port fakes existed: the shared fake-ports helper, a
parametrized inline fake in the worktree test, and local copies in the
extension registry test. Parametrize the shared git-worktree fake with an
optional create override, then point the worktree and registry tests at
the shared helpers and delete their local duplicates. (REFACTOR.md commit 3/3)

* FE-1110: Remove completed refactor plan

REFACTOR.md was a temporary execution aid; all three commits landed.
kostandinang added a commit that referenced this pull request Jul 1, 2026
The FE-1089 handoff described the descriptive scaffold as still in
progress; it is now superseded (PRs #274/#275/#276 open, executor arc
underway). Handoff files are volatile transfer state, so retire it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant