Skip to content

One connection, one wiring profile, one name - #24

Merged
wardviaene merged 1 commit into
mainfrom
one-source-of-truth
Oct 9, 2026
Merged

wardviaene merged 1 commit into
mainfrom
one-source-of-truth

Conversation

@wardviaene

Copy link
Copy Markdown
Member

UX plan tier 4 for the CLI.

One connection: embeddedci:<name> everywhere it can work

--connection embeddedci:<name> (also BENCHPOD_CONNECTION and the saved default, which set-connection now accepts) runs the single-reply JSON commands through embeddedci.com via POST /api/benchpod/devices/{id}/command:

status, ping, la voltage, la pullup, la status, la step, generate, cloud ca show, cloud ca clear, cloud proxy (show/set/clear), plus the existing lan-policy, sig-policy, deregister.

  • New internal/cloudpod.Client has the same Command(ctx, req) method as tcpclient.Client; commands take a podCommander, so they do not branch per transport.
  • The name is looked up in the account's pod list. Auth: BENCHPOD_API_KEY (Authorization: ApiKey eci_...) else the benchpod login session. BENCHPOD_API_BASE picks the server, as in the SDK.
  • lease_held/device_busy exit 4, device_offline/device_reconnecting exit 5, forbidden_tier exit 3, each with a plain message.
  • capture, stream, measure, test, flash, spi-flash, register, cloud ca set, discover and the USB-only commands (set-wifi, show-network, clear-wifi, install-blobs, bootsel, dfu, flash-self) refuse a cloud connection and name what to use instead (web app, SDK/pytest over embeddedci:, or a LAN/USB connection). A saved embeddedci: default still lets the USB-only commands auto-detect USB.

One wiring profile

Over a network connection, flash (--swclk, --swdio, --nreset, --target) and spi-flash (--sck, --mosi, --miso, --cs) take the values you leave out from the pod's effective wiring profile (GET .../wiring/profile, falling back to .../wiring). This happens when you are signed in and the pod's cloud_status device id is on the account. Flags always win, the log names the source, and the lookup is bounded at 6 s with one warning line on failure.

One name

  • connWifi -> connNetwork, RequireWifi -> RequireNetwork, wifiClient -> networkClient (plus the new podClient). serial stays a hidden alias of usb.
  • User-visible text says "pod" (help, errors, logs); flags named after API fields (--device-name, --device-id) stay.

Shared config

config.json gets a compatible "version": 1 (written on save; missing means 1). The README documents it as shared with the SDK and MCP (location, keys, who reads it).

Other

  • gofmt -l . is clean (internal/fwrefusals/fwrefusals.go).
  • lan-policy, sig-policy and deregister also accept BENCHPOD_API_KEY (an explicit --token-file still wins).
  • README and help are updated. The embeddedci-server docs snapshot (webapp/src/docs/coverage/cli.json) needs a refresh: only text changed (shorts, usages, the set-connection use line). No flags were added or removed.

Tests

  • go vet ./... and go test ./... pass. The new httptest coverage is internal/cloudpod/cloudpod_test.go and cmd/benchpod-cli/podclient_test.go. A TestMain isolates XDG_CONFIG_HOME and the API env vars.
  • HW (read-only, pod lock held): on benchpod-baea06, status, la voltage and ping worked over both embeddedci:benchpod-baea06 and LAN 192.168.1.220. capture over cloud refused as intended. A flash dry run over LAN took SWCLK LA11 / SWDIO LA12 / nreset from the profile and stopped at the OpenOCD check.

🤖 Generated with Claude Code

- --connection embeddedci:<name> (flag, BENCHPOD_CONNECTION or the saved
  default) now works for the single-reply JSON commands: status, ping,
  la voltage, la pullup/status/step, generate, cloud ca show/clear and
  cloud proxy. They go through POST /api/benchpod/devices/{id}/command
  (internal/cloudpod, same Command method as tcpclient), signed in with
  BENCHPOD_API_KEY or the benchpod login session; BENCHPOD_API_BASE picks
  the server like the SDK. Lease, offline and role failures map to exit
  codes 4, 5 and 3. set-connection accepts embeddedci:<name>.
- Commands that need a stream, the pod's own port or USB (capture, stream,
  measure, test, flash, spi-flash, register, cloud ca set, discover and the
  USB-only commands) refuse a cloud connection and say what to use instead.
- flash (--swclk, --swdio, --nreset, --target) and spi-flash (--sck, --mosi,
  --miso, --cs) default the flags left out from the pod's wiring profile on
  embeddedci.com when signed in and the pod is on the account; flags win,
  the log names the source, a failed lookup is one warning line.
- Rename the "wifi" connection kind to "network" (connNetwork,
  RequireNetwork, networkClient); "serial" stays a hidden alias of "usb";
  user-visible text says "pod".
- config.json gets a "version": 1 field and is documented as shared with
  the SDK and MCP. lan-policy, sig-policy and deregister also take
  BENCHPOD_API_KEY.
- gofmt internal/fwrefusals/fwrefusals.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wardviaene
wardviaene merged commit aa43675 into main Oct 9, 2026
2 checks passed
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