r/softwaretesting • u/Aggressive-Narwhal-3 • Oct 06 '26
My opt-in feature's "off" test passed while the feature was still registered
I contributed an opt-in feature, off by default, to an open-source coding agent tool.
The maintainer's review came back with four blockers. The one that stung was "OFF must mean nothing is registered."
I had only checked the flag inside the handlers. So with the setting off, my event hooks and my slash command were still registered. They just did nothing when called.
And my own "off" test passed anyway, because it only looked at what the feature did, not at whether it existed.
The other three were smaller. A file it writes could escape the project through a symlink or a "../" argument. A user abort didn't cancel a pending action. And a later successful recovery didn't clear an earlier failure.
All four are fixed now, each with a test that fails on the old code. I'm rerunning the full suite on macOS, Linux and Windows.
What I'm still unsure about is the "off" test itself. How do you check that an opt-in feature is really inert when it's disabled? Do you assert on the registry, diff what's registered with the flag on and off, or something else?
1
u/One-Front-6316 Oct 06 '26
test the registration boundary directly rather than only testing that the handlers do nothing. with the flag off, assert tha the features hooks, commands, listeners, etc. arent registered at all, then have a separate test with it on that verifies they are registered and work. that makes "off means inert" much harder to accidentally violate later
1
u/zaphodikus Oct 06 '26
Why are you looking in the tool configuration data? You would not do that if you were testing an app? You would test the functionality (and security too probably) . Its not functional testing if you peer under the bonnet?
1
u/Suremerr Oct 11 '26
diffing the registry is the cheap check, the actual fix is the gate - registration should be skipped at init when the flag is off, so the test is just proving the gate is wired. the case i'd still probe: if the setting can change at runtime, toggle it on and off in the same session and assert the handlers actually unregister. that's where this class of leak usually hides.
1
u/Chouni-Rhasaan Oct 17 '26
one thing worth considering, is "off" supposed to mean "never registered" or "registered but gated"? sounds like the maintainer wants the former, and if so your test boundary is the registry, not the handler output. those are two very different contracts
1
u/[deleted] Oct 06 '26
[removed] — view removed comment