Audit registry params vs SDK; expose missing, allowlist no-method endpoints (#123) - #125
Merged
Merged
Conversation
Forward registry-declared (data-api-live) query params that client methods silently dropped: - cex_symbol.metadata: market, quote, status - cex_symbol.tags: tag, market, source, min_confidence - cex_symbol.cautions: market, min_level, active_only - cex_symbol.delistings: market, from_ms, to_ms, include_past - cex_symbol.volume: market - liquidation.feed: exchange, base, min_volume_usd - cex_ticker.get: include_source - telegram.messages: search_query - premium.__call__: query Add wire-level forwarding tests for each. Refs #123.
AST-extract every request_endpoint(op_id, ...) call site's forwarded
kwargs (handling **{dict} splat and **params local-dict) and assert
every registry param is exposed, page/limit-ignored, or allow-listed
with rationale. Allowlists the 4 endpoints with no client method at all
(index_price, margin_borrow, liquidation_stats, listings_historical)
for human review. Closes #123.
- Move premium.__call__ 'query' to before 'pandas' (was inserted after 'key'), avoiding a positional-arg break for page/limit/... callers and matching the cex_ticker include_source placement. - Correct the _ALLOWLIST docstring: an empty dict exempts nothing, not the whole endpoint.
CI pins black==26.3.1 which collapses the double blank line after imports; local 24.8.0 left it. Match CI.
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.
Closes #123
Summary
Audits
datamaxi/_endpoints.py(codegen registry, data-api contract) against client methods and reconciles the flagged endpoints.Reproducible audit is a pytest test (
tests/test_endpoint_param_coverage.py) that AST-parses everyrequest_endpoint("op_id", ...)call site, extracts the forwarded kwargs (handling the**{"from": ...}splat and the**paramslocal-dict pattern), and asserts every registry param is either forwarded, pagination-ignored (page/limit), or explicitly allow-listed with a rationale. It catches future codegen drift (a new registry param fails CI until forwarded or allow-listed).Reconciliation of the 23 flagged endpoints
The crude string-literal heuristic had many false positives — params already forwarded, or living in
datamaxi/telegram//datamaxi/naver/(outside the heuristic'sdatamaxi/datamaxi/*.pyscan) or forwarded via**params(premium).Newly exposed (genuine misses — all in registry ⇒ data-api-live)
cex_symbol.metadata:market,quote,statuscex_symbol.tags:tag,market,source,min_confidencecex_symbol.cautions:market,min_level,active_onlycex_symbol.delistings:market,from_ms,to_ms,include_pastcex_symbol.volume:marketliquidation.feed:exchange,base,min_volume_usdcex_ticker.get:include_sourcetelegram.messages:search_querypremium.__call__:queryFalse positives (already forwarded — no change)
cex_announcements.category,cex_symbol_liquidation.{base,window},cex_symbol_metadata.base,cex_symbol_oi.base,cex_symbol_oi_stats.base,cex_symbol_tags.base,cex_symbol_volume.base,cex_token_updates.type,liquidation_heatmap.{window,top_n},liquidation_map.{base,quote},liquidation_symbol_history.{quote,window},open_interest_history_aggregated.token_id,open_interest_overview.query,open_interest_summary.top_n,telegram_channels.category,telegram_messages.{channel,category}.The audit also surfaced 4 endpoints with NO client method at all (2 not even in the issue's list). Exposing these is not a param forward-through — each needs a brand-new client method (naming, return-shape handling, docs, tests), a product/design decision out of scope for this coverage audit. Allow-listed in the test with rationale +
NOTE FOR HUMAN REVIEW:index_price—asset,from,to,interval(not in issue list)margin_borrow—asset(not in issue list)liquidation_stats—window,exchange,min_volume_usdlistings_historical—refreshpage/limitare globally ignored per the issue (pagination handled per-method).Test plan
pytest -m "not integration and not smoke"→ 125 passedtests/test_endpoint_param_coverage.py(audit + guardrail that the extractor resolves**params/**{}+ allowlist-staleness check) and wire-level forwarding tests for every newly-exposed param.flake8 datamaxi testsclean;black --checkclean.No edits to
datamaxi/_endpoints.py(codegen).