Skip to content

refactor: take the circuit-breaker registry and metric labels back from core - #27

Merged
fylorn merged 1 commit into
devfrom
refactor/own-resilience
Sep 23, 2026
Merged

fylorn merged 1 commit into
devfrom
refactor/own-resilience

Conversation

@fylorn

@fylorn fylorn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

tw-resil turned out to be server-edition code parked in the MIT repository. The desktop gateway uses none of it:

  • retry has no caller in either tree.
  • cb_registry and metrics_labels are read and written only here.

So they come back:

  • cb_registry → think-watch-common, which both gateways and the dashboard already depend on.
  • metrics_labels → the gateway, its only user.
  • The retry re-export left in gateway/src/lib.rs had no callers and is deleted.

tw-resil is no longer a dependency; core deletes it next.

health.rs gains a note on why it is not merged with core's breaker. This one is shared across replicas through Redis and trips on an error rate over a window. The desktop one is in-process, trips on consecutive failures, bypasses itself for a single candidate and fails open. The premises are opposite, so there is no abstraction to share.

Verification: cargo fmt --check and cargo clippy --workspace --all-targets -D warnings are clean. cargo nextest run --workspace --lib --bins --tests passes 638 tests; the 6 new ones are the moved modules' own tests. The move changes no logic.

🤖 Generated with Claude Code

…om core

tw-resil turned out to be server-edition code parked in the MIT
repository. The desktop gateway uses none of it: `retry` has no caller
in either tree, and `cb_registry` and `metrics_labels` are read and
written only here. "Shared" code with one user is a second place to
change things, not a shared one.

- `cb_registry` returns to `think-watch-common`, which both gateways
  and the dashboard already depend on.
- `metrics_labels` returns to the gateway, its only user.
- The `retry` re-export in the gateway's lib.rs had no callers; gone.

tw-resil is no longer a dependency, so core can delete it.

`health.rs` gains a note on why it is not merged with core's breaker:
this one is shared across replicas through Redis and trips on an error
rate; the desktop one is in-process, trips on consecutive failures and
fails open. Opposite premises, so there is no abstraction to share.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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