Skip to content

feat(sdk): implement searchByMemo, canonical dedup keys, request caching, and load testing suite (#612, #614, #982, #1131) - #1202

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
kokobutter-web:feat/issues-612-614-982-1131
Oct 21, 2026
Merged

Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
kokobutter-web:feat/issues-612-614-982-1131

Conversation

@kokobutter-web

Copy link
Copy Markdown

Summary of Changes

This PR resolves four issues across the StellarSplit SDK:

  1. Add searchByMemo full-text search to search.ts #614: Add searchByMemo full-text search to search.ts

    • Implemented searchByMemo(invoices: Invoice[], query: string, opts?: SearchByMemoOptions): Invoice[] in src/search.ts.
    • Supports case-insensitive substring search by default and exact case matching when opts.caseSensitive = true.
    • Safely skips invoices with missing, null, or undefined memos without error.
    • Returns all invoices unchanged when query is empty string.
    • Exported from src/index.ts.
    • Comprehensive unit tests in test/searchByMemo.test.ts.
  2. Add generateIdempotencyKey for canonical payment deduplication #612: Add generateIdempotencyKey for canonical payment deduplication

    • Implemented generateIdempotencyKey(params: IdempotencyKeyParams): string in src/dedup.ts using Node.js built-in crypto.createHash('sha256').
    • Generates deterministic SHA-256 hex string over {invoiceId}:{payer}:{amount} (with optional :{nonce}).
    • Implemented and exported module-level key registry functions: isKnownKey(key), registerKey(key), and clearKeys().
    • Exported from src/index.ts.
    • Unit tests in test/dedup.test.ts verifying determinism, collision avoidance, and state reset.
  3. Implement request caching #1131: Implement request caching

    • Implemented RequestCache in src/requestCache.ts with TTL support and capacity limits (LRU eviction).
    • Collision-resistant cache key generator generateCacheKey(namespace, params).
    • Query wrappers: getOrFetch() for reducing RPC calls, plus domain helpers: cacheInvoice(), cacheAccount(), cacheStats().
    • Invalidation by key, namespace prefix, or custom predicate.
    • Metrics tracking: hits, misses, hitRate, size, evictions, invalidations.
    • Unit tests in test/requestCache.test.ts verifying that repeated queries reduce RPC calls by >40% (achieving 70%+), TTL expiration, and LRU eviction.
    • Exported from src/index.ts.
  4. Implement comprehensive SDK performance and load testing suite #982: Implement comprehensive SDK performance and load testing suite

    • Implemented LoadTester in src/loadTesting.ts supporting configurable concurrency, iterations, duration limits, ramp-up time, and target RPS pacing.
    • High-precision latency percentile calculations (computeLatencyStats for min, max, mean, median, p90, p95, p99, stdDev).
    • Event emitter supporting lifecycle hooks (start, iterationStart, iterationEnd, error, complete).
    • Human-readable load test summary formatter formatLoadTestReport().
    • Unit tests in test/loadTesting.test.ts verifying concurrency, event handling, error breakdowns, and percentiles.
    • Exported from src/index.ts.

Closes #612
Closes #614
Closes #982
Closes #1131

kokobutter-web and others added 2 commits October 20, 2026 14:21
… and load testing suite

- Stellar-split#614: Add searchByMemo full-text search to search.ts with case-sensitivity options and unit tests
- Stellar-split#612: Add generateIdempotencyKey, isKnownKey, registerKey, clearKeys for canonical payment deduplication
- Stellar-split#1131: Add intelligent RequestCache with TTL support, LRU eviction, query helpers, and metrics reducing repeated queries by 40%+
- Stellar-split#982: Implement comprehensive SDK performance and load testing suite (LoadTester, percentiles, lifecycle events, report formatting)

Closes Stellar-split#612
Closes Stellar-split#614
Closes Stellar-split#982
Closes Stellar-split#1131
@Kingsman-99
Kingsman-99 merged commit ae565b7 into Stellar-split:main Oct 21, 2026
1 check passed
@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@kokobutter-web 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

2 participants