Founder Notes
I Took It Out And Nothing Broke
I had a rule with two conditions in it. One described what a request was allowed to read. The other described what it was allowed to write. At some earlier point I had also written a comment beside the second one explaining why it was load-bearing: without it, I said, the first condition would not constrain writes at all.
I was pulling the rule apart to see which of its pieces anything actually depended on. Take the whole rule away and a good deal complained. Take away a different clause and something complained. Take away the write condition and nothing complained. Not one thing.
My first reading was the obvious one. I have a clause with no effect and a comment that is wrong about it, so both can go.
The clause was idle for a reason that lives somewhere else
A rule of this kind, declared the way I had declared it, covers every operation by default. And for an operation I have not written a specific condition for, the engine falls back to the condition I did write — it reuses the read condition as the write check.
So writes were being constrained. They were not being constrained by my clause. They were being constrained by my clause's twin, which a default had promoted into that position without telling me.
The comment was wrong. The clause was genuinely doing nothing. And I was still wrong to want to delete it.
Redundant is a property of the arrangement, not of the line
This is the part I had to say out loud before I believed it. "This has no effect" is not a fact about the code in front of me. It is a fact about that code together with every default and declaration currently surrounding it. Change the surroundings and the same line acquires an effect.
Here the surroundings are one declaration away from changing. The moment anyone splits the rule into its per-operation form — which is the ordinary thing to do when the read and write cases need to differ, and very nearly the only reason anyone would open this file — the fallback stops applying. The write case then gets whatever condition is written for it. If my clause is gone, nothing is written for it.
That is the uncomfortable shape of the thing. The clause is unnecessary today for precisely the reason that would make it necessary tomorrow. The default that renders it idle is the same default someone is going to remove, and they will remove it in the course of doing something entirely reasonable.
What I did instead
The clause stayed. The comment changed — from a claim about what would happen without it, into a statement of what currently makes it unnecessary and what would make it matter. That is a better comment than the one I had, and a much better one than nothing, because the next person to arrive and delete this clause will be doing it for the same sound reason I nearly did.
Where this generalises
I am not arguing that things with no effect should be kept on the chance they come alive. Most of them should go, and a codebase that keeps everything is worse than one that keeps nothing.
The move I want to hold onto is narrower and more mechanical than that. Before removing something because it has no effect, work out what has to stay true for that to remain so — and then ask whether the thing that has to stay true is itself something a person could change in an afternoon. If what makes it idle is a rule of the language, delete it. If what makes it idle is a default, a setting, or a shape of declaration that someone will plausibly change, then it is not dead. It is dormant. And the change that would wake it is the same change that would hide it.
Anything with no effect is making a promise about its surroundings. Taking it out means accepting that promise on behalf of whoever alters them next.