Skip to content

fix(config): wire the option that did nothing, document the ones that did - #189

Merged
fdaviddpt merged 2 commits into
mainfrom
max/config-contract-176
Jul 26, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
max/config-contract-176

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #176.

debug did nothing

It was in the README table, shipped in config.example.json, and passed to config() nowhere. The real switch was the REMEMBER_DEBUG env var — which someone configuring the plugin through config.json has no obvious way to set. Same class as #159, where documented booleans could not be switched off.

Wired now, through a shared debug_enabled helper. Precedence: env var, then the config option, then the caller's own default.

That last part is the interesting one. save-session.sh was verbose unless told otherwise; 50-git-backup.sh was quiet unless told otherwise; the README documented only the first, so its "default 1" had always been contradicted by the git-backup hook. Collapsing them into one shared default would have silently changed log volume for every existing install in one direction or the other — so each keeps its own, and setting the option overrides both. Which is what setting it was supposed to do.

Documentation that had drifted the other way

  • thresholds.consolidate_max_bytes — read by run-consolidation.sh, in the example config, absent from the README table. Its default is 600000; a first draft of this PR wrote 200000 from the issue text and was wrong until I read the code.
  • model and reject_pattern — read, shipped, and documented only as env vars, though config.json is the source of truth for both.
  • git_backup.remote / branch / gpg_sign — documented, read, missing from config.example.json.

model and reject_pattern are the new test's finding, not the issue's.

The test

tests/test_config_contract.py compares three sides — the README config table, config.example.json, and the keys the code actually passes to config() — in both directions, and drives the debug switch through bash rather than asserting the key is merely mentioned somewhere.

One thing it taught me while being written: timezone is documented and read but deliberately not shipped in the example config, because a "timezone": "" people copy is the UTC landmine an earlier fix removed — and test_log_sh.py already asserts it stays out. My first version added it back and broke that test. It is now named as a deliberate exception with the reason attached, which is the point of the exercise: encode the intent, don't relitigate it.

Eight of its ten tests go red against pre-fix code. Full suite: 744 passed, 41 skipped.

fdaviddpt pushed a commit that referenced this pull request Jul 26, 2026
Review of #189 caught this: wiring `debug` up turned the long-dead
"debug": false in config.example.json into a live setting. Anyone copying that
file — which is what it is for — would have silently flipped save-session.sh
from verbose to quiet, which is precisely the default change this PR argues
against making.

Removed, and named alongside `timezone` as deliberately documented-but-not-
shipped: for both keys, absence is the meaningful state. A test now asserts it
stays out, so the next person to "complete" the example file has to read why.

Co-Authored-By: Max <noreply>
@fdaviddpt

Copy link
Copy Markdown
Contributor Author

Good catch, and it is the sharper version of the point the PR itself makes.

"debug": false had sat in config.example.json doing nothing for as long as the option was unread. Wiring the option up turned that dead line live — so anyone copying the example file would have had save-session.sh go quiet, which is exactly the silent default change the commit message argues against. Same landmine class the suite already names for timezone, and I walked straight into it while writing the rule that describes it.

Removed the key, added debug to _DELIBERATELY_NOT_SHIPPED with the reason attached, and added a test asserting it stays out — so the next person to "complete" the example file has to read why it is incomplete on purpose.

On the two non-blocking notes: the ~20ms is real but lands in the backgrounded save path rather than the tool-call critical path, as you measured, so I have left it. The fail-through-to-caller-default for garbage values is deliberate — features.* fails closed because a broken feature flag should disable the feature, while a broken verbosity flag should not decide log volume on the user's behalf — but you are right that it reads inconsistently, so the reason is now in the comment.

Full suite 745 passed, 41 skipped.

fdaviddpt pushed a commit that referenced this pull request Jul 26, 2026
Review of #189 caught this: wiring `debug` up turned the long-dead
"debug": false in config.example.json into a live setting. Anyone copying that
file — which is what it is for — would have silently flipped save-session.sh
from verbose to quiet, which is precisely the default change this PR argues
against making.

Removed, and named alongside `timezone` as deliberately documented-but-not-
shipped: for both keys, absence is the meaningful state. A test now asserts it
stays out, so the next person to "complete" the example file has to read why.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt force-pushed the max/config-contract-176 branch from d5394d8 to 583ea21 Compare July 26, 2026 21:54
fdaviddpt pushed a commit that referenced this pull request Jul 26, 2026
Review of #189 caught this: wiring `debug` up turned the long-dead
"debug": false in config.example.json into a live setting. Anyone copying that
file — which is what it is for — would have silently flipped save-session.sh
from verbose to quiet, which is precisely the default change this PR argues
against making.

Removed, and named alongside `timezone` as deliberately documented-but-not-
shipped: for both keys, absence is the meaningful state. A test now asserts it
stays out, so the next person to "complete" the example file has to read why.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt force-pushed the max/config-contract-176 branch from 583ea21 to a501eba Compare July 26, 2026 22:19
vsajan added 2 commits July 27, 2026 00:32
… did

`debug` was documented in the README, shipped in config.example.json, and
passed to config() nowhere — setting it did nothing whatsoever. The real switch
was the REMEMBER_DEBUG env var, which someone configuring the plugin through
config.json has no obvious way to set. Same class as #159, where documented
booleans could not be switched off.

It is wired now, via a shared debug_enabled helper. Precedence: the env var,
then the config option, then the CALLER'S OWN default. That last part is
deliberate — save-session.sh was verbose unless told otherwise and
50-git-backup.sh was quiet unless told otherwise, and the README documented
only the first. One shared default would have silently changed log volume for
every existing install in one direction or the other, so each keeps its own and
the option overrides both, which is what setting it was supposed to do.

Also documented: thresholds.consolidate_max_bytes (read, undocumented — and the
default is 600000, not the 200000 a first draft of this claimed), plus `model`
and `reject_pattern`, which appeared only in the env-var table even though
config.json is the source of truth for both. git_backup.remote / branch /
gpg_sign were documented but missing from config.example.json.

tests/test_config_contract.py compares three sides — README table, example
config, and the keys the code actually reads — in both directions, and drives
the debug switch rather than asserting the key is merely mentioned. `model` and
`reject_pattern` are its finding, not the issue's. `timezone` is named as
deliberately documented-but-not-shipped: a `"timezone": ""` people copy is the
UTC landmine an earlier fix removed, and the suite already asserts it stays out
— which this test tripped over before encoding the reason.

Eight of its ten tests go red against pre-fix code. Full suite 744 passed, 41
skipped.

Co-Authored-By: Max <noreply>
Review of #189 caught this: wiring `debug` up turned the long-dead
"debug": false in config.example.json into a live setting. Anyone copying that
file — which is what it is for — would have silently flipped save-session.sh
from verbose to quiet, which is precisely the default change this PR argues
against making.

Removed, and named alongside `timezone` as deliberately documented-but-not-
shipped: for both keys, absence is the meaningful state. A test now asserts it
stays out, so the next person to "complete" the example file has to read why.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt force-pushed the max/config-contract-176 branch from a501eba to a7a0933 Compare July 26, 2026 22:33
@fdaviddpt
fdaviddpt merged commit 74b19ba into main Jul 26, 2026
12 checks passed
@fdaviddpt
fdaviddpt deleted the max/config-contract-176 branch July 26, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config contract gaps: a dead documented option, an undocumented one, mismatched defaults

2 participants