Code RoomTenant context scope collision
HardPrep Room Coding #4410

Tenant context scope collision

Vibe & agenticConcurrencySenior–Staff~20 min

An AI set up this FastAPI dependency for per-request context (the current tenant). Under concurrency, requests intermittently read or write data for the WRONG tenant. Explain the scope bug and how you'd fix it safely.

Implement
resolve_tenant_reads(trace: list[str], use_request_scope: bool) → list[str]
Examples
in[["set:r1:acme","await:r1","set:r2:globex","read:r1","read:r2"],false]out["r1=globex","r2=globex"]
in[["set:r1:acme","await:r1","set:r2:globex","read:r1","read:r2"],true]out["r1=acme","r2=globex"]
in[["set:r1:acme","read:r1"],false]out["r1=acme"]
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 20 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.