Add mapbox config list/unset alongside get/set - #39
Closed
mattpodwysocki wants to merge 1 commit into
Closed
mattpodwysocki wants to merge 1 commit into
mattpodwysocki wants to merge 1 commit into
Conversation
get/set answer one key at a time; list answers all of them in one call, each falling back to its default the same way get does — worth having before a second setting makes the gap between "check everything" and "check one key" visible. unset clears a key back to "never set" rather than writing its current default value explicitly. The two read identically through resolve() today, but they are not the same fact on disk: a later default change reaches a cleared key, and does not reach one a caller pinned to the old default on purpose. clear() is unset's counterpart to set()'s Some(enabled), and get/list now share one resolve() so the two cannot answer a key differently. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
zmofei
requested changes
Sep 23, 2026
zmofei
left a comment
Member
There was a problem hiding this comment.
Small, well-tested PR overall — the write/persist logic, schema/completion generalization, and new tests all check out, and I didn't find any correctness bugs.
One thing worth fixing before merge:
resolve(),clear(), andset()each have their ownmatch key { UPDATE_CHECK_KEY => ..., _ => unreachable!(...) }block. Adding a second config key now means updating three separate match sites (plusKEYS), and missing one still compiles — it just panics at runtime instead. A single per-key table (key, getter, setter) would make adding a setting a one-line change and remove that footgun.
Two minor nits, non-blocking:
tests/config.rs's module doc still says it coversget/setonly, but this PR addslist/unsettests to the same file.list()callsresolve()twice per key (once forentries, once fortext); a single pass would avoid the duplicate work as more keys are added.
zmofei
approved these changes
Sep 23, 2026
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.
Summary
Stacked on #35 (
mapbox config get/set) — base branch isfeat/106-persisted-config, so this diff is just the incremental change. Rebase ontomainonce #35 merges.mapbox config list: every setting and its current value in one call, rather than one key at a time.mapbox config unset <key>: clears a key back to "never set" rather than writing its current default value explicitly. The two read identically throughresolve()today, but they're not the same fact on disk — a later default change reaches a cleared key and not one a caller pinned to the old default on purpose.get/listnow share oneresolve()so the two can't answer a key differently;unsetgets aclear()counterpart toset'sSome(enabled).Test plan
cargo build,cargo fmt,cargo clippy --all-targets -- -D warnings,cargo test— all cleansrc/config.rsforresolve/cleartests/config.rs:listreports the one known key at its default and after aset, in both text and JSON;unsetis proven to remove the key from the file rather than just re-writing its default value (checked against the raw file contents, not just the CLI's own read-back)docs/commands.mdand CHANGELOG updated