Deep merge null handling
An AI assistant wrote this TypeScript to deep-merge a partial user override onto defaults for a settings page:
The basic case works. Which inputs break it, and why is this subtly worse than a shallow merge?
Implement
apply_settings_override(base_pairs: list[str], override_pairs: list[str]) → list[str]Examples
in
[["theme=dark","avatar=cat.png","tags=x|y"],["avatar=null"]]out["tags=x|y","theme=dark"]in
[["tags=x|y","theme=dark"],["tags=a"]]out["tags=a","theme=dark"]in
[["profile.name=ada"],["profile.bio=hi"]]out["profile.bio=hi","profile.name=ada"]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 14 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.
Run or narrate your approach, then ask the coach.