Skip to content

fix: track Ponder fallback routing as a flag, not a URL comparison - #62

Closed
Danswar wants to merge 1 commit into
developfrom
fix/apollo-fallback-flag-not-url-compare
Closed

fix: track Ponder fallback routing as a flag, not a URL comparison#62
Danswar wants to merge 1 commit into
developfrom
fix/apollo-fallback-flag-not-url-compare

Conversation

@Danswar

@Danswar Danswar commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Ports d-EURO#123 (same api.apollo.config.ts, forked codebase).

  • errorLink decided whether a failed Ponder request already went to the fallback by comparing operation.getContext().targetUrl against CONFIG.indexerFallback as strings.
  • DFXServer/server#869 sets CONFIG_INDEXER_FALLBACK_URL to the same host as CONFIG_INDEXER_URL on both dfxprd and dfxdev (the only way to keep the var populated without leaking prd traffic onto dev). With primary and fallback string-identical, the comparison is true on every request regardless of which URL it actually went to, so the warn + retry branch could never execute — every network error would still fall through to logger.error, making #869 alone insufficient to fix the noisy error-level logging observed in Grafana for juicedollar-jdm-api.
  • Fix: routingLink now stamps usedFallback: isFallbackActive() at send time, and errorLink reads that flag instead of re-deriving it from a URL comparison.

Test plan

  • Verified same logic already confirmed correct upstream in fix: track Ponder fallback routing as a flag, not a URL comparison d-EURO/api#123 (traced retry path: routingLink re-stamps context on retry from the now-fallback-active state, so a second failure against the fallback still correctly falls through to error).
  • After merge + redeploy alongside DFXServer/server#869: watch Loki for juicedollar-jdm-api ApiApolloConfig network-error lines to move from error to warn on the next transient Ponder blip.

Ported from d-EURO#123. sentToFallback compared the request's
targetUrl against CONFIG.indexerFallback by string value. Our compose
files (dfxprd + dfxdev) set CONFIG_INDEXER_FALLBACK_URL to the same
host as CONFIG_INDEXER_URL — the only way to keep the var populated
without cross-environment failover. With primary and fallback
string-identical, the comparison is true on every request regardless
of which URL it actually went to, so the warn+retry branch never
fires and every network error still falls through to logger.error.

Stamp the routing decision itself (isFallbackActive() at send time)
instead of re-deriving it from a URL string.
@Danswar

Danswar commented Jul 23, 2026

Copy link
Copy Markdown
Author

Superseded by #63 — rebuilt on a fresh branch to fix the PR body/commit message referencing internal infra details that shouldn't be in a public repo. Same fix, same file.

@Danswar Danswar closed this Jul 23, 2026
@Danswar
Danswar deleted the fix/apollo-fallback-flag-not-url-compare branch July 23, 2026 00:35
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