Merged
Conversation
…ew block Adds TestPreview covering: - 401 on invalid API key (auth precedes whitelist check) - Happy path for both whitelisted metrics (ohlcv + l2_imbalance) - Structural 400 cases for date ranges that will never be whitelisted: multi-year spans and recent windows wider than 3 months Also removes the preview=True filter from test_readme_block_runs now that the preview endpoint is live in production and returns 401 for the placeholder key (as the test expects). https://claude.ai/code/session_01SZBHZWVen9b3x4iNDXLWcr
…ing ones The server clamps requests that overlap the whitelist window rather than rejecting them — so 2025-01-01→2025-12-31 returned data (clamped to 2025-05-01→2025-05-31) instead of 400. Replace with ranges that sit entirely outside the whitelisted window. https://claude.ai/code/session_01SZBHZWVen9b3x4iNDXLWcr
… rejects them The server now uses isPreviewQueryAllowed (reject) instead of clampToPreviewRange, so requests like 2025-01-01→2025-12-31 correctly return 400 rather than being silently clamped to the whitelist window. https://claude.ai/code/session_01SZBHZWVen9b3x4iNDXLWcr
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
tests/test_preview.pywithTestPreviewcovering the live preview endpointtest_readme_block_runs(was suppressed while the endpoint was undeployed; now returns 401 as expected)Test cases
Happy path
test_invalid_api_key_raises_401— auth fires before whitelist checktest_ohlcv_returns_dataframe— exact whitelist params return data with OHLCV columnstest_l2_imbalance_returns_dataframe— l2_imbalance whitelist entry worksStructurally non-whitelisted date ranges → 400
These are parametrized cases chosen because no preview window could ever legitimately cover them — not just "not currently in the whitelist" but structurally impossible:
https://claude.ai/code/session_01SZBHZWVen9b3x4iNDXLWcr