Skip to content

Distinguish live vs mock-data fallback across all Server Component fetchers #1

Closed

Description

@chonilius

Problem

src/lib/api.ts#fetchWithFallback silently swallows every failure mode from the backend — a 500, a timeout, a malformed JSON body, a DNS failure, a CORS rejection — and substitutes mock data with zero signal to the user or to observability. On /issues, /milestones, and the three dashboard routes, this means a genuinely broken backend renders a pixel-perfect, fully interactive UI full of fabricated bounties, reward amounts, and escrow IDs. A sponsor could look at /dashboard/sponsor, see "budget remaining: $4,230" from mock-data.ts, and make a funding decision based on fiction, with no visual distinction between live and mock data anywhere in the render tree.

Why this is hard

This isn't a one-line fix. You need to:

  1. Design a way to propagate "this is mock data" as a typed signal through fetchWithFallback, fetchBounties, fetchBounty, fetchMilestones, fetchMaintenancePools, and fetchReputationByUsername without breaking the Server Component call sites that currently just want a plain array/object back.
  2. Decide the right UX: a banner? Per-card badge? Different treatment for "backend down" (systemic) vs "record not found" (fell back to a single mocked bounty)? These are currently indistinguishable — fetchBounty falls back on both a 404 and a network error.
  3. Do this without breaking the "always demoable" promise the README makes — the fallback must still render, just distinguishably.
  4. Add server-side logging/telemetry (there is none currently — no error reporting integration exists in this repo) so a real outage is discoverable, since these are Server Components and errors never reach the browser console.
  5. Handle the race where the backend is flaky (intermittent 500s) rather than fully down — avoid flapping banners across navigations.

Scope

  • Introduce a FetchResult<T> = { data: T; source: "live" | "mock" } (or equivalent) return shape, threading it through every fetcher in src/lib/api.ts.
  • Update all Server Component call sites in src/app/** to read the new shape.
  • Add a visible, dismissible "showing sample data" indicator on affected pages, styled to match the slate/emerald dark-mode design system.
  • Add minimal server-side error logging (structured console.error is acceptable given no APM exists) distinguishing network failure, non-2xx, and parse failure.
  • Write down (in the PR description) the decision on how apiRequest (used for user-triggered actions) should behave differently from fetchWithFallback given it already throws instead of falling back — confirm no regression there.

Acceptance criteria

  • With the backend stopped, every affected route visibly indicates mock data is in use.
  • With the backend returning 500s, the same indicator appears, and a server log line identifies the failing path and status.
  • With the backend healthy, no indicator appears and no behavior changes.
  • apiRequest-based flows (claim, fund, deposit) are unaffected.

Activity

  1. added
    very hard
    bug
    architecture
    on Jul 15, 2026
  2. added
    GrantFox OSS
    Maybe Rewarded
    Official Campaign | FWC26
    on Jul 15, 2026
  3. added
    Stellar Wave
    on Aug 25, 2026
  4. Ahbiz commented on Aug 25, 2026

    @Ahbiz

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

    Hello maintainer, i would love to work on this issue.

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

  5. devgodfreytem commented on Aug 25, 2026

    @devgodfreytem
    Contributor

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

    Hello maintainer, i would love to work on this issue.

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

  6. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @devgodfreytem! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @devgodfreytem: 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 🌊

  7. grantfox-oss commented on Aug 25, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!

    @devgodfreytem's PR #335 was approved and merged by @chonilius.

    🏆 @devgodfreytem: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (156 total points). Track your full progress on GrantFox.

    👏 Great work, @devgodfreytem! Keep contributing to MergeFi.

  8. drips-wave commented on Aug 25, 2026

    @drips-wave

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

    😎 @devgodfreytem: You earned 200 Points for completing this issue! After the current Wave ends, 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.

  9. removed
    Stellar Wave
    on Oct 15, 2026
  10. added
    Stellar Wave
    on Oct 15, 2026
  11. removed
    Stellar Wave
    on Oct 15, 2026
  12. added
    Stellar Wave
    on Oct 15, 2026
  13. removed
    Stellar Wave
    on Oct 15, 2026
  14. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSMaybe RewardedOfficial Campaign | FWC26Stellar Wavearchitecturebugvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions