Collapse single-implementation Airflow trait layer - #697
Open
jvanbuel wants to merge 1 commit into
Open
Conversation
src/airflow/traits/ defined six operation traits plus an AirflowClient super-trait, all implemented solely by FlowrsClient. The module doc said the traits existed so "different API versions (v1 for Airflow v2, v2 for Airflow v3)" could each implement them, but that split was instead built inside FlowrsClient as an enum, so the abstraction never gained a second implementer. Convert the six impl blocks into inherent impls on FlowrsClient, replace Arc<dyn AirflowClient> with Arc<FlowrsClient> at every call site, and delete the traits module. The dyn indirection was type erasure over one concrete type, including in tests/common/mod.rs, so no polymorphism is lost. Drops the now-unused async-trait dependency from flowrs-tui; the client crate still uses it for AuthProvider, which has seven implementations. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0127jzUgqqy8JVX5RydfQxh8
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
Deletes
src/airflow/traits/— six operation traits (DagOperations,DagRunOperations,TaskInstanceOperations,LogOperations,DagStatsOperations,TaskOperations) plus theAirflowClientsuper-trait. Every one had exactly one implementer:FlowrsClient.Net: −187 lines, −1 direct dependency.
Why the abstraction never paid off
The module doc stated the intent:
That is not how the version split was built.
FlowrsClientis an enum, and every method dispatches internally:So the versioning the traits were designed for lives one layer down, and the trait layer sat on top adding a second dispatch mechanism over a single type.
Changes
impl XOperations for FlowrsClientblocks become inherentimpl FlowrsClientblocks. Method bodies are untouched.Arc<dyn AirflowClient>→Arc<FlowrsClient>across the worker,environment_state, andtests/common/mod.rs.#[async_trait]removed from those impls — inherentasync fnneeds no macro.async-traitdropped fromflowrs-tui's dependencies. It remains inflowrs-airflowforAuthProvider, which has seven implementations and is genuine polymorphism.On the
dynremovaltests/common/mod.rsreturnedArc<dyn AirflowClient>from its helpers, but only ever constructed aFlowrsClient. Thedynwas type erasure over one concrete type, not polymorphism, so nothing is lost. If a mock client is wanted later, reintroducing a trait at that point is cheap and can be shaped around the actual test need rather than guessed at in advance.Verification
cargo test --workspace --lib --bins(94 passing),cargo clippy --workspace --all-targets --all-features -- -D warnings, andcargo fmt --all --checkall clean. Clippy covers--all-targets, so the integration test crates compile too.🤖 Generated with Claude Code
https://claude.ai/code/session_0127jzUgqqy8JVX5RydfQxh8
Generated by Claude Code