flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[test] Cover token-registry cache fallback and read-through behavior

Open K1NGD4VID opened this issue 1 month ago • 16 comments

Labels: testing, backend, points: 150 File/location: backend/src/services/token-registry.service.ts:15

Description: Existing token metadata tests cover the separate in-memory metadata store and token list route, not the TokenRegistry service. Redis corruption/outage and database cache hit/miss behavior lack tests, risking unnecessary network traffic and failed lookups.

Acceptance Criteria:

  • [ ] Test Redis hit, invalid cached JSON, unavailable Redis, database hit and cold lookup paths using injected/mocked dependencies.
  • [ ] Assert DB cache hits avoid RPC and Redis write failures do not turn a successful metadata lookup into an error; run the suite in backend CI.

Notes: Searched backend/tests: existing metadata/route tests target lib/token-metadata; none import services/token-registry.service.

Audited commit: 649b6976a100fd964ce191428eef1faeb50aaa39. Closest prior issues reviewed: #1323. This report concerns the specific failure or uncovered test paths described above, rather than repeating the original feature request.

K1NGD4VID avatar Oct 21 '26 17:10 K1NGD4VID

@baba-billy has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Please assign

ℹ️ Repo Maintainers: To accept this application, review their application or assign @baba-billy to this issue.

baba-billy avatar Oct 21 '26 20:10 baba-billy

@lucredtech has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Happy to take this one. I'll add tests for token-registry.service.ts covering a Redis hit, invalid cached JSON, Redis being down, a database hit and a cold lookup, asserting the network is only called on a true miss and that results are written back. ETA a few hours.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @lucredtech to this issue.

lucredtech avatar Oct 21 '26 22:10 lucredtech

@camesenin has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hi @maintainers and flowfi team!

I would like to resolve issue #1713: [test] Cover token-registry cache fallback and read-through behavior.

Implementation Plan:

  1. Audit token registry cache service and read-through pathways under network/RPC stress.
  2. Add deterministic mock fixtures and integration tests asserting fallback cache hits on upstream timeouts.
  3. Ensure all tests and lint pass cleanly.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @camesenin to this issue.

camesenin avatar Oct 21 '26 22:10 camesenin

@aliyuHabibu has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hi maintainer, i reviewed the issue and this is exactly the type of work i enjoy, i can deliver a clean, well-tested PR promptly, please assign it to me.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @aliyuHabibu to this issue.

aliyuHabibu avatar Oct 22 '26 06:10 aliyuHabibu

@olalekan22-tech has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hi maintener, I can fix this issue. Kindly assign to me.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @olalekan22-tech to this issue.

olalekan22-tech avatar Oct 22 '26 07:10 olalekan22-tech

@Maxwell-tom has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hi maintainer I would like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Maxwell-tom to this issue.

Maxwell-tom avatar Oct 22 '26 07:10 Maxwell-tom

@Victor123-star has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

I'm interested in working on this could you assign this issue to me

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Victor123-star to this issue.

Victor123-star avatar Oct 22 '26 08:10 Victor123-star

@Cmitchelle7 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hi Maintainer, reviewed the issue in detail. Full stack background with solid experience relevant to this task. No blockers on my end — I'm ready to submit a PR shortly. Please assign.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Cmitchelle7 to this issue.

Cmitchelle7 avatar Oct 22 '26 08:10 Cmitchelle7

Congratulations, @olalekan22-tech! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

🧑‍💻 @olalekan22-tech: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Oct 22 '26 09:10 drips-wave[bot]

@joeadive-cell has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

I’m interested in taking this issue. I’ve gone through the requirements and have a clear understanding of the expected outcome. I can handle the implementation, testing, and any necessary documentation, then submit a focused PR for review. I’m available to start right away.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @joeadive-cell to this issue.

joeadive-cell avatar Nov 18 '26 16:11 joeadive-cell

@CodeMayor has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

I'd like to work on this because the cache fallback paths decide whether token lookups succeed or hit the network unnecessarily, and none are tested yet. I'll add tests for TokenRegistry with mocked Redis, database, and RPC covering a Redis hit, invalid cached JSON, Redis unavailable, a database hit that avoids RPC, a cold lookup, and a Redis write failure that doesn't break the lookup, and make sure they run in backend CI.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @CodeMayor to this issue.

CodeMayor avatar Nov 18 '26 16:11 CodeMayor

@Adejoke46 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

Hello Maintainer,

I would like to express my interest in contributing to this issue. I am eager to contribute to the project by helping address the identified problem and delivering a solution that meets the project's requirements.

I am committed to understanding the issue, following the project's contribution guidelines, testing my work where applicable, and making any necessary improvements based on feedback.

I value collaboration, clear communication, and quality contributions. I am ready to dedicate the necessary effort to completing this task responsibly and ensuring that my contribution adds value to the project.

Thank you for considering my application. I look forward to the opportunity to contribute to your project.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Adejoke46 to this issue.

Adejoke46 avatar Nov 18 '26 17:11 Adejoke46

@Thobadd has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

Hi maintainer,

I'd like to take a shot at this issue. I went through the checkout flow and looked at the XLM checkout modal component. I can see exactly what's happening when a user rejects the transaction in Freighter — the promise gets rejected, but there's no catch around it. The modal just sits there in its loading state, leaving the user staring at a spinner with no feedback. Since rejecting a transaction is a normal thing to do, the app shouldn't freeze.

My plan is to wrap the Freighter signing call in a try/catch and specifically detect the rejection case. From what I've seen with the Freighter API, user rejection usually comes back as an error containing something like "User declined" or "User rejected the request." I'll check for that pattern to distinguish an intentional rejection from a real failure like a network issue. On rejection, I'll reset the modal's loading state so the UI doesn't freeze and surface a friendly toast like "Transaction rejected in Freighter. No funds were sent." For genuine errors, I'll keep a separate message so we don't conflate the two.

A couple of things I want to get right: first, the loading state needs to be reset in a finally block so we never leave the button disabled if something unexpected throws. Second, I'll make sure the toast component matches the pattern already used in the codebase rather than introducing a new one. I'll also manually verify the flow by rejecting in the Freighter extension to confirm the modal returns to a usable state.

I've contributed to a few React/TypeScript projects before and I'm comfortable with error-handling patterns like this. I'll keep the PR scoped to just this component, and the PR description will include the required closing tag as requested. Happy to adjust the message copy if you have a preferred tone. Let me know if you'd like me to proceed or if there's anything else you want covered in scope.

Thanks

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Thobadd to this issue.

Thobadd avatar Nov 20 '26 16:11 Thobadd

@simplex001 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

i can resolve

ℹ️ Repo Maintainers: To accept this application, review their application or assign @simplex001 to this issue.

simplex001 avatar Nov 21 '26 08:11 simplex001

Congratulations, @simplex001! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @simplex001: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 08:11 drips-wave[bot]

This issue has been completed by @simplex001 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @simplex001: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 22 '26 20:11 drips-wave[bot]