Skip to content

Validate existing Docker network subnets#147

Merged
aidankhogg merged 1 commit into
dev/alphafrom
codex/update-substratehandler-to-validate-docker-subnet
Jun 29, 2026
Merged

Validate existing Docker network subnets#147
aidankhogg merged 1 commit into
dev/alphafrom
codex/update-substratehandler-to-validate-docker-subnet

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Motivation

  • Prevent silently reusing an existing Docker network that was created with a different IPAM subnet than the spec requests.

Description

  • Inspect existing Docker network net.attrs["IPAM"]["Config"] and collect any configured Subnet values when client.networks.get(name) succeeds.
  • Use ipaddress.ip_network(..., strict=False) to compare the configured subnet(s) to the requested subnet and allow reuse only when one matches exactly.
  • Raise SubstrateError with a clear message listing configured subnet(s), the expected subnet, and remediation guidance when no matching subnet is found or IPAM config is missing.
  • Added unit tests covering reuse on matching subnet, failure on mismatched subnet, and failure when IPAM config is absent.

Testing

  • Ran pytest tests/test_m1_handlers.py::TestSubstrateHandler -q and all tests passed (11 passed).
  • Ran formatting checks black netengine/handlers/substrate.py tests/test_m1_handlers.py and isort netengine/handlers/substrate.py tests/test_m1_handlers.py without changes needed.
  • The new unit tests verify matching-subnet reuse, mismatched-subnet rejection, and missing-IPAM-config rejection and succeeded.

Codex Task

@aidankhogg aidankhogg self-assigned this Jun 29, 2026
@aidankhogg aidankhogg added the bug Something isn't working label Jun 29, 2026
@aidankhogg aidankhogg merged commit 0871b29 into dev/alpha Jun 29, 2026
@aidankhogg aidankhogg deleted the codex/update-substratehandler-to-validate-docker-subnet branch June 29, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant