Skip to content

fix(ts-sdk): accept deprecated ids for watchOrderBooks#1292

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/issue-1283-ts-watch-order-books-ids
Open

fix(ts-sdk): accept deprecated ids for watchOrderBooks#1292
realfishsam wants to merge 1 commit into
mainfrom
fix/issue-1283-ts-watch-order-books-ids

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Adds TypeScript SDK compatibility for deprecated ids input on watchOrderBooks, matching Python's backwards-compatible behavior.
  • Strips params.ids before forwarding sidecar params so the alias does not leak to the server.
  • Adds focused Jest coverage for both compatibility forms.

Fixes #1283

Test Plan

  • npm test -- --runTestsByPath tests/watch-order-books-compat.test.ts (blocked: generated TypeScript client artifacts are absent in this checkout; pmxt/client.ts cannot resolve ../generated/src/index.js)
  • npm run generate:sdk:typescript --workspace=pmxt-core (blocked: environment is missing java, required by openapi-generator-cli)
  • git diff --check (pass)

@realfishsam

Copy link
Copy Markdown
Contributor Author

Local/CI follow-up from the low-hanging automation:

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: PASS (NOT VERIFIED)

What This Does

Adds backwards-compatible TypeScript handling for deprecated ids inputs to watchOrderBooks, allowing either { ids: [...] } as the first argument or params.ids when outcomeIds is omitted.

Blast Radius

TypeScript SDK WebSocket batch subscription argument shaping only (sdks/typescript/pmxt/client.ts). Core sidecar, OpenAPI, Python SDK, and venue normalizers are not affected.

Consumer Verification

Before (base branch):
watchOrderBooks requires an array and immediately calls .map(resolveOutcomeId) on the first argument. A consumer calling the deprecated shape would fail locally before reaching WebSocket transport:

await client.watchOrderBooks({ ids: ["outcome-1"] } as any)
// base: TypeError because outcomeIds.map is not a function

After (PR branch):
Static review shows the method detects both deprecated shapes, warns, normalizes to an outcome-id array, strips params.ids from forwarded params, and still throws TypeError("Missing required argument: 'outcomeIds'") when no usable array is provided. Added tests assert the outgoing WebSocket args become:

await client.watchOrderBooks({ ids: ["outcome-1"] } as any)
// args: [["outcome-1"]]

await client.watchOrderBooks(undefined, undefined, { ids: ["outcome-1"], foo: "bar" } as any)
// args: [["outcome-1"], undefined, { foo: "bar" }]

Runtime SDK verification was blocked by missing generated SDK artifacts.

Test Results

  • Build: PASS (npm run build --workspace=pmxt-core)
  • Unit tests: NOT VERIFIED. npx jest -c sdks/typescript/jest.config.cjs sdks/typescript/tests/watch-order-books-compat.test.ts --runInBand failed before tests ran with sdks/typescript/pmxt/client.ts:15:8 - TS2307: Cannot find module '../generated/src/index.js'.
  • Server starts: NOT RUN (SDK WebSocket-client argument shaping only)
  • E2E smoke: NOT VERIFIED (WebSocket transport mocked by the intended unit test, but generated artifact blocker prevented execution)

Findings

No blocking findings.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: OK for runtime normalization; full TS compile/test blocked by missing generated imports.
  • Auth safety: N/A

Semver Impact

patch -- restores deprecated-call compatibility without changing the preferred public API.

Risk

Deprecated compatibility emits console.warn on each call; high-frequency streaming loops using the deprecated shape could log repeatedly until consumers migrate.

@AbhilashG12

Copy link
Copy Markdown
Contributor

Hey @realfishsam — great work on the backwards-compatible fix for watchOrderBooks!

The PR review is PASS, and the CI failures are all auto-generated file mismatches, not issues with your code changes.


Quick Fix for the CI Failures

The 4 failing checks can be fixed by regenerating the generated files:

# 1. Regenerate the TypeScript client
node sdks/typescript/scripts/generate-client-methods.js

# 2. Regenerate the Python client
node sdks/python/scripts/generate-client-methods.js

# 3. Regenerate API reference docs
npm run generate:docs --workspace=pmxt-core

# 4. Regenerate exchange coverage
npm run generate:exchange-coverage --workspace=pmxt-core 2>/dev/null || echo "Script not found"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants