Implements the broad, read-only schema-backed scan for dot kde diff: walks every (rcfile, group, key) reachable through the kcfg mapping table, compares live values against their schema-declared defaults, and reports each mismatch tagged declared or undeclared. Never writes. Also fixes dot kde completions, which only ever offered save/help — apply (added in a prior task) and diff were both missing.
3.4 KiB
3.4 KiB
spec, blocked-by
| spec | blocked-by |
|---|---|
| dot-kde | 0001-kde-schema-backed-save |
What to build
Implement dot kde diff's broad, read-only scan for schema-backed
settings: walk every (rcfile, group, key) reachable through the
mapping table built in the prior task, compare each live value
(kreadconfig6) against its schema-declared default, and report every
mismatch. Each reported mismatch is tagged as declared (its identifier is
present in the manifest — an intentional, already-tracked deviation) or
undeclared (never explicitly declared). diff never writes anything.
Add dot kde diff help, following the project's
check-for-help-before-argparse convention.
Add a README row for dot kde diff.
Acceptance criteria
dot kde diffreports every schema-backed setting whose live value differs from its schema-declared default- Each reported mismatch is tagged declared or undeclared based on manifest presence
dot kde diffmakes no writes under any circumstancesdot kde diff helpprints usage without scanning- Tests run against a scratch
$HOMEand fixture.kcfgschema directory, covering: a declared mismatch, an undeclared mismatch, and a setting matching its default (not reported) - README has a row for
dot kde diff
Implementation Notes
cmd_diff(incommands/kde/kde.py) reusesbuild_kcfg_map/iter_schema_identifiers(already built forkde.py complete) to walk every schema-backed(rcfile, group, key), thenfind_schema_default/read_live_value(already built forsave) to compare live vs. default. No new scanning machinery was needed — this task's whole job was wiring existing pieces together into a read-only report.- Output format: one line per mismatch,
<declared|undeclared> <identifier> = <live> (default: <default>). Not specified by the task, so chosen to read clearly and stay unambiguous under substring matching in tests (avoided bracketed tags like[declared], since fish'sstring matchglob treats[...]as a character class). /review-uncommitted's Spec pass caught thatcmd_diffhad no error handling aroundread_live_value, unlikecmd_apply/cmd_save'stry/except (ValueError, RuntimeError)— a singlekreadconfig6failure would have aborted the entire broad scan with an uncaught traceback, contradictingdiff's "report every mismatch" framing. Fixed:cmd_diffnow catchesRuntimeErrorper-identifier, prints a warning to stderr, and continues scanning the rest.- The Standards pass flagged the "build map → iterate
sorted(set(iter_schema_identifiers(...)))" shape as now duplicated betweencmd_diffandcmd_complete, and the new test scenarios' fixture boilerplate as repeating theapplytests' shape almost verbatim. Left both as-is: the loop duplication is two call sites doing genuinely different things with the result, and the test boilerplate matches this file's already-established per-scenario convention (each scenario resets$HOMEindependently) rather than introducing a new pattern. - Post-closeout fix (user-reported):
~/.config/fish/completions/dot.fish'sdot kdecompletion block only ever listedsave/helpas verbs —applywas never added when task 0002 built it, and this task initially repeated the same omission fordiff. Fixed both by addingapplyanddiffto the top-level verb-offering line and to the post-subcommandhelpgating; verified manually viacomplete -C"dot kde "andcomplete -C"dot kde apply "/complete -C"dot kde diff ".