Chaos scenarios, retry jitter validation, timeout convergence tests, consensus reconciliation - #449
Merged
maugauwi-hash merged 2 commits intoAug 31, 2026
Conversation
…R automation Closes ethos-protocol#373: schedule NodeCache::check_and_resolve every 5 minutes, publish results as /metrics counters/gauge, and open an incident via incidents.rs when conflicts are found. Closes ethos-protocol#374: add a separate healthy-recovery threshold (hysteresis band) to health_routing so an endpoint needs several consecutive successes to re-enter rotation after being marked unhealthy, instead of flapping back in on a single success. Closes ethos-protocol#375: compute and store a SHA-256 checksum per backup at creation time (BackupValidator::register_backup) and verify it during validation, failing and opening an incident via incidents.rs on mismatch. Closes ethos-protocol#376: expose admin-only, confirmation-token-gated endpoints wrapping the DR runbook's failover trigger and backup-restore-validation steps (dr_automation.rs), with an audit history endpoint for post-incident review. Wires the previously-unused incidents.rs module into the crate and shares an IncidentState across all four features so conflicts/mismatches/failovers are tracked the same way a manually-filed incident would be.
|
@Haroldwonder Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…ethos-protocol#374-376 work The previous commit on this branch mistakenly addressed ethos-protocol#374/ethos-protocol#375/ethos-protocol#376, which are not assigned to this contributor and were already being worked by others. Reverts backend/src/health_routing.rs, backup_validation.rs, models.rs, routes.rs, and their docs to upstream, removes dr_automation.rs and docs/dr-automation.md entirely, and trims the shared scaffolding (AppState, SchedulerContext, lib.rs, main.rs, tests.rs) back down to just what ethos-protocol#373's consensus reconciliation needs. Adds the correct three issues: Closes ethos-protocol#370: add two chaos scenarios combining multiple simultaneous failure modes — cache + replica outage falling back via fallback::cascade instead of erroring, and circuit breaker + bulkhead interacting under concurrent load. Wires the previously-unused fallback.rs and bulkhead.rs modules into the crate to support this, which surfaced (and this fixes) a real bug in Bulkhead::acquire: it gated every request against max_queue_size even when a concurrency slot was immediately free, so max_queue_size: 0 rejected every request outright regardless of max_concurrent. Closes ethos-protocol#371: add RetryPolicy::validate() checking max_attempts, the base/max delay relationship, and multiplier sanity (finite, positive), used by the create-policy endpoint. Adds boundary/invalid-value tests and tests asserting computed delays stay within configured bounds for all three jitter modes. Closes ethos-protocol#372: add convergence tests for AdaptiveTimeoutManager — steady-state latency converges within min_samples iterations and then holds stable, the predictive EMA settles near the steady-state value, and a latency spike recovers to baseline once it ages out of the fixed-size rolling window. Documents these characteristics in docs/timeout-adaptation.md.
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.
Summary
Four reliability/testing fixes, each independently scoped:
Closes Add Chaos Testing Scenario for Cascading Failures #370 — Combined-failure chaos scenarios.
chaos.rsgains two scenarios: (1) cache + one replica down simultaneously, assertingfallback::cascaderoutes around both to a healthy target instead of erroring, with a heal/recovery check; (2) circuit breaker + bulkhead interacting under 20-way concurrent load, asserting no panics/deadlocks and that the breaker fast-rejects calls once tripped even after they've passed the bulkhead. This wires the previously-unusedfallback.rsandbulkhead.rsmodules into the crate, which surfaced a real bug inBulkhead::acquire: it gated every request againstmax_queue_size, even ones with an immediately-free concurrency slot, somax_queue_size: 0rejected all traffic outright regardless ofmax_concurrent. Fixed as part of this PR (seebulkhead.rsdiff) since it's exactly the kind of latent bug this issue exists to catch. Documented indocs/chaos-testing.md, including honest gaps (both scenarios drive the modules directly rather than through the live HTTP router).Closes Implement Retry Policy Jitter Bounds Validation #371 — Retry policy jitter/backoff validation.
RetryPolicy::validate()checksmax_attempts > 0,base_delay_ms <= max_delay_ms, and thatmultiplieris finite and positive (rejecting zero/negative/NaN/infinite, which would otherwise produce degenerate or blown-up backoff delays). Wired into thecreate_retry_policyendpoint. New tests cover boundary-valid and invalid configurations, plus delay-bounds tests for all three jitter modes (None/Full/Equal—Equalpreviously had no boundedness test at all).Closes Add Timeout Adaptation Convergence Test #372 — Timeout adaptation convergence tests. New tests confirm
current_timeoutconverges to the steady-state latency within exactlymin_samplesiterations and then holds stable (no oscillation), the predictive EMA settles near the steady-state value, and a latency spike recovers to baseline once it ages out of the fixed-size rolling window (afterwindow_sizefurther samples). Documented in a new "Convergence Characteristics" section indocs/timeout-adaptation.md.Closes Implement Consistency Verification Scheduled Reconciliation #373 — Scheduled consensus reconciliation.
scheduler.rsnow runsNodeCache::check_and_resolve()every 5 minutes, publishes the result as/metricscounters/gauge (ethos_protocol_consensus_checks_total,_conflicts_total,_consistent), and opens aSev3incident viaincidents.rswhen conflicts are found. This required wiring the previously-orphanedincidents.rsmodule into the crate (pub mod incidents;was missing) and mounting its HTTP API for the first time. Documented indocs/consistency-verification.md.Test plan
cargo check --lib --bin ethos-protocol-backend— clean (only pre-existing, unrelated warnings)cargo test --lib— 393 passed, 0 failed, including all new coverage and the fixedbulkhead::tests