Repository navigation
CLI: classify pod errors by code, client API level (client_api, update-required error) - #79
Merged
Merged
Conversation
The catalog gains BP0030 client_too_old; features.json gains api and min_client_api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One table in tcpclient maps every catalog code (BP0001-BP0030) to its refusal kind, so the exit code follows the code; a coded refusal's hint is the catalog's fix.cli. Text matching stays as the fallback for replies without a code, each match marked with the code that replaces it or "no code yet". The six "unknown cmd" checks (and four more) use one helper, isUnknownCommand (BP0002, else the text). The pinned lease_busy text is marked removed: firmware after 3.10.13 builds it from macros and sends BP0025 with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every JSON command (LAN, USB networking, a session, a raw-mode start and embeddedci.com's command channel) carries "client_api":1 and "client":"cli <version>". A status reply announcing an api above the CLI's (1, the embedded features.json api; none counts as 1) stops with "this pod's firmware <v> needs a newer benchpod CLI (...)" and exit code 6; a BP0030 refusal gives the same error. README: exit code 6 and how the update check works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the format out again in #191) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e commands still run status prints the update line as a warning instead of stopping, and flash-self, install-blobs, dfu, bootsel, discover and identity skip the check, so an old CLI can still show such a pod and update or roll back its firmware. The toggle is set before each command (SetAllowNewerPod). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes, in three commits:
PodErrorcarriedCodeandArgs, butClassifyRefusal,explainRefusalandtranslateRefusalonly looked at the text. Nowtcpclienthas one table from every catalog code (BP0001-BP0030) to its refusal kind, and the exit code follows the kind. A coded refusal shows the catalog's message andfix.clias the hint (refusalHint/codedRefusal). Text matching is kept only as the fallback for replies without a code. Each fallback has a comment naming the code that replaces it, or "no code yet".tcpclient.ClientAPI = 1, and a test checks it equals the embedded features.jsonapi. Every JSON command carries"client_api":1and"client":"cli <version>", on all four builders:Client.Command/Samples/Chunks,Session.Command,StartRaw(dap/uart raw starts), andcloudpod.Client.Command(embeddedci.com command channel, without the LAN lease). The USB console and SCPI send nothing. When a status reply announcesapi(ormin_client_api) above 1, the CLI stops with:this pod's firmware <version> needs a newer benchpod CLI (pod API n, this CLI handles 1): brew upgrade --cask benchpod, or download the latest release from https://github.com/embeddedci-com/benchpod-cli/releases/latestA pod without
apicounts as 1. A BP0030 reply gives the same error (an*UpdateRequiredError, not a*PodError). Commands that only talk to the server or work locally are not affected.New exit code
6: update the CLI. It is in the root help and in the README exit-code table. The README also has a new "Firmware newer than the CLI" section and explains coded refusals.Needs benchpod-firmware#191 for the
api/min_client_apifields and BP0030. Older firmware works as before: it ignores the request fields, announces no api (level 1) and never sends BP0030. The catalog and features.json are synced from that branch.Code to handling
isUnknownCommand(err): each command's "this firmware lacks X, update it" messagebenchpod ci: holder/purpose/left_s from argsbenchpod ci: run invalid (its own exit 4)*UpdateRequiredErrorEvery coded refusal's hint is the catalog's
fix.cliwith the args filled in. A code the CLI's catalog does not know (newer firmware) falls back to the text.Text matches left, and why
locked:,forbidden:(gates), barebusy,swd busy/uart busy/spi busy/ PSRAMbusy:(ClassifyRefusal,explainRefusal): no code yet.busy: a cloud job holdsandci_lease.goTrimPrefix("busy: "): fallback, BP0025 replaces them. Firmware 3.10.13 and older sends the cloud lease gate as text only.la voltage not set-> BP0001;need(s) gateware v55+-> BP0017;unknown cmd/unknown command-> BP0002;lease lost-> BP0026/BP0027: fallbacks for firmware without codes.I2C needs pull-ups,pin conflict:, the emulation-image hint,image switch refused:,reply too large(busmaster),loosen(policy, a server-relayed text),unknown target(cloudcfg): no code yet.The pinned
lease_busytext ininternal/fwrefusalsis markedremoved: 3.10.14. Firmware main (f7196d1) now builds that text from macros and sends BP0025 with it, so the literal check failed against firmware main.Tests
refusalHint,refusedErrorandwithRefusalHintshow the catalog message andfix.cli; BP0030 gives exit 6.IsUnknownCommandworks with the code and with the text.ClientAPIequals the embeddedapi.SetClientNamekeeps 32 printable characters.unknown cmdtext and a BP0002 reply with no text. The cloud keeps code/args.go vet ./...andgo test ./...pass, withBENCHPOD_FIRMWARE_DIRpointed at the firmware branch. No hardware was used.The cmd tests turn the client fields off in
TestMain, so the existing tests that compare whole requests stay as they are.TestEveryRequestCarriesTheClientFieldsturns them back on.🤖 Generated with Claude Code