The hunt, and the test that ate its own notification


This is the feature that makes it a game rather than a scoreboard: if you are it, your phone wakes itself up and tells you someone is within a kilometre of you.

What the phone is allowed to know

Almost nothing, and that is the design.

The phone uploads its own position in the background — significant location changes and geofencing, not continuous tracking, because a month of continuous GPS is a month of dead batteries. Then it asks the server a single question: is anyone near me?

The server answers with a conclusion, never coordinates. Being it does not grant you the right to read anyone's location; it grants you the right to be told that someone is close. Everyone else gets nothing at all.

On top of that sit the anti-spam rules, which are more interesting than they sound:

  • one alert per pair of players every two hours
  • a new alert about the same person only after they have left 2 km and come back
  • at night, between 23 and 07, nothing under 300 metres

Without those, being it in a small town would mean a phone that buzzes every four minutes until you throw it in a lake.

Four theories, all wrong

The automated test for this was red for most of a day, and the failure was maddening because everything looked right. The hunter was in position, the prey was in position, the rule was proven by the database tests. The app just said nearby: 0.

I worked through the obvious suspects and eliminated all of them: wrong coordinates, position never uploaded, the night rule biting, the wrong account logged in.

The answer was that the test was consuming its own notification.

The suite runs in two phases, because a simulator only has one location at a time. Phase one puts the phone at the prey's position and logs in as the hunter for phase two. In that moment — hunter logged in, phone still standing on the prey's coordinates — the app did what it is supposed to do: asked the server, got an answer, and recorded an alert. The two-hour cooldown then silenced phase two completely.

Nothing was broken. The app was right, the rule was right, and together they produced a red test.

Two things I will carry forward

Anti-spam rules make tests look broken. An empty answer from the proximity check does not mean the check is broken. It can mean the check is working and something already used up the alert.

Reproduce it in the rig before suspecting the app. It became obvious the moment I made the database test run two checks in a row, the way the app actually does. I should have gone there first instead of re-reading Swift.

The fix in the test rig is a launch flag that uploads positions but never asks the question. The rig should set the board, not play the move.

Next: stage 2 — the map, the UAV, truces, Bluetooth indoors, and a photo album for evidence.

All entries