Skip to content

gateway: switch and stop an engine through the keyed API - #141

Merged
T-Crypt merged 1 commit into
mainfrom
T-Crypt/gateway-switch-stop
Oct 22, 2026
Merged

T-Crypt merged 1 commit into
mainfrom
T-Crypt/gateway-switch-stop

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Step 2 of the switchboard plan: the actions a phone board will call, on the gateway's keyed API.

Change

  • POST /v1/berth/switch {"engine":"NAME"} starts the engine under a lease, the way a request for one of its models does. It answers 202 once the start is under way. Engines without a start command get a 404.
  • POST /v1/berth/stop {"engine":"NAME"} sends berthd's OpStop, the same request-boundary drain as berth stop, and answers 202 with the lease IDs.
    • A pinned holder (a game, a render, berth hold) gets a 409; Berth never stops one from the network. berth stop in a terminal is unchanged.
    • An engine that is not running gets a 409, and berthd not answering gets a 503.
  • The /gui/ board's Launch now calls the same switchTo, so there is one start path. Its body moved out of guiWake unchanged.
  • docs/gateway.md gets a section, plus a CHANGELOG entry.

Proof

  • TestSwitchThenStop: a switch puts the engine on the card as an active lease, and a stop frees it.
  • TestSwitchStopRefusals: unknown engine, engine with no start, bad JSON, a stop on a pinned lease (the lease stays active), and a stop on an engine that isn't running.
  • Both fail on main (switch = 404) and pass here. -race -count=5 passes with the existing GUI tests.
  • build, gofmt, vet, go test ./..., Windows build and vet, golangci-lint (0 issues).

Not run against the live gateway: it currently holds strata-sc117 on the card, and a second gateway would drain it.

POST /v1/berth/switch starts an engine under a lease without a prompt,
and POST /v1/berth/stop asks berthd to give its card back, the same
drain as berth stop. A stop from the network never touches a pinned
lease. The /gui/ board's Launch now calls the same switch, so the board,
scripts and the harbor's coming switchboard all switch the card one way.
@T-Crypt
T-Crypt merged commit 2a90e5a into main Oct 22, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/gateway-switch-stop branch October 22, 2026 13:59
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