Both halves passed
We found that dismissing a staff member didn’t end their session. Their login token stayed valid for up to seven days, so a bursar dismissed on Monday kept the finance office until the following Monday.
The fix looked obvious: check whether the user is still active on every request.
It would have done nothing.
The school’s Deactivate button never wrote that flag. It set the employee profile inactive — a different row, a different field. So the guard would have been watching a value the product’s own interface never touched.
Here is the part that unsettles me. A test on the guard passes: given an inactive user, deny. A test on the button passes: it deactivates the employee. Both halves are correct and the feature does not exist. No unit test could have seen it, because the gap is not inside either half — it’s in the assumption that they were talking about the same thing.
The question that catches this class of bug isn’t about code, it’s about paths: does the button a school actually clicks reach this code?
There was a second finding underneath. Because the safe option silently did nothing, the only thing that genuinely ended access was delete — which destroys the person’s history. So a school’s real choice was leak for a week or erase them, and nobody would ever have reported it, because deleting appeared to work.
When the safe path fails silently, people adopt the destructive one and stop noticing. An absence of complaints is not evidence that anything works.