Skip to content

perf(batch-tx): parallelize batch simulation + test/doc coverage for indexer, adapters, client - #420

Merged
Jaydbrown merged 10 commits into
conduit-protocol:mainfrom
bbjiggy:perf/361-364-batch-parallel-and-coverage
Jul 30, 2026
Merged

perf(batch-tx): parallelize batch simulation + test/doc coverage for indexer, adapters, client#420
Jaydbrown merged 10 commits into
conduit-protocol:mainfrom
bbjiggy:perf/361-364-batch-parallel-and-coverage

Conversation

@bbjiggy

@bbjiggy bbjiggy commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Four fixes bundled from four assigned Stellar Wave issues, each addressing a distinct, verified gap found while investigating the SDK:

Coverage impact

Metric Before After
Statements 83.14% 88.47%
Branches 76.88% 82.43%
Functions 89.61% 92.75%
Lines 84.54% 90.07%

indexer.ts 40.68% → 87.58% stmts, adapters/keypair.ts 54.54% → 100% stmts, client.ts funcs 60% → 100%.

Checklist

  • npm run typecheck — no errors
  • npm run lint — no warnings
  • npm test — 702 passed, 2 skipped (post-merge with main)
  • npm run build — bundle compiles cleanly
  • No any types introduced in production code
  • New public methods documented in docs/api.md
  • CHANGELOG.md updated under [Unreleased]

Closes #361, Closes #362, Closes #363, Closes #364

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@bbjiggy 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

bbjiggy and others added 10 commits July 30, 2026 15:29
buildBatchTransactions() (used whenever context.rpcUrl is set) had no
dedicated tests. It builds one transaction per operation and simulates
each via RPC to attach footprint/auth before submission, but nothing
exercised that path directly — only the offline buildBatchTransactionsSync
path was covered.

This adds tests for the happy path, the getAccount-derived sequence path,
simulation error propagation, and the offline fallback. The first test
asserts that all of a batch's simulateTransaction calls are dispatched
before any of them resolve — this fails against the current sequential
for-loop implementation, which only calls simulateTransaction for the
first operation until it resolves.

Related to conduit-protocol#361.
Note in docs/api.md that operations in an RPC-prepared batch are
simulated concurrently, and add a CHANGELOG entry under [Unreleased].

Related to conduit-protocol#361.
GraphQLIndexer.subscribe() has two transports (a graphql-transport-ws
WebSocket path and an SSE/fetch fallback for environments without a
WebSocket constructor), and both were essentially untested — existing
coverage only checked subscription bookkeeping, not message handling.

Adds coverage for: the connection_init/subscribe handshake, next/data
message delivery, error message routing, malformed-JSON resilience,
socket error/close handling and auto-unsubscribe, unsubscribe
idempotency, and, on the SSE side, data-line parsing, non-ok HTTP
responses, and abort-vs-real-error distinction on fetch rejection.

Related to conduit-protocol#362.
GraphQLIndexer is exported from src/index.ts but had no entry in
docs/api.md. Documents the constructor, query(), subscribe() (including
its WebSocket-vs-SSE-fallback behaviour), getSubscriptionCount(), and
cleanup(). Adds a CHANGELOG entry under [Unreleased].

Closes conduit-protocol#362
KeypairWalletAdapter is exported (via adapters/index.ts) and used
internally whenever config.keypair is supplied without config.wallet,
but had no dedicated test file — the raw XDR string signing branch of
signTransaction() (including its missing-networkPassphrase error) was
entirely untested.

Covers getPublicKey(), isConnected(), signing a Transaction instance,
signing a raw XDR string with/without networkPassphrase, and that
accountToSign is ignored since a keypair only ever signs as itself.

Related to conduit-protocol#363.
Adds a "Wallet Adapters" section to docs/api.md — neither adapter had
any entry despite both being part of the public API surface. Adds a
CHANGELOG entry under [Unreleased].

Closes conduit-protocol#363
ConduitClient.pauseStream()/unpauseStream() delegate to
client.streams.pause()/resume(), which are themselves well covered,
but the ConduitClient-level wrappers had no direct test — nothing
verified the delegation itself (argument passthrough, return value,
or error propagation).

Related to conduit-protocol#364.
setWallet()'s JSDoc comment — including its @throws tag and the wallet
propagation contract describing which modules setWallet() does and
doesn't update — sat directly above pauseStream(), not above
setWallet() itself. pauseStream()/unpauseStream() each already had
their own correct JSDoc immediately below the orphaned block, so
setWallet() ended up completely undocumented in editor tooltips and
generated docs.

Moves the block down to sit directly above setWallet(). No behavior
change.

Related to conduit-protocol#364.
…llet config field

ConduitConfig's table was also missing the wallet field entirely.
Documents pauseStream(), unpauseStream(), and setWallet() under
ConduitClient in docs/api.md, and adds the CHANGELOG entry for this
issue's fix and test additions.

Closes conduit-protocol#364
Spreading a destructured optional field straight into a new object literal
(e.g. { rpcUrl, contractId, sourceAccount, network }) produces a type where
that key is present-but-possibly-undefined, which exactOptionalPropertyTypes
rejects against BatchTransactionContext's optional fields — the key must be
entirely absent when the value is undefined, not present with value undefined.
@Jaydbrown
Jaydbrown force-pushed the perf/361-364-batch-parallel-and-coverage branch from c663919 to fa5bc00 Compare July 30, 2026 14:40
@Jaydbrown
Jaydbrown merged commit 944baf3 into conduit-protocol:main Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants