Skip to content

Complete services org admission consumer#163

Merged
aidankhogg merged 1 commit into
dev/alphafrom
codex/complete-org-admission-consumer-implementation
Jun 29, 2026
Merged

Complete services org admission consumer#163
aidankhogg merged 1 commit into
dev/alphafrom
codex/complete-org-admission-consumer-implementation

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Motivation

  • Implement event-driven per-org provisioning for Phase 8 so newly admitted organizations get mail and storage resources created automatically and tracked.
  • Ensure robust handling of PGMQ messages with proper envelope parsing, DLQ archiving on failure, and delete-after-success semantics.

Description

  • Parse PGMQ messages as EventEnvelope and process only org.admitted events, extracting an org identifier and an optional per-org service_config override.
  • Add provisioning flows: _provision_org_services, _provision_org_mail_domain, and _provision_org_storage which call existing MailHandler/StorageHandler/PKIHandler APIs to create DNS records, buckets, credentials, and certificates and to track issued cert metadata in RuntimeState.
  • Persist per-org provisioning results into runtime_state.world_services_output and to Supabase tables mail_domains, storage_buckets, and service_provisioning via _persist_org_service_provisioning (with safe failure logging if DB is unavailable).
  • Implement DLQ and error handling mirroring existing patterns: delete messages only after successful provisioning, archive malformed or failed messages with archive_to_dlq, and log if DLQ archiving itself fails.
  • Add helper _service_enabled to resolve per-org enabled overrides from admission payloads.
  • Add unit and integration-style mocked tests in tests/test_phase_services_consumer.py covering success, ignored event types, malformed messages, provisioning failures, DLQ archiving failures, handler invocation, and persistence.

Testing

  • Ran formatter/linter checks with ruff format and ruff check on the modified files, which completed without issues.
  • Ran unit/mocked tests pytest -q tests/test_phase_services_consumer.py, which passed (7 tests).
  • Ran additional checks including tests/test_event_queue_dlq_mapping.py and the integration mail suite tests/integration/test_m8_mail.py together with the new tests, all of which passed in the CI run reported by pytest.

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 8f22204 into dev/alpha Jun 29, 2026
@aidankhogg aidankhogg deleted the codex/complete-org-admission-consumer-implementation branch June 29, 2026 23:35
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