Friend Finder — test readiness for launch

Friend Finder — test readiness

Analysis of 2026-12-05 · FRIEND_FINDER is off in prod (notInProd) until launch (~April 2027). Goal: when it gets turned on in Cerebro, everything automatable is already covered.

10 → 87automated tests for the feature
7 / 7layers covered (were 2)
10items that can't be automated → checklist
0bugs found by the new tests

Coverage by layer

LayerBeforeNowWhat it guarantees
Pure logic (database)
test/unit/friendFinder.test.ts
99E.164 normalization, HMAC, duplicates, one-sided ≠ match, resync, chunks of 30.
Callables vs emulator
test/api/friendFinder.test.ts
015 newNo session → unauthenticated; flag off → rejects syncs but turning off always works; >5000 numbers / >40 characters / non-text → invalid-argument; NO_PHONE; fallback to users_private; no raw number or non-user HMAC is stored; SYNC_TOO_SOON; re-upload handshake (B turns it on after A → A gets resyncRequestedAt → A re-uploads → both see each other); one-sided contacts don't match; follow states (following, follows me, request pending on a private account); account being deleted hidden; turning it off erases it and you disappear for others; idempotent.
Security rules
test/firestore/friend-finder-firestore-rules.test.ts
03 newNobody (not even the owner) can read, list, write or delete friend_finder; you can't search by HMAC or plant a doc with someone else's code.
Account erasure (Cerebro)
admin-users.emulator.ts
0+3 checksDeleting an account erases its doc and removes its code from other people's lists without touching the rest.
Client sync logic
test/unit/friend-finder-store.test.ts
018 newAnother account's cache never shows up on a shared phone; at app open: nothing with the flag off / without the module / turned off; asks the server once if unknown; respects 6 h; re-uploads only on request or weekly and never without permission; silent errors; dedupe and cap at 5000; names come from this phone; turning off clears the cache only if the server confirms.
Screens
test/components/FriendFinderScreens.test.tsx
014 newList: flag off → /profile; not on → intro; empty; New / In your contacts / Already friends sections with the right action (Add, Follow back, Request, Requested, Following); one tap; search; turning off with confirmation and its error. Intro: permission granted / denied / server error; from onboarding «Ahora no» → /events; from the profile → back.
Native contacts
test/components/contacts-source.test.tsx
03 newAn APK without the native module says «unavailable» (doesn't crash); permission mapping; only names + numbers, contacts without a number skipped.
Mobile E2E
e2e/friend-finder.spec.ts
1+1 = 2Full mutual flow (existing) + flag off, prod's state until launch: sign-up ends on /events, no profile card, /friends closed; flipping it back on shows the card live, as Cerebro will.
Onboarding
OnboardingScreen.test.tsx
11Lands on /events or the intro depending on availability.
All of it runs in CI on its own: the callables test goes in with test:triggers, the rules test with test:firestore, the mobile ones in Test Mobile. The Cerebro test and the E2E are local (as always).

What can't be automated — checklist for the launch day

#ItemWhy / how
1Two real phones with the Play-signed prod appThe callables require App Check (Play Integrity): only an app installed from Play reaches prod. Test mutual, add, turn off.
2Google Play: Data safety + review of the disclosureContacts: collected, not shared, optional, deletable. The intro screen is the «prominent disclosure» Play requires before READ_CONTACTS.
3Turn on FRIEND_FINDER in Cerebro (dancers-prod)The E2E proves the change applies live, with no app update. The server reads it with a short cache.
4Legal review of privacy policy 2.EStill pending since 2026-12-04 (same as 2.D).
5iOSThere's no iOS build. When there is one: permission text (already in app.json) and «limited access» on iOS 18.
6A large address book on a modest AndroidIt reads the whole book in one go: try ~3,000 contacts and check that the screen doesn't freeze.
7Never rotate FRIEND_FINDER_PEPPER lightlyChanging it invalidates every stored code: nobody would find anyone until they re-upload. If it has to change, erase friend_finder and let everyone re-upload.
8Monitoring the first daysLogs friendFinderSync (uploaded / opted-in contacts / mutual) and Sentry for errors; cost: 5,000 contacts ≈ 167 queries per upload (estimated in firestore-cost-audit.html).
9A fresh APK from the current codeThe one being uploaded to Play must come after ed0e66885 (the 2026-12-03 AAB doesn't include the feature).
10Run the full mobile E2E with the flag ON and OFFThe day before turning it on, to confirm nothing has broken in 4 months.

Notes from the analysis