Skip to main content
HardBug fixPython60 min

Session rollup over-counts one user's visits

A practice debugging interview round in Python. Reproduce the failure in an unfamiliar codebase, narrow down the cause, ship a minimal fix, and explain your reasoning to an AI interviewer.

The incident

The Growth analyst reads this rollup every morning. It groups each user's raw click events into sessions and prints, per user, how many sessions they had overnight, so Growth can see who is genuinely returning versus who clicked once. This morning one user reads as more sessions than the product analytics dashboard shows for the same period, so Growth stopped trusting the rollup until the two agree.

session_rollup.py reads the collector's event feed and prints, per user, the number of inactivity-gap sessions that user had.

A session groups a user's consecutive clicks. Two consecutive events by the same user belong to the SAME session when the gap between them is at most GAP_SECONDS (1800 seconds); a gap LARGER than GAP_SECONDS starts a new session. An event that lands exactly GAP_SECONDS after the previous one is still within the window and belongs to the same session.

Within a user, events are considered in timestamp order. The feed may deliver a user's events out of order, so they are sorted by timestamp before sessions are counted.

What this round practices

Sessionization turns raw clicks into visits, and growth decisions rest on that count. One user reads as more sessions than the analytics dashboard, a single boundary click away from looking like a power user, so the round is about inactivity gaps and the clicks right at the edge.

Files you will work in

These 4 workspace files open in the in-browser editor when you start the round. Hidden tests also run when you submit.

  • task.md
  • src/session_rollup.py
  • fixtures/input.txt
  • tests/expected_output.txt

What you are assessed on

The scored report evaluates both your investigation steps and what you explain during the conversation, not only whether the final test run passes.

  • Reproduction
  • File navigation
  • Evidence gathering
  • Hypothesis
  • Root-cause understanding
  • Regression prevention
  • Patch scope
  • Verification
  • Edit control
  • Communication clarity

How the round works

You get 60 minutes in a Python workspace that runs in your browser, with no setup. Talk through your plan with the AI interviewer by voice or text, run the tests as often as you like, and submit when the visible checks pass. Hidden tests run on submit, and the scored report covers what you did and what you explained.

Ready to debug this codebase?

Open the workspace, run the failing check first, and walk the AI interviewer through your findings.