SoloMedium10m

The Downtime Report That Counted the Same Minute Twice

### P2 · The reliability report does not reconcile Checkout's one-hour report claims 1,420 unavailable seconds, but overlapping alerts cover only 940. A retry and a nested component alert are being counted as extra outages.

Your task: Fix only covered_seconds() in outage.py. Clip half-open intervals to the report window and measure their union. Preserve gaps, handle duplicates and nesting, and leave inputs unchanged. Work on endpoints, not every second.

Investigate: Run python monitor.py, then python -m pytest -v. The starter is intentionally wrong; the monitor should reconcile after your repair. Open a PR against main with your reasoning.

Learn: interval union, sorting, boundary semantics and regression testing. Python 3.12, standard-library runtime, pinned pytest test tools.

The incident and timeline are authored fixtures. This verifies elapsed coverage aggregation, not real production availability or contractual SLA compliance.

Skills you'll prove

pythonalgorithmsinterval-unionhalf-open-intervalstestingdebuggingbook-vs-prod

Interview Tip

I treated alerts as intervals, not independent durations. I clipped them to one half-open reporting window, ordered a copy, and accumulated covered segments without double counting. Nested intervals could not shrink the active end, gaps stayed uncovered, and tests covered duplicate alerts, large timestamps and unchanged inputs.

Browse freely — sign in when you're ready to open a ticket and prove your skills.