Skip to content

fix(core): handle renamed SuiBets event fields#1216

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/suibets-response-field-drift
Open

fix(core): handle renamed SuiBets event fields#1216
realfishsam wants to merge 1 commit into
mainfrom
fix/suibets-response-field-drift

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Handles current SuiBets eventId, eventName, and sportName fields alongside the older matchId, matchName, and sport names.
  • Preserves event synthesis when matchId is absent and keeps normalized market titles/descriptions/tags populated.
  • Adds regression coverage for both the normalizer and fetcher grouping path.

Fixes #1208
Fixes #1209
Fixes #1210

Test Plan

  • npm test -- --runTestsByPath test/normalizers/suibets-normalizer.test.ts test/exchanges/suibets-fetcher.test.ts --runInBand (from core/)
  • git diff --check
  • npm run build --workspace=pmxt-core

@realfishsam

Copy link
Copy Markdown
Contributor Author

Targeted local verification for this focused SuiBets response-drift fix is green:

  • npm test -- --runTestsByPath test/normalizers/suibets-normalizer.test.ts test/exchanges/suibets-fetcher.test.ts --runInBand
  • git diff --check
  • npm run build --workspace=pmxt-core

The current red generated-sync checks appear to be pre-existing/broad drift unrelated to this PR's SuiBets files. Example from Verify API_REFERENCE.md files are up-to-date: regenerated docs want sourceExchange / exchange filter docs and remove TS question, none of which are touched by this branch. Keeping this PR scoped per generated-drift policy rather than folding broad docs/client regeneration into a SuiBets hotfix.

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: FAIL

What This Does

Adds compatibility for current SuiBets offer payloads that use eventId, eventName, and sportName instead of the older matchId, matchName, and sport fields. This matters to SDK consumers because fetchMarkets/fetchEvents should continue returning populated event IDs, market titles/descriptions, and tags as the venue response shape drifts.

Blast Radius

Core SuiBets fetcher and normalizer only, plus focused SuiBets regression tests. No OpenAPI schema, SDK shim, router, auth, or generated SDK files are changed.

Consumer Verification

Before (base branch):
Not run separately; this is a bug-fix/static drift PR and the old implementation only looked at the legacy match* / sport field names in the affected paths.

After (PR branch):
The new event grouping path works for renamed fields (eventId/eventName/sportName) in the PR's focused test, but the market search/filter consumer path still drops renamed-field offers. I ran a focused consumer-path probe against SuibetsFetcher.fetchRawMarkets({ query: 'baseball' }) with an offer containing only eventName: 'Mets vs Yankees' and sportName: 'Baseball':

Expected length: 1
Received length: 0
Received array: []

So an SDK consumer searching SuiBets markets by the current sportName or eventName fields still receives no markets.

Test Results

  • Build: PASS (npm run build --workspace=pmxt-core)
  • Unit tests: PASS (60 passed, 0 failed: test/normalizers/suibets-normalizer.test.ts, test/exchanges/suibets-fetcher.test.ts)
  • Server starts: PASS (GET /health succeeded on local sidecar)
  • E2E smoke: FAIL (focused fetcher probe for renamed-field market query returns [])

Findings

  1. core/src/exchanges/suibets/fetcher.ts:143 -- fetchRawMarkets still filters params.query only against matchName, homeTeam, awayTeam, and sport. The PR adds renamed-field support elsewhere, but this consumer path omits eventName and sportName, so current SuiBets offers are excluded when users search by event/sport. Concrete repro on the PR branch: fetchRawMarkets({ query: 'baseball' }) with an offer containing sportName: 'Baseball' returned [] instead of the offer.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A — no unified field/schema addition
  • OpenAPI sync: N/A
  • Financial precision: OK — no new price/amount arithmetic beyond existing MIST conversion
  • Type safety: ISSUE — renamed fields are modeled, but not consumed consistently in fetchRawMarkets query filtering
  • Auth safety: N/A

Semver Impact

patch -- venue response-drift bug fix.

Risk

The event grouping and normalizer paths are covered, but market query filtering remains inconsistent. If merged as-is, consumers using fetchMarkets({ query }) can still miss SuiBets markets whose current payloads no longer include matchName/sport.

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

Labels

None yet

Projects

None yet

1 participant