Skip to content

Add new event queues and use Queue enum throughout codebase#67

Merged
aidankhogg merged 8 commits into
dev/alphafrom
claude/session-planning-jxu73g
Jun 28, 2026
Merged

Add new event queues and use Queue enum throughout codebase#67
aidankhogg merged 8 commits into
dev/alphafrom
claude/session-planning-jxu73g

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Summary

This PR adds four new event queues to the system and refactors queue name references throughout the codebase to use the Queue enum instead of hardcoded strings. This improves type safety and maintainability.

Key Changes

  • New Queues Added:

    • AND_ADMISSIONS - for AND (Autonomous Network Device) admission events
    • PKI_CERT_ROTATION_EVENTS - for PKI certificate rotation events
    • DRIFT_EVENTS - for infrastructure drift detection events
    • WORLD_HEALTH - for world health monitoring events
    • Corresponding dead-letter queue (DLQ) variants for each new queue
  • Queue Enum Usage: Replaced hardcoded queue name strings with Queue enum references in:

    • netengine/phases/phase_ands.py - Updated 5 references to use Queue.AND_ADMISSIONS
    • netengine/core/drift_controller.py - Updated 1 reference to use Queue.DRIFT_EVENTS
    • netengine/monitoring/service.py - Updated 1 reference to use Queue.WORLD_HEALTH
    • netengine/workers/pki_cert_rotation_worker.py - Updated 1 reference to use Queue.PKI_CERT_ROTATION_EVENTS
  • Updated PRIMARY_QUEUES: Added the four new queues to the PRIMARY_QUEUES tuple for metrics/introspection endpoints

Implementation Details

  • All new queues follow the existing naming convention and are properly registered in both the primary queues list and with their corresponding DLQ variants
  • The refactoring maintains backward compatibility while improving code maintainability through centralized queue name management
  • No functional changes to queue behavior; this is purely a code organization and type safety improvement

https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x

claude added 5 commits June 28, 2026 22:01
Added AND_ADMISSIONS, PKI_CERT_ROTATION_EVENTS, DRIFT_EVENTS, and
WORLD_HEALTH (plus their DLQs) to the Queue enum and PRIMARY_QUEUES
tuple. Updated phase_ands, pki_cert_rotation_worker, drift_controller,
and monitoring/service to import and use Queue instead of bare strings,
eliminating the runtime risk of sending to unregistered queues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
Added _warn_unsupported() called from all three load_spec paths to emit
logger.warning for every field declared in the spec model but not yet
implemented: DNSSEC, CRL, OCSP, intermediate CA, real internet mode,
service mirrors, upstream resolver, cross-world federation, AND dynamic
IP/reverse DNS/BGP, and mail SPF/DMARC defaults. Includes 7 tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
Phase 9 had no entry in PHASE_PREREQUISITES, allowing OrgAppsPhaseHandler
to run before Phase 8 (ServicesPhaseHandler) completed. Added
world_services_output as a required prerequisite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
@aidankhogg aidankhogg self-assigned this Jun 28, 2026
The worker previously built CertTypeRotationConfig at startup and never
refreshed them, so live-reloading rotation_policy had no effect until
restart. Added _resolve_configs() which re-reads pki.rotation_policy
from state.world_spec on every loop iteration — picking up interval,
warning_days, and cert_type_overrides changes immediately after a
/reload. Falls back to initial configs on parse error. Added 6 tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
@aidankhogg aidankhogg added bug Something isn't working enhancement New feature or request labels Jun 28, 2026
@aidankhogg aidankhogg marked this pull request as ready for review June 28, 2026 22:20
claude added 2 commits June 28, 2026 22:26
…rotation-policy

Four previously missing API endpoints that allow targeted config updates
without a full spec reload:

- PUT /ands/{and_name}/profile — update AND profile and optional dns_suffix;
  validates profile exists in spec before applying
- PUT /services/{name} — enable/disable world services (mail, storage) in spec
- PUT /gateway — update real_internet_mode, upstream_resolver, cross_world_mode
  with enum validation on both mode fields
- PUT /pki/rotation-policy — patch any rotation policy fields; validates
  interval/warning values >= 1; picked up by the rotation worker on next
  iteration (reload-aware worker from prior commit)

17 tests added covering happy path, validation errors, and missing-state cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
…se SPF/DMARC warnings

mail_handler._inject_dns_records referenced spec.world_registry.initial_orgs
which does not exist (the field is organizations), causing SPF/DMARC/DKIM/MX
records to silently never be injected for any org. Fixed both references to use
the correct field name.

Also removed the loader warnings claiming SPF/DMARC were unimplemented — the
implementation was already present in mail_handler; the warnings were incorrect.
Updated the five matching test fixtures to use the correct field name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EDXqTHJNBVA9aHbgyQYj2x
@aidankhogg aidankhogg merged commit 7739c9c into dev/alpha Jun 28, 2026
10 checks passed
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