Repository navigation
fix(config): a false boolean is a value, not a missing key (#159) - #165
Merged
Merged
Conversation
added 2 commits
July 26, 2026 04:04
config() asked jq for `$key // empty`. jq's // treats false exactly like null, so every option explicitly set to false read back as its default — and the two shipped options that default to true, features.ndc_compression and features.recovery, both documented, could never be switched off. The filed issue was the narrower symptom: save-session.sh never consulted the compression flag at all. It does now, but the flag would still have been unreadable without fixing config(), and features.recovery was broken the same way with nobody having noticed. config() asks for the value and treats only null — a genuinely absent key — as missing. Verified false, 0, normal values, absent keys and absent paths all read correctly. Six existing tests failed when the flag started working: the shared harness sets ndc_compression false, so every test that exercises compression was relying on the option not working. The harness now says true, which is the shipped default and what those tests always meant. Co-Authored-By: Max <noreply>
Review found my own fix swallowing a value: `jq -r` prints the bare word null for a JSON null AND for the string "null", so testing the printed result against "null" discarded a legitimate config value. Narrow — reject_pattern is the only plausible place — but it is a value the user set being ignored, which is the same class as the bug being fixed. The null test moves inside jq, where the two are different things, and tostring handles the rest. Verified across false, 0, "", "null", explicit null, absent keys, absent paths and a path traversing a scalar. Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #159.
The filed issue was that
save-session.shnever consultedfeatures.ndc_compression. It does now — but that alone would have fixed nothing, because the flag could not be read.config()could not readfalsejq's
//treatsfalseexactly likenull, so every option explicitly set tofalsecame back as its default. Two shipped, documented options default totrueand were therefore impossible to switch off:features.ndc_compressionandfeatures.recovery. The second has been broken just as long, unreported.config()now maps a genuinely absent key to empty inside jq, and returns everything else.Two near misses, both found by review
Testing the printed value against
"null"looks equivalent and is not:jq -rprints the same bare word for JSONnulland for the string"null", so that version silently discarded a legitimate value.reject_patternis the only plausible place someone would hit it, but a user-set value being ignored is the same class as the bug in hand.Verified across
false,0,"","null", explicitnull, absent keys, absent paths, and a path traversing a scalar (jq errors, stdout empty, falls back).Review also enumerated every
configcall site — 20 of them across the hooks and scripts — checking whether any relied on the old collapsing behaviour. None do. Numeric options were never affected (//interceptsnullandfalse, not0), andgit_backup.gpg_sign/allow_remote_changeworked only by coincidence, their default happening to equal the collapse target.The tell was in the test suite
The shared harness has been setting
ndc_compression: falsefor months, and six compression tests were relying on that option not working. They broke the moment the flag became real. The harness now saystrue, which is the shipped default and what those tests always meant.That is also how the bug surfaced at all: while testing #136 I had to defeat compression by hand, because the documented switch did nothing.
680 passing.