Skip to content

[Backend] backend/src/services/claimable.service.ts has no test asserting cache invalidation happens when a withdrawal event is indexed #1116

Description

@grantfox-oss

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

claimable.service.ts caches claimable-amount computations (with TTL and cache-key issues already tracked separately). Beyond the key/TTL bugs, there's a functional question: does the cache get proactively invalidated the moment a TokensWithdrawn event is indexed, or does it only expire passively via TTL? If it's TTL-only, users could see a stale (too-high) claimable amount for up to the full TTL window right after withdrawing, which is a confusing UX regression distinct from the already-tracked cache-key bug.

Acceptance criteria

  • Add a test that primes the cache, indexes a withdrawal event, and asserts the next read reflects the new claimable amount immediately (not after TTL)
  • If invalidation-on-event doesn't exist, implement it or document why TTL-only is acceptable

Files to touch

  • backend/tests/claimable.service.test.ts
  • backend/src/services/claimable.service.ts

Out of scope

  • Fixing the cache-key/token-collision bug (tracked separately)
  • Fixing the TTL-default inconsistency (tracked separately)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related taskstestingTesting related tasks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions