refactor: take the circuit-breaker registry and metric labels back from core - #27
Merged
Merged
Conversation
…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]>
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.
tw-resilturned out to be server-edition code parked in the MIT repository. The desktop gateway uses none of it:retryhas no caller in either tree.cb_registryandmetrics_labelsare 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.retryre-export left ingateway/src/lib.rshad no callers and is deleted.tw-resil is no longer a dependency; core deletes it next.
health.rsgains 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 --checkandcargo clippy --workspace --all-targets -D warningsare clean.cargo nextest run --workspace --lib --bins --testspasses 638 tests; the 6 new ones are the moved modules' own tests. The move changes no logic.🤖 Generated with Claude Code