RIPEstat: add retry/resilience, stale-cache fallback and diagnostics (v0.4.2-alpha) - #28
Merged
Conversation
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.
Motivation
Description
backend/app/config.pyand.env.example:ripestat_timeout_seconds,ripestat_max_retries,ripestat_retry_backoff_seconds, andripestat_use_stale_cache_on_error, with sensible defaults.make_source_diagnostic(...)inbackend/app/core/source_diagnostics.pyto include optional fieldsretry_count,attempts,fallback_used,fallback_reason, andstale_cache_used.RipeStatClient.get_with_diagnostics(...)inbackend/app/services/ripe_stat_client.pyto implement timeout/retry/backoff logic using the new settings, retry only on timeout/502/503/504/transient network errors, classify HTTP429asRATE_LIMITED(capturingRetry-Afterwhen present), and optionally fall back to stale cache entries (keeping backward compatibility for older cache shapes).attempts=1,retry_count=0,fallback_used=false,freshness=LIVE).SourceDiagnostictype infrontend/src/types.tsand updatedReportView(frontend/src/components/ReportView.tsx) to display Attempts, Retries, Fallback and Stale Cache, plus a small warning UI when a fallback was used and a rate-limit hint when status isRATE_LIMITED.backend/app/templates/report.md.j2andbackend/app/templates/report.html.j2) to include the new diagnostics columns and a note when cached fallback data was used.Retry and Resiliencesection toREADME.md, addedv0.4.2-alphaentry toRELEASE_NOTES.md, and bumped versions tov0.4.2-alpha(UI) /0.4.2(packages/runtime).Testing
cd backend && pytest -q, which passed (73 passed, warnings unrelated to this change).cd frontend && npm run build, which completed successfully and produced a production build.backend/tests/test_ripe_stat_client.py(timeout->success, 503->success, 404 no-retry, 429 rate-limited withRetry-After, timeout + stale cache fallback, timeout without cache, and demo-mode behavior) and a test for the diagnostic shape inbackend/tests/test_source_diagnostics.py, and adjusted smoke tests to assert the newattemptsdiagnostic field; all automated tests passed.Codex Task