Add pgmq_delete function and import missing handlers#6
Merged
Conversation
- phase_platform_identity.py: Add PKIHandler import (line 35 usage) - phase_registries.py: Add json import (line 67 json.loads usage) - api/app.py: Add DNSHandler import (line 158 usage) - handlers/and_handler.py: Add ipaddress import (line 33 usage) - migrations/001_initial.sql: Add pgmq_delete() RPC function for message acknowledgment All 69 existing tests pass. M4 handlers now compile and are ready for M3 integration. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X8FoC1a2wcbGVTE3jMwRg2
- Rewrote Orchestrator class to use proper BasePhaseHandler registry pattern
- Phase handlers (0-8) now properly registered in execution sequence
- execute_phases() implements loop with dependency checking, error handling, state persistence
- Uses healthcheck() and should_skip() from all handlers
- Proper PhaseContext DI for all handlers
- Completed Phase 3 and Phase 4 handlers with required abstract methods
- PKIPhaseHandler: Added should_skip() to check phase_completed[3]
- PlatformIdentityPhaseHandler: Added healthcheck() and should_skip()
- healthcheck() verifies Keycloak running + OIDC discovery endpoint responds
- Fixed Phase 7 handler import: BasePhaseHandler from _base, not handlers package
Orchestrator is now ready to execute full Phase 0-8 bootstrap sequence.
All 69 existing tests still passing.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X8FoC1a2wcbGVTE3jMwRg2
- Fixed Phase 4 handler RuntimeState attribute access - Changed context.runtime_state.get() to getattr() since RuntimeState is a dataclass - Fixed bootstrap_admin_password and keycloak_platform_container_id access patterns - Improved Phase 4 healthcheck method - Added proper async/await handling for aiohttp ClientSession - Added SSL context configuration to allow self-signed certs - Added proper timeout and exception handling for network errors - Returns False gracefully if container not running or not found - Fixed Phase 3 event emission - Changed correlation_id and parent_event_id to use getattr() with defaults - Prevents AttributeError if these fields don't exist on RuntimeState - Added comprehensive M3 integration tests (13 test methods) - TestPKIPhaseHandlerContract: Verify Phase 3 implements BasePhaseHandler interface - TestPlatformIdentityPhaseHandlerContract: Verify Phase 4 implements interface - TestM3OrchestratorIntegration: Verify handlers registered correctly in sequence - All tests passing, validates handler contracts and phase ordering Test results: 82 passed, 2 skipped (M3+ placeholder tests) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X8FoC1a2wcbGVTE3jMwRg2
Added comprehensive orchestrator tests validating: - Phase execution control - Skip already-completed phases - Respect up_to_phase limit (don't execute beyond it) - Mark phases complete after successful execution - Raise error on healthcheck failure - Persist error state to RuntimeState on failure - Phase sequencing and ordering - Phases ordered sequentially 0-8 - All 9 phases have handlers - Phase 3 executes before Phase 4 Test results: 90 passed, 2 skipped - M0-M2 tests: 69 passing (spec, substrate, DNS) - M3 tests: 21 new tests (13 handler contract + 8 orchestrator behavior) - 2 skipped placeholder tests (Phase 4-5 scaffolds) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X8FoC1a2wcbGVTE3jMwRg2
This was referenced Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new database function for message deletion and ensures all necessary handlers are properly imported across the codebase.
Key Changes
pgmq_delete()function to the initial migration schema that wraps thepgmq.delete()operation and returns a boolean statusDNSHandlerandPKIHandlerin their respective modules:DNSHandlerimported innetengine/api/app.pyPKIHandlerimported innetengine/phases/phase_platform_identity.pyipaddressmodule import inand_handler.pyandjsonmodule import inphase_registries.pyfor upcoming functionalityImplementation Details
pgmq_delete()function follows the same pattern as existing pgmq wrapper functions, providing a consistent interface for message queue operationshttps://claude.ai/code/session_01X8FoC1a2wcbGVTE3jMwRg2