Skip to content

fix: complete netengine down command + fix registry handler tests#32

Merged
aidankhogg merged 1 commit into
dev/alphafrom
claude/netengine-down-complete
Jun 26, 2026
Merged

fix: complete netengine down command + fix registry handler tests#32
aidankhogg merged 1 commit into
dev/alphafrom
claude/netengine-down-complete

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Summary

netengine down was partially implemented — it only scanned for netengines_* containers, missing netengine_coredns and netengine_gateway which use a different prefix. Also lacked --dry-run, zone file cleanup, and pgmq queue purging.

Registry handler tests were broken — fixtures patched non-existent module-level get_supabase attributes and set h._pgmq instead of h.pgmq, causing live Postgres connection attempts in unit tests.

netengine down changes (netengine/cli/main.py)

  • Add --dry-run flag: shows exactly what would be removed without touching anything
  • Fix container scan to cover both netengine_ and netengines_ prefixes (coredns/gateway use the former, all others the latter)
  • Use RuntimeState container IDs (dns_root_container_id, gateway_container_id, etc.) for precise targeted removal on top of the prefix scan
  • Add zone file cleanup: removes NETENGINE_ZONE_DIR (Corefile + zones/) on teardown
  • Add pgmq queue purge: calls pgmq.purge_queue() for all 6 queues and DLQs
  • Convert down() to async via asyncio.run(_down()) to support awaitable cleanup steps

Test fixes (tests/test_registry_handlers.py)

  • Pre-seed h._db = sb and h.pgmq = pgmq_mock directly on handler instances instead of patching module-level names that don't exist post-refactor
  • Remove unused patch and AsyncMock imports

Test plan

  • poetry run pytest — all 243 tests pass, 0 failures
  • netengine down --dry-run lists containers/networks/zones/queues without removing anything
  • netengine down with Docker running removes all netengine_* and netengines_* resources

🤖 Generated with Claude Code


Generated by Claude Code

netengine down:
- Add --dry-run flag to preview what would be removed
- Fix container scan to cover both netengine_ and netengines_ prefixes
  (coredns/gateway use netengine_, all others use netengines_)
- Use RuntimeState container IDs for precise targeted removal
- Add zone file cleanup (NETENGINE_ZONE_DIR directory)
- Add pgmq queue purge for all queues and their DLQs
- Convert synchronous down() to async via asyncio.run(_down())

test_registry_handlers:
- Fix WorldRegistryHandler and DomainRegistryHandler test fixtures:
  pre-seed h._db and h.pgmq directly instead of patching module-level
  names that don't exist; avoids spurious Postgres connection attempts
@aidankhogg aidankhogg self-assigned this Jun 26, 2026
@aidankhogg aidankhogg added bug Something isn't working enhancement New feature or request labels Jun 26, 2026
@aidankhogg aidankhogg merged commit 3c6d27c into dev/alpha Jun 26, 2026
3 checks passed
@aidankhogg aidankhogg deleted the claude/netengine-down-complete branch June 26, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants