Skip to content

test(sdk): cover keeper-tx error classification helpers - #679

Open
DevQwinB wants to merge 1 commit into
drydocs:mainfrom
DevQwinB:test/657-keeper-tx-tests
Open

test(sdk): cover keeper-tx error classification helpers#679
DevQwinB wants to merge 1 commit into
drydocs:mainfrom
DevQwinB:test/657-keeper-tx-tests

Conversation

@DevQwinB

Copy link
Copy Markdown

closes #657

Summary

packages/stellar-sdk-helpers/src/keeper-tx.ts had no test file, even though its
classification helpers are pure and directly decide keeper retry behaviour. Adds
keeper-tx.test.ts covering them.

Changes

  • New packages/stellar-sdk-helpers/src/keeper-tx.test.ts:
    • isTransientKeeperErrorfalse for SubmissionFailedError even when the
      wrapped message contains transient keywords, true for
      SubmissionInFlightError, case-insensitive keyword matching
      ("try again", "timeout", "timed out", "rate limit", "temporarily"),
      all five retryable status codes (429/500/502/503/504), and the word-boundary
      guard (ledger 15034, amount 4290000 stay non-transient).
    • expectString — returns a string unchanged; throws a message naming the
      method, contract, and actual type for null, a number, and undefined.
    • isDefinitiveOnChainFailure — matches waitForTransaction's "failed on-chain"
      message, not its "Timed out waiting..." message.
    • isStaleAdapterError — detected by message text (not instanceof), so it
      survives being rewrapped by withKeeperRetry.
    • rawErrorText — keeps every line (unlike errorMessage), stringifies
      non-Error throws.

No production code changed.

Verification

Run in packages/stellar-sdk-helpers:

  • pnpm test → 16 files, 299 tests passing (15 of them new).
  • pnpm coverage → thresholds pass; keeper-tx.ts at 95.83% stmts / 93.75% branches.
  • pnpm typecheck → clean.
  • prettier --check on the new file → clean.

Note: a fresh checkout needs pnpm build in packages/shared first (its dist/
is what @meridian/shared resolves to); without it every test file in this
package fails to resolve the import. That is pre-existing and unrelated to this
change.

keeper-tx.ts had no test file even though its classification helpers are
pure and decide retry behaviour: isTransientKeeperError, expectString,
isDefinitiveOnChainFailure, isStaleAdapterError and rawErrorText.

Covers the cases that matter for correctness: SubmissionFailedError is
never transient regardless of its message text, SubmissionInFlightError
always is, transient keywords match case-insensitively, and status codes
only match on word boundaries so a ledger number containing 503 is not
misread as a retryable status.
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@DevQwinB is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@DevQwinB Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Test] keeper-tx.ts has no test file

1 participant