Skip to content

Add phase lifecycle callbacks and DNS zone file validation tests#106

Merged
aidankhogg merged 2 commits into
dev/alphafrom
claude/progress-check-in-sc0z6l
Jun 29, 2026
Merged

Add phase lifecycle callbacks and DNS zone file validation tests#106
aidankhogg merged 2 commits into
dev/alphafrom
claude/progress-check-in-sc0z6l

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Summary

This PR enhances the orchestrator's phase execution with lifecycle callbacks for better observability and adds comprehensive DNS zone file validation tests. It also improves CLI output with real-time phase progress reporting.

Key Changes

Orchestrator Phase Callbacks

  • Added optional callback parameters to Orchestrator.execute_phases():
    • on_phase_start: Called before phase execution begins
    • on_phase_complete: Called after successful phase completion
    • on_phase_skip: Called when a phase is skipped (already completed)
    • on_phase_error: Called when a phase fails with the exception
  • Callbacks receive phase number, phase name (from PHASE_LABELS), and exception details (for error callback)

CLI Improvements

  • Enhanced netengine up command with real-time phase progress reporting
  • Added phase timing information (elapsed time in seconds)
  • Implemented visual feedback with colored output:
    • ✓ (green) for completed phases with duration
    • ⧗ (gray) for phases in progress
    • – (gray) for skipped phases
    • ✗ (red) for failed phases with error details
  • Wired all four lifecycle callbacks to the CLI for comprehensive progress tracking

DNS Handler Tests

Added five new test cases to TestDNSHandler validating DNS zone file generation:

  • test_root_zone_file_has_ns_delegation_per_tld: Verifies NS delegation records for each TLD
  • test_root_zone_file_has_glue_record_per_tld: Validates glue A records for TLD nameservers
  • test_root_zone_file_has_platform_delegation: Ensures platform.internal delegation
  • test_tld_output_has_listen_ip_per_tld: Confirms listen_ip configuration per TLD
  • test_tld_zone_files_have_correct_soa_and_ns: Validates SOA and NS records in TLD zone files

End-to-End Test

  • Added TestFullMVPLifecycle class with comprehensive lifecycle test covering:
    • Full 9-phase bootstrap with mock mode
    • Phase event tracking (start/complete/skip)
    • World spec persistence in state
    • Spec reload with new organization addition via API
    • Verification of successful reload without full re-bootstrap

Test Updates

  • Updated CLI tests to use flexible assertion patterns for callback parameters instead of strict assert_awaited_once_with() calls, allowing for additional callback parameters

https://claude.ai/code/session_01BZK9485jQhx93gzqv2DARZ

claude added 2 commits June 29, 2026 02:58
…, full lifecycle test

- Orchestrator.execute_phases() now accepts on_phase_start, on_phase_complete,
  on_phase_skip, on_phase_error callbacks so callers get live phase notifications
- netengines up wires these callbacks to click.echo with timing and colour,
  replacing the single silent block with per-phase ⧗/✓/✗ lines
- Add 5 DNS delegation chain unit tests to TestDNSHandler: NS delegation per
  TLD, glue A records, platform.internal delegation, listen_ip alignment, and
  TLD zone SOA+NS correctness
- Add TestFullMVPLifecycle.test_full_mvp_lifecycle: end-to-end mock bootstrap
  (all 9 handlers), callback firing verification, world_spec persistence, and
  live reload with a new org
- Fix test_cli.py execute_phases assertions to allow extra callback kwargs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZK9485jQhx93gzqv2DARZ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZK9485jQhx93gzqv2DARZ
@aidankhogg aidankhogg merged commit 4e42397 into dev/alpha Jun 29, 2026
1 of 5 checks passed
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.

2 participants