Skip to content

Audit registry params vs SDK; expose missing, allowlist no-method endpoints (#123) - #125

Merged
martinkersner merged 4 commits into
mainfrom
issue-123-audit-registry-params-exposed
Jul 1, 2026
Merged

Audit registry params vs SDK; expose missing, allowlist no-method endpoints (#123)#125
martinkersner merged 4 commits into
mainfrom
issue-123-audit-registry-params-exposed

Conversation

@martinkersner

Copy link
Copy Markdown
Member

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 every request_endpoint("op_id", ...) call site, extracts the forwarded kwargs (handling the **{"from": ...} splat and the **params local-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's datamaxi/datamaxi/*.py scan) or forwarded via **params (premium).

Newly exposed (genuine misses — all in registry ⇒ data-api-live)

  • 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

False 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}.

⚠️ NEEDS HUMAN REVIEW — allow-listed (deferred)

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_priceasset, from, to, interval (not in issue list)
  • margin_borrowasset (not in issue list)
  • liquidation_statswindow, exchange, min_volume_usd
  • listings_historicalrefresh

page/limit are globally ignored per the issue (pagination handled per-method).

Test plan

  • pytest -m "not integration and not smoke" → 125 passed
  • New: tests/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 tests clean; black --check clean.

No edits to datamaxi/_endpoints.py (codegen).

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.
@martinkersner martinkersner self-assigned this Jul 1, 2026
- 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.
@martinkersner
martinkersner merged commit 18065de into main Jul 1, 2026
7 checks passed
@martinkersner
martinkersner deleted the issue-123-audit-registry-params-exposed branch July 1, 2026 08:07
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.

Audit that all _endpoints.py registry params are exposed in the SDK

1 participant