Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan

Debug an Issue in Code

MediumCoding00:00
Practice interviewer
In session
5 left
00:00

Your question is Debug an Issue in Code. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

You're interviewing for a Software Engineer role on a team that owns GitHub's webhook delivery pipeline, the service that takes repository events (pushes, issues, releases) and forwards them to downstream consumers.

A teammate wrote the event handler below. It passed code review, shipped, and now the on-call channel is reporting that some repositories stop receiving certain events after a while, and that a handful of deliveries are being retried far more than expected.

import hmac
import hashlib

MAX_RETRIES = 3
ALLOWED_EVENTS = "push pull_request issues release"

def verify_signature(payload_body, secret, github_signature):
    expected = "sha256=" + hmac.new(secret.encode(), payload_body, hashlib.sha256).hexdigest()
    return expected == github_signature

def process_event(payload, seen_ids=[]):
    event_id = payload.get("delivery_id")
    event_type = payload.get("event_type", "")

    if event_id in seen_ids:
        return "duplicate"
    seen_ids.append(event_id)

    if event_type not in ALLOWED_EVENTS:
        return "ignored"

    retries = 0
    while retries <= MAX_RETRIES:
        try:
            forward_to_queue(payload)
            return "delivered"
        except Exception:
            retries += 1
    return "failed"

def forward_to_queue(payload):
    queue_client.publish("repo-events", payload)

Walk through how you would debug this: what would you look for first, what do you think is actually going wrong, and how would you fix each issue you find. Explain your reasoning rather than just naming the bugs.