Code Room
Vibe codingHardvc-g029
Subject Ai code reviewLevel Senior–Staff~19 minCommon in Algorithms & data structures interviewsIndustries IT services, Software development

Question

An AI agent wrote this Java method to load app config from a YAML file whose path can be set via an environment variable that operators control, using SnakeYAML. It parses the team's config fine in staging. Review it for production hardening.

java
import org.yaml.snakeyaml.Yaml;import java.io.FileReader; static Config loadConfig(String path) throws Exception {    Yaml yaml = new Yaml();    Config cfg = yaml.load(new FileReader(path));    return cfg;}
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.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.