feat: DEFAULTS covers every config key the engine reads - #11
Merged
Conversation
The engine reads 40 CONFIG keys but DEFAULTS supplied only the twelve opt-in
extension points, so `CONFIG[key]` raised KeyError for any key a config
omitted. Every config therefore had to list all 28 remaining knobs,
including ~15 pure "off" switches, contradicting the module's own
documented contract ("a variant only lists a key when it overrides one").
DEFAULTS is now the union of two documented tiers:
* CORE_DEFAULTS -- the schema knobs, defaulting to the neutral/disabled
value (no pages, no required fields, every optional check off). These
have no "before": they were always config-declared, so a default can
only ever silence a check, never invent one.
* EXTENSION_DEFAULTS -- the pre-existing twelve, keeping their original
values including the non-off `orphans`, `okf_conformance`,
`types_glossary` and `log_file: "log.md"`, so a wiki that omits one
still behaves as the original wiki did.
Also fixes a latent KeyError: `inbox_warn_count` / `inbox_warn_age_days`
were read by check_inbox but declared by no DEFAULTS entry at all, so a
config setting `inbox_dir` without both thresholds crashed mid-run.
Behavior-neutral: the shipped wiki template and all three extension config
bundles set every core knob explicitly, so no new default can reach them.
Verified by diffing each one's fully-merged effective CONFIG against main
-- identical for all four.
SunsetDrifter
force-pushed
the
feat/defaults-full-coverage
branch
from
August 24, 2026 12:35
f517356 to
b631748
Compare
2 tasks
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.
What
wiki/wikilint/settings.pyDEFAULTSnow supplies every config key the engine reads (40), not just the twelve opt-in extension points, split into two documented tiers.Why
The engine reads 40
CONFIGkeys butDEFAULTSdeclared only twelve, soCONFIG[key]raisedKeyErrorfor any key a config omitted. Every config therefore had to list all 28 remaining knobs — including ~15 pure "off" switches — which contradicts the module's own documented contract: "a variant only lists a key when it overrides one." A new wiki, or a non-wiki markdown tree, could not start from a minimal config.It also fixes a latent
KeyError:inbox_warn_count/inbox_warn_age_daysare read bycheck_inboxbut had noDEFAULTSentry at all, so a config settinginbox_dirwithout both thresholds crashed mid-run. They now default to 10 / 14, matching the template.The two tiers
DEFAULTS = {**CORE_DEFAULTS, **EXTENSION_DEFAULTS}CORE_DEFAULTS(28 new) — the schema knobs (page_dirs,required_fields,staleness,adr_dirs,mermaid_*,coverage,taxonomy_file,inbox_*,raw_dir, ...) default to the neutral/disabled value: no pages, no required fields, every optional check off. These knobs have no "before" — they were always config-declared — so a default here can only ever silence a check, never invent one.EXTENSION_DEFAULTS(the pre-existing twelve) keep their original-wiki values, deliberately including the non-offorphans,okf_conformance,types_glossaryandlog_file: "log.md". A wiki written before an extension existed must keep behaving as it did, so a config that wants one off still lists it as a genuine override.The tiers are two real dicts rather than a comment so the distinction is machine-checkable — a test asserts they partition
DEFAULTS, that every core default is neutral, and that the extension points still carry original-wiki behavior.Why it is behavior-neutral
The shipped
wiki/template and all three extension config bundles intests/extension_configs.py(infra,pinned-repo,sharded-repo) set every core knob explicitly, so no new default can reach them. Verified empirically, not by inspection: each one's fully-merged effectiveCONFIGwas dumped before and after and diffed — identical for all four.wiki/lint.pyis untouched. Its config stays fully explicit as self-documentation; trimming the now-redundant entries would be a separate, cosmetic change.Test plan
python -m unittest discover -s tests— 100 passed (was 91; +9)tests/test_engine_contract.pyderives the engine's key list from its own source (regex overCONFIG[...]/cfg[...]accesses) rather than restating a list that would drift, and pins:DEFAULTSsupplies every key the engine reads, and declares no dead knobCORE_DEFAULTS/EXTENSION_DEFAULTSpartitionDEFAULTSwith no overlapNone/False, or a guarded shape-only value)orphans,okf_conformance,types_glossary,log_file,index_file){"page_dirs": ["notes"]}) configures cleanly and survives a fullgather_reportpass with no errorsinbox_diralone no longerKeyErrors — the specific latent bugtest_variants.pycase: a config may only set keys the engine knows about, so a typo'd key cannot sit in alint.pysilently doing nothingNote on the sibling PR
Opened alongside #12. Both are cut from
mainand are independently mergeable, but they touch adjacent regions ofsettings.pyand the same README bullet, so whichever merges second needs a trivial rebase (no logical conflict).🤖 Generated with Claude Code