Skip to content

fix(#551): trend labels, dedup persistence, recommendation unification - #565

Open
TomikeDS wants to merge 1 commit into
StellarCommons:mainfrom
TomikeDS:fix/analytics-recommendation-alerts
Open

fix(#551): trend labels, dedup persistence, recommendation unification#565
TomikeDS wants to merge 1 commit into
StellarCommons:mainfrom
TomikeDS:fix/analytics-recommendation-alerts

Conversation

@TomikeDS

Copy link
Copy Markdown
Contributor

Closes #551

Changes

Trend labels fixed

  • RollingAverages time windows: short_term=5min, medium_term=1hr, long_term=24hr
  • TrendChanges serde labels: 5m_pct, 1h_pct, 24h_pct (was 1h_pct, 6h_pct)

Congestion double-counting removed

  • recommend() no longer applies network_condition_adjustment() - the base_fee percentile already reflects congestion

GET /fees/recommend consolidated with POST

  • get_recommend handler now delegates to engine.recommend() with default params instead of its own divergent percentile logic

Recommendation history wired to persistence

  • FeeRecommendationEngine accepts Arc via with_repository() builder
  • recommend() persists via insert_recommendation() after computing
  • GET /fees/recommend/history calls query_recent_recommendations(50)

Alert dedup made durable

  • AlertManager gained rehydrate_seen_spikes() - loads from alert_events table at startup
  • All dispatches (success/failure) are recorded in alert_events

Alert config CRUD connected to dispatcher

  • check_and_dispatch() loads enabled configs from DB
  • Dispatches to every enabled webhook whose threshold the spike meets
  • Falls back to legacy single-webhook mode if no DB configs exist

Tests

  • Added deterministic tests for: congestion double-counting prevention, target_ledgers fee ordering, trend label serde, percent_change calculation
  • 205 passed, 1 failed (pre-existing upstream etag_is_quoted)
  • Clippy clean, format clean

…ion, alert configs, persistence

- Fix rolling average time window labels: short_term=5min, medium_term=1hr, long_term=24hr
- Fix TrendChanges serde: 5m_pct, 1h_pct, 24h_pct (was 1h_pct, 6h_pct)
- Remove congestion double-counting in recommendation engine
- Unify GET/POST /fees/recommend to use same engine.recommend() path
- Wire recommendation history to database persistence via FeeRepository
- Make alert dedup durable: rehydrate from alert_events on startup
- Record all alert dispatches in alert_events table
- Connect alert config CRUD to AlertManager: load DB configs, dispatch to webhooks
- Add FeeRecommendationEngine::with_repository() builder
- Fix devkit clippy warnings (dead_code, RangeInclusive::contains, casting, etc.)
- Add deterministic tests for trend labels, recommendation behavior, percent_change
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.

Fix analytics, recommendation, and alert correctness

1 participant