Explain the selected code as if to a smart colleague new to the codebase. Include: what it does, why, edge cases, and a 1-paragraph summary.