Skip to content

feat: resolve issues #209 #210 #211 #212 - #344

Merged
misrasamuelisiguzor-oss merged 1 commit into
WHEELBACK:mainfrom
Chuks-coderr:feature/issues-209-210-211-212
Aug 25, 2026
Merged

feat: resolve issues #209 #210 #211 #212#344
misrasamuelisiguzor-oss merged 1 commit into
WHEELBACK:mainfrom
Chuks-coderr:feature/issues-209-210-211-212

Conversation

@Chuks-coderr

Copy link
Copy Markdown

Issue #212 — cache treasury balances endpoint

  • Add in-memory 5-second TTL cache to GET /api/treasury/balances
  • Invalidate cache immediately after execute-settlement succeeds
  • Export getBalanceCache/setBalanceCache/invalidateBalanceCache for tests
  • Add treasury-balances-cache.test.ts: cache helpers, TTL expiry, cache hit/miss on HTTP layer, invalidation after mutation

Issue #211 — integration tests for compliance allow/block endpoints

  • Add compliance.test.ts with callComplianceOp unit tests: allow, block, allow_address_until, simulation error (422), send error (422), confirmation timeout (504)
  • HTTP-layer tests for POST /compliance/allow and /compliance/block: 401 missing/wrong admin key, 400 invalid/missing address, 400 bad 'until' value, 503 missing env vars

Issue #210 — harden MongoDB connection error handling and pooling

  • Add explicit pool config to MongoClient: maxPoolSize=10, minPoolSize=2, serverSelectionTimeoutMS=5000, connectTimeoutMS=10000, socketTimeoutMS=45000
  • Wrap client.connect() in try/catch: MongoServerSelectionError produces a clear message with the URI and status 503
  • Add 'error'/'close' event handlers to log topology failures
  • Add _resetMongoSingleton() export for test isolation
  • Add mongo-hardening.test.ts: 503 on unreachable host, URI in error message, non-selection error wrapping, success path, HTTP route returns 5xx on outage (not a hang)

Issue #209 — Redis reconnect backoff for event indexer

  • Add createRedisClient() with ioredis retryStrategy implementing capped exponential backoff (base 250ms, cap 30s, ±10% jitter)
  • Persist cursor to Redis (invoice_indexer_cursor) with in-memory fallback on Redis failure; loadCursor/saveCursor are safe to call while Redis is disconnected
  • stopIndexer() gracefully quits the Redis connection
  • startIndexer() accepts _redisClient injection for unit tests
  • Add indexer-redis-reconnect.test.ts: backoffDelayMs range/growth/ cap, loadCursor fallback, saveCursor persistence and graceful failure, indexer continues polling after Redis drops

Closes #209
Closes #210
Closes #211
Closes #212

Pull Request

Summary

  • Describe the purpose of this PR in one or two sentences.

Checklist

  • Closes #__
  • Tests added or updated
  • ABI snapshot updated if contract sources changed (abis/ and COMEBACKHERE-contracts/)
  • Screenshots attached if UI changed
  • Documentation updated if needed

Notes

…ACK#212

Issue WHEELBACK#212 — cache treasury balances endpoint
- Add in-memory 5-second TTL cache to GET /api/treasury/balances
- Invalidate cache immediately after execute-settlement succeeds
- Export getBalanceCache/setBalanceCache/invalidateBalanceCache for tests
- Add treasury-balances-cache.test.ts: cache helpers, TTL expiry,
  cache hit/miss on HTTP layer, invalidation after mutation

Issue WHEELBACK#211 — integration tests for compliance allow/block endpoints
- Add compliance.test.ts with callComplianceOp unit tests:
  allow, block, allow_address_until, simulation error (422),
  send error (422), confirmation timeout (504)
- HTTP-layer tests for POST /compliance/allow and /compliance/block:
  401 missing/wrong admin key, 400 invalid/missing address,
  400 bad 'until' value, 503 missing env vars

Issue WHEELBACK#210 — harden MongoDB connection error handling and pooling
- Add explicit pool config to MongoClient:
  maxPoolSize=10, minPoolSize=2, serverSelectionTimeoutMS=5000,
  connectTimeoutMS=10000, socketTimeoutMS=45000
- Wrap client.connect() in try/catch: MongoServerSelectionError
  produces a clear message with the URI and status 503
- Add 'error'/'close' event handlers to log topology failures
- Add _resetMongoSingleton() export for test isolation
- Add mongo-hardening.test.ts: 503 on unreachable host, URI in
  error message, non-selection error wrapping, success path,
  HTTP route returns 5xx on outage (not a hang)

Issue WHEELBACK#209 — Redis reconnect backoff for event indexer
- Add createRedisClient() with ioredis retryStrategy implementing
  capped exponential backoff (base 250ms, cap 30s, ±10% jitter)
- Persist cursor to Redis (invoice_indexer_cursor) with in-memory
  fallback on Redis failure; loadCursor/saveCursor are safe to call
  while Redis is disconnected
- stopIndexer() gracefully quits the Redis connection
- startIndexer() accepts _redisClient injection for unit tests
- Add indexer-redis-reconnect.test.ts: backoffDelayMs range/growth/
  cap, loadCursor fallback, saveCursor persistence and graceful
  failure, indexer continues polling after Redis drops

Closes WHEELBACK#209
Closes WHEELBACK#210
Closes WHEELBACK#211
Closes WHEELBACK#212
@drips-wave

drips-wave Bot commented Aug 24, 2026

Copy link
Copy Markdown

@Chuks-coderr 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

@misrasamuelisiguzor-oss
misrasamuelisiguzor-oss merged commit f607f51 into WHEELBACK:main Aug 25, 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

2 participants