Skip to content

feat(orchestrator): HTTP POST /commands/submit endpoint#51

Merged
martinjms merged 1 commit intomainfrom
feat/controller-submission-endpoint
May 2, 2026
Merged

feat(orchestrator): HTTP POST /commands/submit endpoint#51
martinjms merged 1 commit intomainfrom
feat/controller-submission-endpoint

Conversation

@martinjms
Copy link
Copy Markdown
Collaborator

Adds the controller-facing submission endpoint to the existing HTTP server (formerly SSE-only). This is the wire the benchmark-controller (in arcane-scaling-benchmarks) uses to drive the orchestrator over the network.

Endpoints (unified on one port)

  • `GET /telemetry/stream` → SSE event-stream (existing)
  • `POST /commands/submit` → `dispatcher.submit` (new)

The new endpoint accepts a JSON `SubmitRequest {submitter, command}`, calls `dispatcher.submit`, and returns a JSON `SubmitResponse {seq, acks, missing}`. Optional — if no dispatcher was wired in, the endpoint returns `503 Service Unavailable`.

API surface

  • `serve(addr, source, dispatcher)` and `serve_bound` — unified server
  • `serve_sse` / `serve_sse_bound` aliases preserved for backward compat
  • `SubmitRequest` / `SubmitResponse` pub types for cross-crate consumption

Test plan

3 e2e tests in `tests/controller_submit_e2e.rs` spin up the full orchestrator (driver WS server + HTTP API server) on random ports, register a synthetic driver, POST a `SetPlayers` command via the HTTP endpoint, and verify the ack round-trips back through the wire. Covers happy path + 400 (no active drivers) + 503 (no dispatcher).

  • `cargo test -p arcane-swarm-orchestrator` — 61 passed (3 new + 58 prior)
  • `cargo clippy --all-targets -- -D warnings` clean
  • `cargo fmt --all -- --check` clean

🤖 Generated with Claude Code

Adds the controller-facing submission endpoint to the existing HTTP
server (formerly SSE-only). The endpoint accepts a JSON SubmitRequest
{submitter, command}, calls dispatcher.submit, and returns a JSON
SubmitResponse {seq, acks, missing}. Optional — if no dispatcher was
wired in, the endpoint returns 503 Service Unavailable.

This is the wire that the benchmark-controller (in arcane-scaling-
benchmarks) uses to drive the orchestrator over the network.

Routes on a single port:
- GET  /telemetry/stream  → SSE event-stream (existing)
- POST /commands/submit   → dispatcher.submit (new)

API additions:
- serve(addr, source, dispatcher) and serve_bound — the unified server
- serve_sse / serve_sse_bound aliases preserved for backward compat
- SubmitRequest / SubmitResponse pub types for cross-crate consumption

3 e2e tests in tests/controller_submit_e2e.rs spin up the full
orchestrator (driver WS server + HTTP API server) on random ports,
register a synthetic driver, POST a SetPlayers command via the HTTP
endpoint, and verify the ack round-trips back through the wire.
Companion to tests/ws_command_e2e.rs (driver-side wire) and
tests/dashboard_sse.rs (SSE wire).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@martinjms martinjms merged commit 6e34c07 into main May 2, 2026
1 check passed
@martinjms martinjms deleted the feat/controller-submission-endpoint branch May 2, 2026 19:16
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