Refuse config keys that no setting has (closes #419)
check / check (push) Failing after 21m21s
check / check (push) Failing after 21m21s
config.Parse walks the file as written and fails on the first key that
matches no setting, naming its dotted path and line, so a typo in
exclude or prune_grace_period no longer falls back silently. ${...}
references and YAML merge keys still load. config set refuses such a key
before writing. The key-to-field lookup moves from internal/cli to
config.SettingType so both use it.
Model: opus-5-5
This commit is contained in:
1 parent
aae7fa17ae
commit
ba343c30e2
6 files changed
+283
-47
No files matched your search
@@ -237,6 +237,14 @@ func TestConfigSetKeepsFileThatWouldNotLoad(t *testing.T) {
|
||||
value string
|
||||
reason string
|
||||
}{
|
||||
// Keys that no setting has, on a config that loads and on one
|
||||
// that does not.
|
||||
{configWithoutRecipients, "nosuchkey", "1",
|
||||
"no setting has this key: nosuchkey"},
|
||||
{configWithoutRecipients, "snapshots.home.exlude", "/tmp",
|
||||
"no setting has this key: snapshots.home.exlude"},
|
||||
{defaultConfigText(macOS), "compression_lvl", "9",
|
||||
"no setting has this key: compression_lvl"},
|
||||
// Index 1 of the empty list the missing key gives.
|
||||
{configWithoutRecipients, "age_recipients.1", testRecipient,
|
||||
"index out of range"},
|
||||
|
||||
Reference in new issue
Block a user