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 2 of 6
Why a default looks like a fix
builds on: Errors swallowed by catch-all handlers
"No crash" is the proxy signal, and a default reaches it in one line. In Rust, and in TypeScript wherever a lookup can return undefined, the compiler also insists that the missing case is handled. A default is the shortest way to satisfy it.
Like a swallowed error, a default hides the failure. It is harder to spot: there is no catch block, just an ordinary-looking expression. The code keeps running with a believable value: `0`, `""`, `[]`. That value flows into totals, databases and decisions.
**Later cost:** wrong data, found weeks later, far from the cause.
Terms on this card
- proxy signal
- A visible stand-in for the real goal (tests green, error gone) that can be satisfied without reaching the goal.
- later cost
- The concrete damage a shortcut does after merge, such as a hidden bug or silently corrupted data.
- swallowed error
- An error that is caught or discarded without being handled, logged or passed on, so the failure disappears.
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