Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Silent fallbacks that hide bugs
card 3 of 6
The tells and three deciding questions
builds on: Errors swallowed by catch-all handlers
**Tells:** `.get(k, 0)`, `?? ""`, `|| 0`, `getOrDefault`, `unwrap_or_default()`, `unwrap_or(0)`, a Go map read without `, ok`, and `return []` or `return nil, nil` after a parse error.
For each one, ask:
1. Is *missing* a normal, expected state here?
2. Is the default the true answer for that state, or a disguise?
3. Does the value reach money, storage or deletions?
If it is a disguise, fail or propagate the error, naming what was missing.
Terms on this card
- unwrap_or_default()
- Rust method on Option/Result: returns the value, or the type's default (0, "", empty Vec) if it is None or an error.
- unwrap_or(0)
- Rust method returning the contained value, or the given fallback (here 0) when it is None or an error.
- ??
- JavaScript/TypeScript nullish coalescing: uses the right-hand value only when the left is null or undefined.
- || 0
- JavaScript/TypeScript: uses 0 when the left side is any falsy value (0, "", NaN, false, null, undefined), which is broader than ??.
- getOrDefault
- Java Map method returning the given default when the map has no entry for the key.
Lesson goal: Recognise defaults that turn a loud failure into quietly wrong data: `unwrap_or_default()`, `?? ""`, `getOrDefault`, `dict.get(k, 0)`, returning [] on a parse error. Decide when a default is genuinely correct and when the code should fail or propagate the error instead. ·
the whole lesson