Skip to content

fix: stop unit-test sessions firing RPCs at production#457

Open
raulriera wants to merge 3 commits into
mainfrom
fix/no-production-rpcs-from-unit-tests
Open

fix: stop unit-test sessions firing RPCs at production#457
raulriera wants to merge 3 commits into
mainfrom
fix/no-production-rpcs-from-unit-tests

Conversation

@raulriera

@raulriera raulriera commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Investigating simulator log spam ("Failed to load conversation feed error=unknown", dozens per second) showed it wasn't a retry loop — it was the unit-test suite. The shared mock container wires real mainNet gRPC clients, so every test-built session fetched profile, flags, balances, and the conversation feed against production, and opened live streams, all doomed to denials for its unregistered owner.

The fix routes Container.mock, Client.mock, and FlipClient.mock through a new Network.offline case that resolves every host to loopback, so no member of a test- or preview-built object graph can reach the real backend regardless of which call site fires. Per-site guards skip the doomed work in the hottest paths; the offline network is the structural backstop that also covers the paths guards miss. A canary test pins every offline entry point so a revert fails loudly instead of silently resuming production traffic.

Test plan:

  • FlipcashTests and FlipcashCoreTests pass
  • Simulator log during a unit-test run shows no denied-RPC spam
  • AllTargets suite passes

raulriera added 3 commits July 3, 2026 15:15
Container.mock wires real mainNet gRPC clients, so every test-built
Session/SessionContainer fetched profile, flags, balances, and the
conversation feed against production with unregistered owners. The
server-backed bootstrap is now skipped under unit tests, mirroring the
existing startStreaming() guard.
…ch production

Container.mock, Client.mock, and FlipClient.mock now build on a new
Network.offline case that resolves every host to loopback. This is the
structural backstop behind the per-site test guards: no matter which
member of a test- or preview-built object graph fires a request, it can
never reach the real backend. Also gates chatSpotlightIndexer.start()
under unit tests (a CoreSpotlight XPC call the offline network can't
cover) and relaxes poller to an optional since it stays nil under tests.
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