Code RoomUnwrap panic in config loader
HardPrep Room Coding #4334

Unwrap panic in config loader

Vibe & agenticAlgorithms & data structuresSenior–Staff~19 min

You ask an AI to explain this Rust config loader before wiring it into a long-running server. The agent says: "It gracefully loads config and returns a Result, so any parse error or missing file propagates to the caller for handling — no way it can crash the process." Is that explanation accurate, and how do you verify the no-crash claim before depending on it in a service that must stay up?

Implement
find_panic_sites(body_lines: list[str]) → list[str]
Examples
in[["fn load_config(path: &str) -> Result<Config, ConfigError> {"," let text = std::fs::read_to_string(path).unwrap();"," let cfg: Config = serde_json::from_str(&text).expect(\"valid config\");"," Ok(cfg)","}"]]out["2:unwrap","3:expect"]
in[["fn load_config(path: &str) -> Result<Config, ConfigError> {"," let text = std::fs::read_to_string(path)?;"," let cfg: Config = serde_json::from_str(&text)?;"," Ok(cfg)","}"]]out[]
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 19 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.