fix: ops pipeline — rate limit, validation cycle, snapshots, config query, rejection reason
- Polygon rate limit env-configurable, default 5 (free tier) - v3_engine_enabled reads from JSONB config column correctly - Validation cycle (outcome eval + metrics) wired into scheduler hourly - Daily portfolio/risk snapshots after 16:30 ET with idempotency - Prediction snapshot price fallback from positions table - Order rejection_reason + rejected_at persisted on insert - Lake-publisher scaled to 0 replicas (redundant) - Test fix: isolate per-type rate limit tests from Polygon global
This commit is contained in:
@@ -710,18 +710,20 @@ class TestCheckRateLimitEdgeCases:
|
||||
async def test_exactly_at_per_type_limit_allowed(self):
|
||||
"""Count exactly equal to the limit should be allowed (only > limit blocks)."""
|
||||
rds = _mock_redis()
|
||||
limit = DEFAULT_RATE_LIMITS["news_api"]
|
||||
# Use filings_api (not in POLYGON_SOURCE_TYPES) to isolate the per-type check
|
||||
limit = DEFAULT_RATE_LIMITS["filings_api"]
|
||||
rds.incr = AsyncMock(return_value=limit)
|
||||
result = await check_rate_limit(rds, "news_api", _now())
|
||||
result = await check_rate_limit(rds, "filings_api", _now())
|
||||
assert result is True
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_one_over_per_type_limit_blocked(self):
|
||||
"""Count one over the limit should be blocked."""
|
||||
rds = _mock_redis()
|
||||
limit = DEFAULT_RATE_LIMITS["news_api"]
|
||||
# Use filings_api (not in POLYGON_SOURCE_TYPES) to isolate the per-type check
|
||||
limit = DEFAULT_RATE_LIMITS["filings_api"]
|
||||
rds.incr = AsyncMock(return_value=limit + 1)
|
||||
result = await check_rate_limit(rds, "news_api", _now())
|
||||
result = await check_rate_limit(rds, "filings_api", _now())
|
||||
assert result is False
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user