← All notes
building · 1 min read

Refuse rather than degrade

When the strong mechanism is unavailable, refuse. Do not quietly install the weak one.

Native locking can fail to load: an unsupported platform, a stripped install, a libc that does not match. The obvious kindness is a fallback — PID files, say, which is what the code used before.

That kindness is a lie. A PID-based lock is not a slower lock or a smaller lock. It is the absence of a lock with a familiar name, and code that falls back to it keeps running while the guarantee everything above it assumed has quietly gone.

So mutations refuse, with a message naming the platform and what to do. Reads keep working, because reading never needed the guarantee — and the module is loaded lazily precisely so that inspection commands do not have to touch native code at all.

The split is worth stealing: identify which operations actually depend on the strong mechanism, let the others through, and refuse the rest rather than serving them a weaker promise under the same name.