Skip to content

Drop the failover decorator nobody calls - #132

Merged
fylorn merged 1 commit into
mainfrom
refactor/drop-dead-failover
Sep 23, 2026
Merged

fylorn merged 1 commit into
mainfrom
refactor/drop-dead-failover

Conversation

@fylorn

@fylorn fylorn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

What

tw-resil::failover — 582 lines — is deleted.

FailoverProvider wraps a list of providers and switches on failure. Nothing calls it:

  • this repo: no references outside the file itself
  • the enterprise gateway (which depends on tw-resil): does its own failover in proxy::routing::select_route_with_failover. The only trace of this decorator there is a doc comment in the MCP gateway noting that its circuit breaker "mirrors the design of FailoverBackend"

No caller is also why it was still sitting on an AiProvider trait that is about to change shape — nothing broke, because nothing ran.

Why it is worth doing now

It takes tw-provider out of tw-resil's dependency list, leaving just tw-types.

That matters beyond the line count: nothing else in core could depend on tw-resil without dragging the whole provider layer in behind it. That constraint is what pushed the circuit-breaker consolidation out of the earlier shared-layer work.

What is deliberately not in here

The circuit breaker stays put. tw-resil::cb_registry and tw-gateway::health sound like duplicates and are not:

cb_registry a process-wide registry two gateways write into, so a dashboard can render live state. Makes no decisions
health the state machine: records success/failure, decides availability, tracks cooldown, filters candidates

Merging them is a separate question, and answering it properly means putting the enterprise gateway's own 460-line health.rs next to both — its fields don't line up with either.

cargo fmt --check, clippy --workspace --all-targets -- -D warnings, 85 test binaries green.

🤖 Generated with Claude Code

`tw-resil::failover` wraps a list of providers and switches on failure.
Nothing calls it. Not this repo, and not the enterprise gateway that
depends on tw-resil — that one does its own failover in
`proxy::routing::select_route_with_failover`, and the only trace of this
decorator over there is a doc comment in the MCP gateway saying it
mirrors the design.

582 lines with no caller, which is how it stayed on an `AiProvider`
trait that is about to change shape: nothing broke, because nothing ran.

Removing it takes `tw-provider` out of tw-resil's dependencies, so
tw-resil is down to tw-types. That matters beyond the line count: this
crate could not be depended on from the rest of core without dragging
the provider layer along with it.

The circuit breaker stays where it is. `tw-resil::cb_registry` and
`tw-gateway::health` sound like the same thing and are not — the first
is a process-wide registry two gateways write into so a dashboard can
render the state, the second is the state machine that decides whether
an upstream is usable. Merging them is a separate question, and it needs
the enterprise gateway's own 460-line `health.rs` in the comparison.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 589c7e3 into main Sep 23, 2026
3 of 4 checks passed
@fylorn
fylorn deleted the refactor/drop-dead-failover branch September 23, 2026 09:45
@fylorn fylorn mentioned this pull request Sep 23, 2026
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