Use cases

See how they solve problems in a real codebase.

VS Code, a terminal and Git, on a machine of their own.

webhook-ingest

Explorer

webhook-ingest

app

ingest.py

main.py

models.py

scripts

load.py

tests

conftest.py

test_ingest.py

pyproject.toml

test_ingest.py
ingest.py
1import asyncio
2import pytest
3from app.ingest import ingest, queue
4from tests.helpers import drain
5
6@pytest.mark.asyncio
7async def test_burst_keeps_every_event(make_events):
8 burst = make_events(2000, duplicate_rate=0.1)
9 unique = {event.id for event in burst}
10 async with drain(queue) as stored:
11 await asyncio.gather(*(ingest(e) for e in burst))
12 assert len(stored) == len(unique)
1import asyncio
2queue = asyncio.Queue(maxsize=1000)
3seen: set[str] = set()
4
5async def ingest(event) -> bool:
6 if event.id in seen:
7 return False
8 await asyncio.sleep(0)
9 seen.add(event.id)
10 try:
11 queue.put_nowait(event)
12 except asyncio.QueueFull:
13 return False
8 seen.add(event.id)
9 try:
10 await queue.put(event)
11 except BaseException:
12 seen.discard(event.id)
13 raise
14 return True
TerminalProblems
2
Output
❯ pytest -q tests/test_ingest.py
..F... [100%]
FAILED tests/test_ingest.py::test_burst_keeps_every_event
E assert 1412 == 1817
1 failed, 5 passed in 0.84s
❯ pytest -q
............... [100%]
15 passed in 1.92s
❯ python scripts/load.py --events 20000
sending0
sent 20,000 stored 20,000 dropped 0
fix/ingest-backpressurePython 3.12
ingest.pyapp
test_ingest.pytests

Priya Shah

now

Webhooks dropping under load

Last night's replay lost 612 events. Can you find it before the 4pm deploy?

⌘P
⌘S

Three pieces of engineering work in VS Code. First, an email reports webhook events lost under load; a failing test reproduces it, the ingest function shows a race and a queue that drops when full, the fix applies backpressure, and the tests and a 20,000 event load run pass. Second, an email reports an orders export crashing; the heap climbs to its limit, the code is changed to stream rows to disk, the tests pass and 2.4 million rows export at a flat 118 MB. Third, an email asks whether a refund spike is fraud; a DuckDB query in a Jupyter notebook charts refunds by hour, a second query breaks down the spike to duplicate charges from one app version, and the answer is emailed back with the notebook.

A computer of their own.

Each candidate gets their own isolated workspace. Nothing to install.

VS Code

Editor, terminal and debugger in the browser

Git

A repository with history, and a remote of its own

Python

pytest, pandas, NumPy, DuckDB

TypeScript and Node.js

Node 24, npm, tsc, tsx

Jupyter

Notebooks with a Python kernel

fix/ingest-backpressure

Review requested
10:06Apply backpressure instead of dropping events+6 −5
09:38Add a failing test for a 2,000 event burst+24 −0

Tomas, reviewing

Good catch on the dropped events. What happens if put() is cancelled?

Git, with review.

They commit, then ask a teammate to review. Every commit is kept.

Look inside the work.

Open any claim to the diff, the test run or the review.

tests/test_ingest.py

Committed 09:38, before any fix
18+@pytest.mark.asyncio
19+async def test_burst_keeps_every_event(make_events):
20+ burst = make_events(2000, duplicate_rate=0.1)
21+ unique = {event.id for event in burst}
22+ async with drain(queue) as stored:
23+ await asyncio.gather(*(ingest(e) for e in burst))
24+ assert len(stored) == len(unique)

Try it on one role.

Your first simulation is free.