Skip to content

refactor(eve): share local server supervision with eve acp - #1473

Draft
chadhietala wants to merge 1 commit into
mainfrom
simplify-commit-review-acp-cli
Draft

refactor(eve): share local server supervision with eve acp#1473
chadhietala wants to merge 1 commit into
mainfrom
simplify-commit-review-acp-cli

Conversation

@chadhietala

Copy link
Copy Markdown
Contributor

Found

  • cli/acp/command.ts copies cli/run.ts's idempotent closeServer latch byte for byte, and each file has its own loadStartHost dynamic import of createDevelopmentServer — nothing in cli/dev/ owned either.
  • runAcp types its input as the ACP server's own parameters, which admit a headers thunk, so it narrows typeof headers === "function" — a branch neither call site can reach, since both pass a plain record from resolveDevelopmentUrlTarget.
  • The authorization-header scan next to it re-implements the exported hasDevelopmentAuthorizationHeader already used by verified-remote-client.ts and client-options.ts.

Did
New cli/dev/supervised-server.ts owns createServerCloseLatch (getter-based, so each command keeps its own lifecycle ordering) and loadStartDevelopmentHost; typed runAcp's input as what the command passes and called the shared predicate. −34/+22 across 3 files.

Validated
1016 CLI unit tests pass, including run.test.ts's ACP cases (remote target without a local server, startHost args, close called once) and local-server-process.test.ts. No test changed. tsc --noEmit, lint, fmt, guard:invariants clean.

#1347's `eve acp` has to supervise a local development server the way
`eve dev` already does, and forked the code rather than sharing it: the
idempotent `closeServer` latch is byte-identical in both commands, and
each carries its own `loadStartHost` dynamic import of
`createDevelopmentServer`. Both commands stop the server from two
directions — a shutdown signal and their own `finally` — so both need
that idempotence, and nothing in `cli/dev/` owned it.

A new `cli/dev/supervised-server.ts` owns both: `createServerCloseLatch`,
which takes a getter so each command keeps its existing lifecycle
ordering (`eve dev` installs the latch before its shutdown signal, `eve
acp` after), and `loadStartDevelopmentHost`.

`runAcp`'s input was typed as the ACP server's own parameters, which
admit a headers *thunk*, so it had to narrow `headers` before use — but
both call sites pass a plain record from `resolveDevelopmentUrlTarget`,
making that branch unreachable. Typing the input as what the command
actually passes removes it, and the hand-rolled authorization-header scan
becomes a call to the exported `hasDevelopmentAuthorizationHeader` that
`verified-remote-client.ts` and `client-options.ts` already use.

Signed-off-by: Chad Hietala <chadhietala@gmail.com>
@chadhietala chadhietala added the simplify-devbox Simplification found by the automated devbox code review label Jul 31, 2026
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eve-docs Ready Ready Preview Jul 31, 2026 4:31pm
eve-docs-4759 Ready Ready Preview, v0 Jul 31, 2026 4:31pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

simplify-devbox Simplification found by the automated devbox code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant