Skip to content

refactor: extract dereference/validate pipeline from reconcile_airflow#795

Draft
adwk67 wants to merge 5 commits into
mainfrom
feature/validated-config-types-3
Draft

refactor: extract dereference/validate pipeline from reconcile_airflow#795
adwk67 wants to merge 5 commits into
mainfrom
feature/validated-config-types-3

Conversation

@adwk67
Copy link
Copy Markdown
Member

@adwk67 adwk67 commented May 12, 2026

Summary

  • Derive Ord/PartialOrd on AirflowRole so it can be used as a BTreeMap key
  • Extract external resource resolution (product image, auth, authz, internal secrets) into controller::dereference module with its own Snafu error enum
  • Extract product-config validation and config merging into validate_cluster(), producing a ValidatedAirflowCluster struct that proves all validation succeeded before any Kubernetes resources are created
  • ValidatedAirflowCluster owns the resolved product image and per-role/per-rolegroup merged configs; existing build functions are unchanged and receive parameters from the validated structs

Reviewer notes

  • dereference() and validate_cluster() contain no new logic — they are pure extractions of code that was previously inline in reconcile_airflow()
  • The ValidatedAirflowCluster struct intentionally has fewer fields than a full ownership model would (no name/namespace/uid/metadata validated types, no precomputed_pod_data). This is a "construct but decompose" fail-fast gate: built early in reconcile to prove validation passes, then its fields feed the existing unchanged build functions
  • The controller/ directory is introduced as a home for pipeline stages — currently just dereference, with validate and further stages to follow in later PRs
  • The Dereference wrapper variant in the controller's Error enum replaces 4 individual error variants (ResolveProductImage, InvalidAuthenticationConfig, InvalidAuthorizationConfig, InvalidInternalSecret) that moved into the new module's own error enum

Test plan

  • All 27 existing unit tests pass
  • Clean compile with no warnings
  • No behavioural changes — pure refactoring

🤖 Generated with Claude Code

adwk67 and others added 2 commits May 12, 2026 14:21
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move external resource resolution (product image, auth, authz, internal
secrets) into controller::dereference module with its own error enum.
Extract config validation and merging into validate_cluster(), which
produces a ValidatedAirflowCluster proving all product-config validation
succeeded before any Kubernetes resources are created.

The validated struct owns the resolved product image and per-role/
per-rolegroup merged configs. Existing build functions are unchanged
and receive their parameters from the validated structs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adwk67 adwk67 self-assigned this May 12, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant