feat(frontend): keeper profitability scatter plot mechanism#655
Open
Adeolu01 wants to merge 1 commit into
Open
feat(frontend): keeper profitability scatter plot mechanism#655Adeolu01 wants to merge 1 commit into
Adeolu01 wants to merge 1 commit into
Conversation
Implements a resilient Keeper Profitability scatter plot that handles network partitions and RPC failures gracefully. - ResilientSource: wraps any economics fetcher with per-attempt timeouts, exponential backoff with full jitter, a circuit breaker, and a stale-while-error cache. It never rejects — every call resolves to a result with an explicit connection status (live, degraded, stale, offline) and a dropped-records count for partial data. - profitability.ts: pure, deterministic maths for profit/margin/ROI, linear scales, point projection, an OLS trend line, and summary statistics. - useKeeperProfitability: polling hook with in-flight cancellation and graceful degradation, stable against unstable config props. - KeeperProfitabilityChart: dependency-free SVG scatter plot with a break-even baseline, tier colouring, accessible focusable points and tooltips, a colour legend, summary panel, and a connection-status banner with manual retry. - 49 unit/integration tests; 97% statements / 93% branch coverage on the feature, plus documentation in docs/KEEPER_PROFITABILITY_SCATTER.md.
|
@Adeolu01 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! 🚀 |
|
@GBOYEE has applied to work on this issue as part of the Stellar Wave Program's 6th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @GBOYEE to this issue. |
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
Implements the Keeper Profitability Scatter Plot mechanism (issue #625): a reliable visualisation of keeper profit versus execution volume that handles network partitions and RPC failures gracefully.
All work is additive — no existing files are modified. New code lives under
frontend/src/lib/keeper-profitability,frontend/src/components/keeper-profitability, andfrontend/src/hooks/useKeeperProfitability.ts.Resilient data pipeline (
resilientSource.ts)The data source wraps any economics fetcher and never rejects — every call resolves to a result with an explicit connection status, so the chart keeps rendering through outages:
AbortControlleraborts a hung RPC.live → degraded → stale → offline) with TTL expiry.droppedRecords/degraded.Pure computation core (
profitability.ts)No I/O or DOM, fully deterministic: profit/margin/ROI, linear scales, point projection, an OLS trend line, and summary statistics — exhaustively unit tested.
React & UI
useKeeperProfitability: polling hook with in-flight cancellation and graceful degradation, stable against unstable config props.KeeperProfitabilityChart: dependency-free SVG scatter plot with a break-even baseline, tier colouring (profitable/break-even/loss), accessible focusable points with tooltips, a colour legend, a summary panel, and a connection-status banner with manual retry. Renders meaningfully in loading, live, degraded, stale, and offline states.Testing
Documentation
frontend/docs/KEEPER_PROFITABILITY_SCATTER.mddocuments the architecture, resilience model, plot semantics, and usage.Acceptance criteria
closes #625