Guards! Guards
Summary
An exploration of a surprising behavior in Elixir guards where the `is_map_key/2` guard can cause a guard failure instead of returning false, breaking the commutativity of boolean operators.
View Cached Full Text
Cached at: 06/27/26, 05:55 PM
Similar Articles
The case of the mysterious changes to integers when there shouldn’t have been any code generation effect
A developer discovers that swapping two equivalent macros caused unexpected integer changes in unrelated functions, and the blog post investigates the mystery, questioning an LLM's explanation about control flow guard.
Guarded methods in OCaml
This article explains how to encode guarded methods in OCaml using type equality witnesses, allowing constraints on the receiver only for specific methods rather than the whole class.
My own PreToolUse guardrail blocked my agent from writing a Markdown file. The bug generalizes.
A developer describes a common bug in PreToolUse guardrails for coding agents: the guardrail flattens all tool arguments into a single string and classifies them uniformly, causing false positives when an agent merely mentions a forbidden topic. The fix is to consider both the string and the tool's actual effect.
A single invisible character disabled one of our guardrails for three weeks, and the symptom looked exactly like model flakiness
A developer recounts a three-week production bug where a regex with a literal backspace character silently disabled a language-detection guardrail, making the LLM appear flaky. The post highlights the need to instrument deterministic guardrails to distinguish them from model nondeterminism.
The mental model for LLM guardrails that finally clicked for me.
The post outlines a mental model for implementing LLM guardrails as a distinct layer for inbound and outbound checks, highlighting the need for enforcement beyond system prompts and the trade-off with latency.