Skip to content

Debugging drills

Use one unseen drill at a time. Before reading its clues: reproduce, state hypotheses, gather one discriminating observation, identify root cause, fix, and add the narrowest regression test. If the diagnosis is wrong, record the belief that produced it before opening clues and retry a modified scenario later.

1. The disappearing progress

Symptom: status changed on the topic page, but dashboard progress remains zero.

Clues: inspect provider declarations and compare store identities. Expected concept: a component-level provider shadowed the root instance.

2. Search results go backward

Symptom: typing “signals” briefly shows correct results, then results for “sig” replace them.

Clues: throttle network and inspect request order. Expected concept: nested subscriptions allow stale responses; cancellation policy is missing.

3. Rows keep the wrong input

Symptom: after sorting topics, text typed into one row appears beside another topic.

Clues: inspect @for tracking. Expected concept: index identity reuses DOM/component state for a different entity.

4. Form payload loses a field

Symptom: a visible read-only topic id is absent from submission.

Clues: compare disabled controls in value and getRawValue; decide whether hidden domain context should come from the form at all.

5. One error kills search forever

Symptom: after a 500 response, later searches make no requests.

Clues: locate catchError relative to switchMap. Expected concept: the outer event stream completed.

6. Duplicate HTTP requests

Symptom: one page load calls /topics twice.

Clues: count subscriptions to a cold HTTP observable; inspect template and imperative subscriptions. Share deliberately or establish one owner.

7. SSR crashes on startup

Symptom: server render reports localStorage is not defined.

Clues: browser global accessed during service creation. Isolate through a token/platform-aware adapter and define server behavior.

8. Test passes alone, fails in suite

Symptom: order-dependent timer or store state.

Clues: global fake timers, singleton mutation, unresolved HTTP expectations, and missing cleanup. Eliminate shared mutable test state.

Debugging mastery evidence

A strong debugging narration distinguishes observation from hypothesis, avoids random edits, explains why the fix addresses the cause, and names a test or signal that prevents recurrence.