What do you do when you spot bad code outside your task?
What is being assessed
The balance between caring about quality and respecting task boundaries and other people's code. Red flags: "I silently rewrite it" (bloated PRs, conflicts, resentment) and "not my business" (indifference to the codebase).
Answer skeleton
- Judge the scale and risk: is it a bug that can blow up in production, or just ugly code?
- Small and safe (a typo, a force unwrap in your own file, an obvious leak) — fix in passing in a separate commit so the reviewer can see it.
- Large — leave it out of the current PR: file a tech-debt ticket describing the consequences, discuss it with the author or module owner.
- Critical (a race, a data leak, a crash) — tell the team right away, don't wait for a ticket.
- Tone: discuss the code, not the person; ask "why is it like this" — there is often a reason.
Example answer
S: While building a feature on the profile screen I noticed, in the neighbouring notifications module, a DispatchQueue.main.sync inside a handler that was sometimes invoked from the main thread.
T: A potential deadlock, but not my module and outside my task.
A: I didn't fix it in my PR. I messaged the author with a minimal reproduction — it turned out they didn't know the handler could arrive on main. I filed a ticket tagged "hang risk" with the stack trace attached. The author fixed it the same day with a MainActor.assumeIsolated check and Task { @MainActor in }.
R: My PR stayed within scope, the bug was fixed before it reached production, and the team agreed to enable -warn-concurrency so the compiler would catch similar cases.