Code RoomUndocumented invariants and AI risk
HardPrep Room Coding #4319

Undocumented invariants and AI risk

Vibe & agenticAlgorithms & data structuresSenior–Staff~17 min

A staff engineer is making a 12-line change to a hot path in a C++ rendering loop. The change depends on undocumented invariants (a buffer is always pre-zeroed by an upstream stage, a lock is already held by the caller) that live only in the team's heads. A teammate suggests describing it all to an agent. Estimate the real cost of going AI here versus hand-writing, and make the call.

Implement
decide_authoring_mode(change_lines: int, minutes_per_line: int, unstated_invariants: list[str], minutes_per_invariant: int, review_minutes: int) → str
Examples
in[12,3,["buffer pre zeroed upstream","lock held by caller","per frame perf budget","no aliasing between src and dst"],10,20]out"write_by_hand"
in[400,3,["public api contract"],10,20]out"delegate"
in[12,3,[],10,0]out"delegate"
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 17 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.