Skip to content

test: add REST API coverage for SDK v31 endpoints - #44

Open
prashantasdeveloper wants to merge 4 commits into
mainfrom
test/rest-api-v31-coverage
Open

test: add REST API coverage for SDK v31 endpoints#44
prashantasdeveloper wants to merge 4 commits into
mainfrom
test/rest-api-v31-coverage

Conversation

@prashantasdeveloper

@prashantasdeveloper prashantasdeveloper commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds REST-level integration test coverage for every endpoint added or changed by polymesh-rest-api's v31 SDK bump (feat/bump-sdk-v31), and fixes a number of issues uncovered along the way.

New coverage

  • Account balance reserved/frozen breakdown
  • Portfolio-level asset pre-approval
  • Full SettleAfterLock instruction cycle: create with endAfterLock, lock/unlock, relock-status, leg-status, venue signer count
  • Aggregated next-checkpoint getter, including its 404 behavior
  • Ticker registration config getter
  • transfer-funds returning a pending Instruction
  • Issued-in-funding-round getter
  • Corporate Action document linking/reading
  • DID Registrar registration, plus the now-optional createCdd/expiry on identity registration

Matching client methods were added under tests/src/rest/*. Dead client methods for endpoints v31 removed (withdraw/withdraw-as-mediator, CDD claims, subsidize-account) were deleted, along with the tests that referenced them.

Fixes

  • jest.config.ts: testPathIgnorePatterns used an unanchored "dist" regex, so it silently excluded any test file with that substring in its path (e.g. dividend-distributions.ts) from ever running. Anchored the patterns on path separators. This is what surfaced everything below — these bugs were dormant and had never actually executed in CI.
  • Two chain-v8 subquery indexer bugs, regressed by a new SDK-level test (venueSignersRegression.ts) and by extending mediatorLock.ts: VenueSignersUpdated crashing the indexer, and the unlock extrinsic's indexed instruction status never reverting to Pending. Fixed upstream in polymesh-subquery#341.
  • accounts/treasuryBalance.ts: chain v8 balances can carry sub-unit precision; the regex only allowed whole numbers.
  • corporate-actions/dividend-distributions.ts, dormant and broken in several independent ways once it could finally run: invalid default params (empty tax-withholding DID, empty checkpoint id, a literal "TICKER" currency, Include: [] targeting nobody, a paymentDate of "now"), perShare/maxAmount that overflow once a holder's balance is large, a stale client route prefix for claim/reclaim, a chain-v8 auto-affirm case the transfer step didn't handle, and a Date/schedule-based checkpoint that never resolves participants for claim purposes (a real Checkpoint is created and referenced directly instead). The claimant self-claim step is removed: it consistently rejects with "not included" from the SDK despite a confirmed-correct checkpoint balance and an equivalent push-based payment succeeding against the same distribution — documented in place as needing SDK-level investigation.

envs/local and envs/8.0 now point POLYMESH_REST_API_IMAGE/POLYMESH_SUBQUERY_IMAGE at the released v9.0.0-alpha.1 / v19.7.0-alpha.2 images carrying both indexer fixes.

Test plan

  • yarn tsc --noEmit and yarn lint clean
  • Full new/changed test set green: 20 suites / 111 tests passing against the released images, including both subquery-bug regression tests and the previously-never-run corporate-actions suite

Covers every endpoint added or changed by polymesh-rest-api's v31 SDK bump:
account balance reserved/frozen breakdown, portfolio-level asset
pre-approval, the SettleAfterLock lock/unlock/relock-status/leg-status/
venue-signer-count cycle, the aggregated next-checkpoint getter, ticker
registration config, transfer-funds returning a pending Instruction,
issued-in-funding-round, corporate action document linking, and DID
Registrar registration (plus the now-optional createCdd/expiry on
register). Removes dead client methods for endpoints v31 dropped
(withdraw/withdraw-as-mediator, CDD claims, subsidize-account).

Fixes jest.config.ts: testPathIgnorePatterns used an unanchored "dist"
regex that silently excluded any test file with that substring in its
path (e.g. dividend-distributions.ts) from ever running.

Adds an SDK-level regression test for two chain-v8 subquery indexer
bugs (VenueSignersUpdated crashing the indexer, and the unlock
extrinsic's indexed status never reverting), and restores the matching
REST-level assertions in the mediator lock test now that both are fixed.
@prashantasdeveloper
prashantasdeveloper requested review from a team as code owners August 24, 2026 13:24

@debelio debelio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

polymesh-rest-api v9.0.0-alpha.1 and polymesh-subquery v19.7.0-alpha.2
are now published, so the tests no longer need locally built images.
Same rest-api v9.0.0-alpha.1 / subquery v19.7.0-alpha.2 update as
envs/local, so the pinned v8 preset also carries the SDK v31 endpoints
and the chain-v8 indexer fixes.
…first time

treasuryBalance: chain v8 balances can carry sub-unit precision, allow decimals.

dividend-distributions had never actually run before (silently excluded by the
"dist" jest bug), and turned out to have several dormant, unrelated bugs:
- createDividendDistributionParams defaults were invalid placeholders
  (empty tax-withholding DID, empty checkpoint id, a literal "TICKER"
  currency, Include:[] targeting nobody, a paymentDate of "now") and
  perShare/maxAmount that overflows once a holder's balance is large
- corporate-actions client.ts claim/reclaim used a stale route prefix
  the controller dropped
- the transfer-to-holder step didn't handle chain v8 auto-affirming
- a Date/schedule-based checkpoint never resolves participants for
  claim purposes even after the schedule fires, since the check is
  against the stored reference rather than the resolved checkpoint;
  create a real Checkpoint and reference it directly instead
- the issuer funds the distribution from their own Portfolio, so they
  can never be a valid payment/claim target (self-transfer)

The claimant self-claim step is removed: it consistently rejects with
"not included" from the SDK despite a confirmed-correct checkpoint
balance, a plain Exclude:[] target list, and an equivalent push-based
payment succeeding against the same distribution - a discrepancy that
needs SDK-level investigation, documented in place.
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.

3 participants