Stop burying JSON output, and use the image already present when a pull fails - #36
Open
lefoulkrod wants to merge 2 commits into
Open
lefoulkrod wants to merge 2 commits into
lefoulkrod wants to merge 2 commits into
Conversation
A failing command has already said what went wrong, in the shape the caller asked for. Cobra then printed the entire usage block after it, which under --json put a wall of prose on stderr behind a single line of JSON — and status --json exits non-zero whenever Omnideck is not running, so that happened on an ordinary check of a stopped installation, not only on failure. Errors are now printed by Execute, which also lets the one error that carries no message exit quietly instead of leaving a bare "Error:" behind the output the caller asked for. Unknown flags and human-facing failures still explain themselves. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UuoUM7Fu1upEAJFsC3Ps1b
Creating an instance always pulled, and a pull that failed ended setup even when the image it wanted was already on the machine. That makes two ordinary things impossible: setting Omnideck up again without a network, and repairing an installation whose container is gone but whose image never went anywhere. A failed pull is now only fatal when the image is genuinely absent. When it is here, the step says so and carries on — an image named by digest cannot have changed since it was fetched, and one named by tag is no worse off than it was a moment ago. Both engines gain a presence check for this. Podman reports it through an exit status; Docker has no such command, so an inspect stands in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UuoUM7Fu1upEAJFsC3Ps1b
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 defects found while driving
--jsonfrom another program.What changed
Command output was buried under a usage dump.
SilenceUsagewas never set, so cobra printed the whole usage block after any command that returned an error fromRunE. Under--jsonthat put a wall of prose on stderr behind a single line of JSON.It fired on ordinary use rather than only on failure:
status --jsonexits non-zero whenever Omnideck is not running, so checking a stopped installation produced a full usage dump every time.Errors now print from
Execute, which also letserrAborted— the sentinel that carries no message — exit quietly instead of leaving a bareError:behind the output the caller asked for. Unknown flags and human-facing failures still explain themselves:Creating an instance always pulled, and a failed pull ended setup even when the image was already here. That makes two ordinary things impossible: setting Omnideck up again without a network, and repairing an installation whose container is gone but whose image never went anywhere.
A failed pull is now only fatal when the image is genuinely absent. When it is present the step reports
Using the copy already on this computerand carries on — an image named by digest cannot have changed since it was fetched, and one named by tag is no worse off than it was a moment ago.This adds
ImageExiststo the engine interface. Podman answers throughimage exists' exit status; Docker has no such command, so an inspect stands in.How it was tested
go test ./...,go vet ./...,gofmt— all cleanworkflow: the local image is used when the registry is unreachable, and an unreachable registry still fails with full cleanup when nothing is presentsetup→status→stop→startcycle driven non-interactively through--json, with the registry blocked, which is the case the second fix exists for. Before it, setup failed atpull_imagewithexit status 125despite the image being present.Not exercised on macOS or Windows. The Docker adapter change is symmetrical with the Podman one and covered by the existing cross-platform argument tests, but the
docker image inspectpath has not been run against a real Docker daemon.Release and security check
Both changes affect executed commands. The first alters only what is printed. The second adds one read-only command per engine (
podman image exists/docker image inspect) and changes when a pull failure is fatal — it never skips a pull, so an image is still fetched whenever it can be. No dependencies added.One consequence worth naming: a tag that has moved will not be re-fetched if the pull itself fails, so a repair in that state reuses the older local image rather than failing. That seemed better than refusing to repair at all, but it is a behaviour change.
Related
Filed separately while reviewing this surface: #28 (web port binds every interface), #29 (
JSON_MODE_SPEC.mdis referenced but absent), #30 (statusexit codes), #31 (container differs from the desktop's), #32 (removeargument style), #33 (no machine-readable version), #34 (errAbortedshape), #35 (ImageDigestconflates two states).Generated by Claude Code