Skip to content

fix(docker): treat only reference-specific errors as missing networks - #35

Merged
Aleksandergreg merged 1 commit into
mainfrom
fix/network-missing-detection
Sep 30, 2026
Merged

Aleksandergreg merged 1 commit into
mainfrom
fix/network-missing-detection

Conversation

@Aleksandergreg

Copy link
Copy Markdown
Owner

Problem

isMissingNetwork treated any Docker output containing "not found" as a missing network. When the selected Docker context is unavailable, the CLI prints context "x": context not found, and that was misread as a missing network:

  • docker_network_absent passed while the network still existed.
  • Close dropped the network from its retryable cleanup set, so all lab networks leaked once the context recovered.

This fix was committed on feat/docker-networks after #34 was squash-merged, so it is not in main or in release 0.8.0.

Fix

A network counts as missing only when Docker names the exact reference:

  • network <ref> not found (current engines, verified on Docker 29.7.2);
  • No such network: <ref> (older engines).

Every caller passes its exact reference: inspect, Close, and the orphan janitor. Context, transport, and CLI failures now propagate as errors.

Tests

  • Classification table built from real Docker 29.7.2 messages, including the exact context not found output.
  • Context failure and recovery: validation returns an error, and a retried Close removes every network after recovery.
  • The janitor's network removal path.

All three fail against the old substring match.

Validation (on main + this commit)

  • make check-all: passed, including race detection and the smoke test
  • OPSQUEST_DOCKER_TEST=1 go test ./internal/dockerlab -run Integration: all 6 passed on Docker Desktop 29.7.2
  • 0 OpsQuest-labeled containers or networks left afterwards

🤖 Generated with Claude Code

isMissingNetwork matched any Docker output containing "not found". When
the selected Docker context is unavailable, the CLI prints
`context "x": context not found`, and that was misread as a missing
network. docker_network_absent then passed while the network still
existed, and Close dropped the network from its retryable cleanup set,
so every lab network leaked once the context recovered.

A network now counts as missing only when Docker names the exact
reference: "network <ref> not found" (current engines) or
"No such network: <ref>" (older engines). Every caller passes its exact
reference (inspect, Close, and the orphan janitor), so context,
transport, and CLI failures now propagate as errors.

Regression tests cover:
- classification against messages captured from Docker 29.7.2;
- context failure and recovery, for both validation and Close;
- the janitor's network removal path.
All three fail against the old substring match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Aleksandergreg
Aleksandergreg merged commit 1fa140c into main Sep 30, 2026
3 checks passed
@Aleksandergreg
Aleksandergreg deleted the fix/network-missing-detection branch September 30, 2026 19:14
Aleksandergreg added a commit that referenced this pull request Sep 30, 2026
Main gained the squash-merged fix from #35 (1fa140c), which is identical
to this branch's fix commit (9a760c2). Both sides touched the files the
refactor later moved, so the three conflicts keep this branch's side:

- dockerlab_test.go stays deleted. Its contents, including the fix's
  context-failure fake fields, live in fake_runner_test.go and the
  related split test files.
- network.go keeps the refactored layout. The fixed isMissingNetwork
  lives in transport.go.
- network_test.go keeps the refactored layout. The fix's regression
  tests live in network_errors_test.go.

The merged tree is identical to a22146f, and make check-all passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aleksandergreg added a commit that referenced this pull request Sep 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.8.1](v0.8.0...v0.8.1)
(2026-09-30)


### Bug Fixes

* **docker:** treat only reference-specific errors as missing networks
([#35](#35))
([1fa140c](1fa140c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aleksandergreg <144420230+Aleksandergreg@users.noreply.github.com>
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