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
| Layer | Before | Now | What it guarantees |
|---|---|---|---|
Pure logic (database)test/unit/friendFinder.test.ts | 9 | 9 | E.164 normalization, HMAC, duplicates, one-sided ≠ match, resync, chunks of 30. |
Callables vs emulatortest/api/friendFinder.test.ts | 0 | 15 new | No 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 rulestest/firestore/friend-finder-firestore-rules.test.ts | 0 | 3 new | Nobody (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 checks | Deleting an account erases its doc and removes its code from other people's lists without touching the rest. |
Client sync logictest/unit/friend-finder-store.test.ts | 0 | 18 new | Another 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. |
Screenstest/components/FriendFinderScreens.test.tsx | 0 | 14 new | List: 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 contactstest/components/contacts-source.test.tsx | 0 | 3 new | An APK without the native module says «unavailable» (doesn't crash); permission mapping; only names + numbers, contacts without a number skipped. |
Mobile E2Ee2e/friend-finder.spec.ts | 1 | +1 = 2 | Full 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. |
OnboardingOnboardingScreen.test.tsx | 1 | 1 | Lands 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
| # | Item | Why / how |
|---|---|---|
| 1 | Two real phones with the Play-signed prod app | The callables require App Check (Play Integrity): only an app installed from Play reaches prod. Test mutual, add, turn off. |
| 2 | Google Play: Data safety + review of the disclosure | Contacts: collected, not shared, optional, deletable. The intro screen is the «prominent disclosure» Play requires before READ_CONTACTS. |
| 3 | Turn 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. |
| 4 | Legal review of privacy policy 2.E | Still pending since 2026-12-04 (same as 2.D). |
| 5 | iOS | There's no iOS build. When there is one: permission text (already in app.json) and «limited access» on iOS 18. |
| 6 | A large address book on a modest Android | It reads the whole book in one go: try ~3,000 contacts and check that the screen doesn't freeze. |
| 7 | Never rotate FRIEND_FINDER_PEPPER lightly | Changing 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. |
| 8 | Monitoring the first days | Logs friendFinderSync (uploaded / opted-in contacts / mutual) and Sentry for errors; cost: 5,000 contacts ≈ 167 queries per upload (estimated in firestore-cost-audit.html). |
| 9 | A fresh APK from the current code | The one being uploaded to Play must come after ed0e66885 (the 2026-12-03 AAB doesn't include the feature). |
| 10 | Run the full mobile E2E with the flag ON and OFF | The day before turning it on, to confirm nothing has broken in 4 months. |
Notes from the analysis
- The new tests didn't find bugs in the feature. The only bug of these days came from trying it on a real phone (title cut off on Android), already fixed.
- The rules tests wipe the emulator's data when they run (that's how they're designed); afterwards I reseeded it.
- When I ran it, the mobile suite had 2 failures that aren't Friend Finder's (another session's web copies:
story-facts.ts,build-story-info.ts).