Honor spec-style daemon and cache config keys#35
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff13365bcf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if d, err := time.ParseDuration(value); err == nil { | ||
| c.DaemonIdleUnloadAfter = d |
There was a problem hiding this comment.
Reject invalid daemon idle_unload_after values
i config set daemon.idle_unload_after <value> now treats this key as known, but an invalid duration is silently ignored because parse errors are dropped. In that case the command still exits successfully, and config.Write persists the previous value for this known field, so users think the setting was applied when it was not. This is a behavior regression for the newly supported key and should return a validation error (or otherwise surface failure) when time.ParseDuration fails.
Useful? React with 👍 / 👎.
Non-technical summary
intentnow honors the daemon/cache config keys exactly where the spec says they live, so users can editconfig.tomlwith sectioned TOML keys and have those settings actually take effect. This matters now because the previous behavior silently ignored spec-shaped keys like[daemon] enabled = false, which turns a valid-looking config edit into a no-op.Technical summary
internal/configto parse both legacy flat aliases (daemon_enabled,cache_enabled) and spec-style sectioned keys (daemon.enabled,cache.enabledplusdaemon.idle_unload_after)i config get/setknown-key handling sodaemon.enabled,daemon.idle_unload_after, andcache.enabledround-trip through the CLI instead of only through raw file editsconfig set/get daemon.enabledpersists the spec-style key end to endgo test ./internal/config/... ./internal/cli/...,go test ./...,go vet ./...,make buildAdditional notes
Trade-off: generated config now uses dotted TOML keys (
daemon.enabled = false) rather than the older underscore aliases, which is semantically equivalent to the sectioned TOML shown in the spec and keeps the file machine-editable without widening this change into a broader config-format rewrite.Deferred: I did not normalize every raw dotted key into explicit TOML table blocks; the only goal here was to close the spec/implementation gap for the known daemon/cache settings without risking unrelated config churn.