Two Digits Too Few — Python Bug Hunt

Inspired by Y2K — billions were spent because "99" meant 1999 but "00" meant… 1900?

  • Language: Python
  • Layer: Backend
  • Difficulty: Easy
  • Concepts: Parsing, Y2K
  • Modelled on: Y2K
  • Visible tests: high two-digits stay in the 1900s; low two-digits land in the 2000s
  • Reward: 50 XP for a complete fix

Briefing

Inspired by Y2K — billions were spent because "99" meant 1999 but "00" meant… 1900? Legacy feeds still send two-digit years, and the agreed pivot rule is: below 30 → 2000s, otherwise 1900s.

years.py still lives in the 20th century.

Bug report

BUG-Y2K · Reported by: partner integrations

parse_year(two_digits):

  • "99" -> 1999
  • "23" -> 2023
  • "00" -> 2000
  • "30" -> 1930 (the pivot)

Observed: everything gets 1900 added — customers born in "05" are 120 years old and the compliance system keeps flagging them as deceased.

Logs

[kyc] dob year "05" -> 1905 -> age 121 -> auto-flag

The code as shipped

src/legacy/years.py (editable)

# Expands a two-digit year from legacy feeds.

PIVOT = 30

def parse_year(two_digits):
    return 1900 + int(two_digits)

Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More Python bug hunts.