Skip to content

Fall back to Bitrefill when Phaze is remotely disabled - #6197

Open
j0ntz wants to merge 2 commits into
developfrom
jon/fix/edgespend-phaze-disable-fallback
Open

Fall back to Bitrefill when Phaze is remotely disabled#6197
j0ntz wants to merge 2 commits into
developfrom
jon/fix/edgespend-phaze-disable-fallback

Conversation

@j0ntz

@j0ntz j0ntz commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Asana: https://app.asana.com/0/1215088146871429/1218192628740167

The info server serves giftCardInfo: { disablePlugins: { phaze: true } } and the app ignores it.

The remote config never reaches the app. updateGiftCardInfo reads giftCardInfo off infoServerData.rollup, which is the payload after asInfoRollup ran. That cleaner drops every key it does not know, and edge-info-server@3.12.0 has no giftCardInfo, so the store has always reported every gift card provider enabled no matter what the info server serves. The remote enable/disable feature has been inert since it shipped in 4.49.0. This PR keeps the raw payload as infoServerData.rollupRaw and parses the field there with the cleaner the app already owns.

Bumping the dependency instead does not work. edge-info-server@3.13.0 does define giftCardInfo, but it also star-exports an attestation module that pulls jose's node build, and Metro cannot resolve its require('crypto'): the app red-screens with Unable to resolve module crypto from .../jose/dist/node/cjs/runtime/digest.js. That is worth fixing upstream so the typed rollup can carry the field, and it is not a prerequisite here.

A disabled Phaze still routed into Phaze-backed scenes. Even with the config flowing, the Spend entry points consulted only ENV.PLUGIN_API_KEYS.phaze.apiKey. An account with purchase history landed on the list scene, which polls the Phaze API every ten seconds. Everyone else landed on the market scene, which built the Phaze provider (registering a Phaze identity along the way) and fetched a catalog whose brands it then filtered away entirely. Both entry points now go through pickGiftCardDestination, which sends an unusable Phaze straight to the Bitrefill webview, and the market scene gates its provider and its queries on the same check so nothing touches Phaze while the provider is off. With Bitrefill disabled as well, the market scene says gift cards are unavailable instead of rendering an empty grid.

One tradeoff needs a ruling. A disabled Phaze now hides the EdgeSpend list scene for accounts holding Phaze vouchers, because that scene is Phaze-only and its polling is what the disable exists to stop. If unredeemed vouchers must stay reachable during a disable, that needs its own surface rather than the current scene.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Medium Risk
Changes Spend/gift-card routing and info-server config plumbing; mis-parsing rollupRaw or wrong disable checks could hide providers or leave Phaze traffic running when it should be off.

Overview
Fixes gift card remote kill-switch that never applied because giftCardInfo was read from the typed info rollup after asInfoRollup stripped unknown keys. The app now keeps rollupRaw and parses disablePlugins with its own cleaner so info-server flags actually reach Redux.

Spend and gift-card navigation go through pickGiftCardDestination: when Phaze is off (no API key or whole-provider disable), users open the Bitrefill plugin directly instead of Phaze list/market scenes that would register identities, poll, or fetch catalogs. Per-brand Phaze disables still allow the market; if Bitrefill is disabled too, the market shows a providers unavailable message.

GiftCardMarketScene and useGiftCardProvider honor the same Phaze-off check (enabled: false) so no Phaze network work runs while disabled. Home defers Spend to navigateToGiftCards and adjusts the tile footer when Phaze isn’t available. Unit tests cover the routing matrix.

Reviewed by Cursor Bugbot for commit 576a826. Bugbot is set up for automated code reviews on this repo. Configure here.

asInfoRollup drops every key it does not know, and edge-info-server 3.12.0 has
no giftCardInfo, so the remote gift card enable/disable config never reached the
app: the store always reported every provider enabled no matter what the info
server served. Keep the raw payload alongside the cleaned rollup and parse the
field there with the cleaner the app already owns.

edge-info-server 3.13.0 does define giftCardInfo, but it also star-exports an
attestation module that pulls jose's node build, whose require('crypto') Metro
cannot resolve, so the bump is not currently an option.
@j0ntz

j0ntz commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

📸 Test evidence

before phaze shown while disabled

before phaze shown while disabled

home tile bitrefill copy

home tile bitrefill copy

bitrefill webview

bitrefill webview

Captured by the agent's in-app test run (build-and-test).

@j0ntz
j0ntz marked this pull request as ready for review September 4, 2026 20:26
@j0ntz
j0ntz force-pushed the jon/fix/edgespend-phaze-disable-fallback branch from 5093e95 to 7aca8b9 Compare September 4, 2026 20:26
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7aca8b9. Configure here.

Comment thread src/components/scenes/GiftCardMarketScene.tsx
Every gift card scene is backed by Phaze, so a remote disable through the info
server's giftCardInfo still left the Spend flow entering those scenes: the
market scene built the Phaze provider (which registers a Phaze identity) and
fetched a catalog whose brands it then filtered away entirely, and an account
with purchase history landed on the list scene, which polls the Phaze API every
ten seconds.

Route both entry points through pickGiftCardDestination, which sends an
unusable Phaze straight to the Bitrefill webview, and gate the market scene's
provider and queries on the same check so nothing touches Phaze while it is
off. With Bitrefill disabled as well the market scene says so instead of
rendering an empty grid.
@j0ntz
j0ntz force-pushed the jon/fix/edgespend-phaze-disable-fallback branch from 7aca8b9 to 576a826 Compare September 4, 2026 20:34

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.

Tip: disable this comment in your organization's Code Review settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant