Skip to content

fix: report errors swallowed by stop, builder detection and the env probe - #62

Merged
aledbf merged 3 commits into
mainfrom
report-swallowed-errors
Nov 12, 2026
Merged

aledbf merged 3 commits into
mainfrom
report-swallowed-errors

Conversation

@aledbf

@aledbf aledbf commented Nov 12, 2026

Copy link
Copy Markdown
Member

Three errors the code dropped, found during the comment cleanup (#59). One commit each.

fix(cli): stop/down report a failed container lookup. stop and down (Go-only commands) ignored the errors of the container lookup, of the inspect that follows it, and of os.Getwd.

  • An engine that refused the list answered {"outcome":"success","result":"no-container-found"} with exit 0.
  • A container that couldn't be inspected was stopped as a plain container, even if it belonged to a Compose project.
  • Each case now ends in an error result. Tests: TestStopOrDownReportsALookupTheEngineRefused and TestStopOrDownReportsAContainerItCannotInspect (both fail on main).

fix(docker): no panic when the docker context can't be read. FindDockerDriverBuilder read the stdout of docker context inspect without checking the error. Run returns a nil result when the command doesn't start or the context is cancelled, so a Feature build on a docker-container builder could panic.

  • The failure now counts as "no current context", and the first docker-driver builder is still chosen, as when buildx ls names none for the current context.
  • This is Go-only behavior with no TS counterpart. Test: TestFindDockerDriverBuilderWhenTheContextCannotBeRead (panics on main).

fix(lifecycle): log why the user env probe failed. A probe that couldn't run left an empty environment and said nothing. TS (injectHeadless.ts runUserEnvProbe) also falls back to {}, but first writes the error with toErrorText; Go now does the same, through a new log.ToErrorText that reproduces TS's text (TestToErrorTextMatchesTheReference). TestProbedRemoteEnv now asserts the log line (fails on main).

Investigated, no change: finalStageName (falls back to the TS-identical regex path), the JSON log stringify failure (unreachable: Event always serializes) and jsonTruthy (only after V8-compatible validation; true routes to the parse error).

Validation (local)

  • task lint: pass.
  • task test:race with TMPDIR outside /tmp: pass.
  • task parity:contract: 104 pass. The 2 read-configuration.features-configuration-local-feature-* cases fail locally because of a /tmp/.git on the dev machine (same on main).
  • task test:e2e: everything passes except TestE2E_CABundle/container, which picked up another concurrent run's postCreateCommand (another URL and nonce) while other e2e runs shared the Docker daemon. It passes when run alone. This looks like an image-name collision between concurrent runs and is unrelated to this change.

🤖 Generated with Claude Code

aledbf and others added 3 commits November 12, 2026 19:40
stop and down dropped the error of the container lookup and of the
inspect that follows it, and of os.Getwd. An engine that refused the
list reported {"outcome":"success","result":"no-container-found"} with
exit 0, and a container that could not be inspected was stopped as a
plain container even when it belonged to a Compose project. Each now
ends in an error result.

stop and down are Go-only commands, so no reference behavior applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
FindDockerDriverBuilder read the stdout of `docker context inspect`
without checking its error, and Run returns a nil result when the
command does not start or the context is cancelled, so a Feature build
on a docker-container builder could end in a nil pointer panic. A
context that can't be read now counts as no current context, and the
first docker-driver builder is still chosen, as when `buildx ls` names
no builder for the current context.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the userEnvProbe could not run in the container, the lifecycle
commands got an empty environment and nothing said why. The reference
CLI (injectHeadless.ts runUserEnvProbe) also falls back to an empty
environment, but writes the error first with toErrorText; Go now does
the same, through a log.ToErrorText that renders TS's red text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aledbf
aledbf merged commit a00edfd into main Nov 12, 2026
13 checks passed
@aledbf
aledbf deleted the report-swallowed-errors branch November 12, 2026 23:09
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