Repository navigation
Reject config knobs whose TOML type differs from the knob's declared type - #110
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
…type Config.load stored any value under a known knob. A quoted "false" for manage.auto_dream stayed a truthy string and left automatic dreaming enabled; a quoted number for a threshold failed later at the first comparison. Only the two index.vector knobs were type-checked.
rudycelekli
force-pushed
the
fix/config-knob-types-20261016
branch
from
October 21, 2026 21:04
82d578c to
be55bee
Compare
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.
Config.loadstores whatever TOML value sits under a known knob; onlyindex.vector_enabledandindex.vector_modelare type-checked afterwards. A mistyped value is therefore accepted silently and misbehaves later:loads on upstream
mainas'false','3',2.5(bool(c.manage.auto_dream)isTrue), so a user who tries to turn automatic dreaming off keeps it on, and the quoted threshold or fractional limit only fails at the first comparison or slice.Evidence: the new parametrised test
test_a_knob_of_the_wrong_type_is_rejected_rather_than_storedfails 6/6 on upstreammain(DID NOT RAISE ValueError) and passes with this change.Change:
_load_sectionrejects a value whose type differs from the knob's declared one (boolonly for bool knobs, no bool for numeric knobs, a whole number is still accepted for a decimal knob and stored unchanged so existing recall fingerprints do not move,strfor string knobs). The message names the knob (config knob has the wrong type: manage.auto_dream), generalising the existing vector knob checks. Existing configs that match the declared types are unaffected.Validation:
uv run pytest -q tests/unit tests/redteam tests/system-> 883 passed, 4 skipped;ruff check packages testsclean. Not run: mypy, live-host tests; I did not audit third-party stores written by older versions for mistyped knobs, which would now fail to load with the error above instead of being silently misread.