Skip to content

engine: put an interface at the subprocess seam - #3

Merged
tdwd merged 1 commit into
mainfrom
engine-interface
Sep 7, 2026
Merged

engine: put an interface at the subprocess seam#3
tdwd merged 1 commit into
mainfrom
engine-interface

Conversation

@tdwd

@tdwd tdwd commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Behaviour-preserving refactor. No feature change.

What

Engine (backend.go) is now the vocabulary the UI speaks — seven calls, nothing about the wire format. claudeEngine is the implementation. The UI already worked in entry values and knew nothing about NDJSON, so this writes down a boundary that already existed.

newModel takes a launchConfig (launch.go) instead of six positional arguments. Four were adjacent strings, so transposing a mode and a session id was silent.

Why it is not speculative surface

The interface has a second implementation in this diff. fakeEngine drives the send path with no subprocess, which is what lets TestSendTurnAppliesTheReminderToTheWireOnly pin something an earlier self-review found unpinned: the transcript shows the typed text while the wire also carries the reminder. Verified discriminating — deleting the withReminder call from sendTurn fails the test.

Behaviour claim, checked

Every non-test hunk is a rename or argument plumbing. Nothing compares the engine against nil (grep 'engine == nil\|engine != nil' is empty), so promoting a pointer to an interface cannot flip a branch — the usual trap here.

Not verified

Tests and go vet only. I have not driven the built binary through a live turn, an approval and a diff.

Behaviour-preserving. Every non-test change is a rename or argument plumbing,
and no code compares the engine against nil, so promoting a pointer to an
interface cannot change a branch.

Engine is now the vocabulary the UI speaks: seven calls, nothing about the wire
format. claudeEngine is the implementation. The UI already worked in `entry`
values and knew nothing about NDJSON, so this only writes down a boundary that
was there.

It pays for itself immediately. fakeEngine drives the send path with no
subprocess, which is what lets a test assert the thing an earlier self-review
found unpinned: the transcript shows what the user typed, and the wire also
carries the standing-instruction reminder. Deleting the withReminder call from
sendTurn now fails a test instead of passing quietly.

newModel takes a launchConfig rather than six positional arguments. Four of them
were adjacent strings, where transposing a mode and a session id is silent, and
a new setting shifted every caller along.
@tdwd
tdwd merged commit 4cb0b5e into main Sep 7, 2026
1 check passed
@tdwd
tdwd deleted the engine-interface branch September 7, 2026 12:00
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