fix: align production defaults and close review parity gaps

Ship greenfield min_rr=2.0 and conf=0, read-only Structural S/R, indicator
cache invalidation, and UI/gate language that treats GTL as screening not exit.
Align strategy_rank missing-vol fallback live vs backtest, single-source
PRIMARY_TARGET_MIN_RR, expand prod parity tests, and drop dead FE clients.
This commit is contained in:
2026-07-18 13:03:22 +02:00
parent e07da0f8f0
commit b0e33e1606
25 changed files with 429 additions and 221 deletions
+9 -12
View File
@@ -1,11 +1,8 @@
"""Bug-condition exploration tests for R:R scanner target quality.
"""Regression: scanner must not headline the most distant (max raw R:R) level.
These tests confirm the bug described in bugfix.md: the old code always selected
the most distant S/R level (highest raw R:R) regardless of strength or proximity.
The fix replaces max-R:R selection with quality-score selection.
Since the code is already fixed, these tests PASS on the current codebase.
On the unfixed code they would FAIL, confirming the bug.
Historical bug: provisional candidate pick used max R:R / quality only. Production
headline is probability-based primary after enhance_trade_setup — near levels
with real reach-probability beat far lotteries.
**Validates: Requirements 1.1, 1.3, 1.4, 2.1, 2.3, 2.4**
"""
@@ -76,10 +73,7 @@ def _make_ohlcv_bars(
@pytest.mark.asyncio
async def test_long_prefers_strong_near_over_weak_far(scan_session: AsyncSession):
"""With a strong nearby resistance and a weak distant resistance, the
scanner should pick the strong nearby one — NOT the most distant.
On unfixed code this would fail because max-R:R always picks the
farthest level.
probability primary should be the nearby level — NOT the far lottery.
"""
ticker = Ticker(symbol="EXPLR")
scan_session.add(ticker)
@@ -126,8 +120,11 @@ async def test_long_prefers_strong_near_over_weak_far(scan_session: AsyncSession
"Bug: scanner picked the weak distant level (130) instead of the "
"strong nearby level (105)"
)
# It should pick the strong nearby level
# Probability primary should pick the strong nearby level
assert selected_target == pytest.approx(105.0, abs=0.01)
primaries = [t for t in long_setups[0].targets if t.get("is_primary")]
assert len(primaries) == 1
assert primaries[0]["price"] == pytest.approx(105.0, abs=0.01)
# ---------------------------------------------------------------------------