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.
Refactors that quietly change behavior card 6 of 6

Pure means every caller sees the same thing

builds on: What the agent cannot see
A refactor is pure only if callers see the same side effects in the same order, the same errors, the same calls skipped, the same result order, and the same null and empty handling. If a hunk touches any of these, find out who depends on it before you believe "no behaviour change".
Terms on this card
refactor
A change to how code is written that is meant to leave its observable behaviour exactly the same.
hunk
One contiguous block of changed lines in a diff, with its surrounding context lines.
caller
Any code that calls the function being changed. It may live in files the agent never opened.
side effects
Anything a call does besides returning a value, such as writing a file, changing shared state or sending a request.
Learn this step by step on Bytewise
Lesson goal: Spot 'pure cleanup' that changes behaviour: reordered side effects, a different error type, lost short-circuit evaluation, changed iteration order or null handling. Explain why callers who depend on that old behaviour break. · the whole lesson