Skip to content

feat(#554): multi-window trend engine with percentile comparison and explanation - #567

Merged
Tinna23 merged 2 commits into
StellarCommons:mainfrom
amberly-d:feat/multi-window-engine-v2
Aug 24, 2026
Merged

feat(#554): multi-window trend engine with percentile comparison and explanation#567
Tinna23 merged 2 commits into
StellarCommons:mainfrom
amberly-d:feat/multi-window-engine-v2

Conversation

@amberly-d

Copy link
Copy Markdown

Closes #554

Description

Replaces the spike-based network_condition_adjustment with a multi-window percentile comparison engine. This provides smoother, more grounded fee adjustments by comparing recent fee trends against the full history window.

Changes

  • Shared analytics module (packages/core/src/analytics/): trend linear regression, nearest-rank percentile, volatility metrics
  • Multi-window comparison: short window (5 min) vs long window (60 min) percentile comparison replaces spike detection
  • RecommendationExplanation: Every recommendation now includes explanation data — short/long window medians, percentile shift, adjustment factor, and human-readable reason
  • Cold-start fallback: When sample count is below min_sample_count, returns a configurable fallback fee with no explanation
  • Bug fix: ETag values now properly quoted (RFC 7231 compliant)
  • Devkit clippy fixes: Dead code, manual range contains, manual arithmetic check

Test Results

  • 223 tests pass, 0 failures (all pre-existing failures fixed)
  • Clippy clean (-D warnings)
  • Format clean
  • Regression tests verify: rising fees → higher adjustment, falling → lower, stable → no change, cold start → no explanation

Amberly and others added 2 commits August 24, 2026 10:18
…omparison and explanation

- Add shared analytics module (trend, percentile, volatility)
- Replace spike-based network_condition_adjustment with multi-window percentile comparison
- Add RecommendationExplanation to RecommendResponse
- Compute explanation stats (short/long window medians, percentile shift, adjustment reason)
- Fix ETag quoting bug, fix devkit clippy warnings
- Add regression tests for rising/falling/stable/cold-start scenarios
- All 223 tests pass, clippy clean, format clean
@Tinna23
Tinna23 merged commit b462c6b into StellarCommons:main Aug 24, 2026
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.

Advisor #2: Multi-window recommendation engine v2 with explainability

3 participants