refactor(config): delete the two decoded-but-unread policy fields
MemoryConfig.SessionTTL and ToolPolicy.ParallelExecution were decoded by config loading and read nowhere, so setting either silently did nothing. Removing them routes both keys into the unknown-key detector, which names them in a boot warning instead. A live-looking knob wired to nothing is the worse state, and the sibling memory.provider already earned a loud load-time rejection for exactly this. Also drops the config.example.toml line that shipped session_ttl into every first-run config.toml via configtemplate.go, and the commented-out dir_test.go assertions that would have re-created both fields under that file's "make these pass without modifying them" header.
This commit is contained in:
1 parent
588d3a444a
commit
aa62d1aca5
6 files changed
+45
-16
No files matched your search
@@ -118,9 +118,8 @@ Do not expose these helper flags as daemon settings.
|
||||
| `nats.url`, `token_env` | Empty URL keeps SQLite path. Configured token variable must be non-empty. | production-wired |
|
||||
| `containers.*` | See dedicated table below. | production-wired |
|
||||
| `chat.*` | See channel table below. | production-wired |
|
||||
| `memory.provider`, `provider_config`, `session_ttl` | Feature YAML decodes and tests these; `cmd/archied` always starts built-in file provider at `work_dir/memory`. | decoded-but-unwired |
|
||||
| `memory.provider`, `provider_config` | Feature YAML decodes these; `cmd/archied` always starts built-in file provider at `work_dir/memory`. | decoded-but-unwired |
|
||||
| `tools.mcp_servers` | `cmd/archied` registers daemon-side MCP providers. Empty transport becomes `stdio`; only `stdio` accepted. `url` decoded but unused. | partially-wired |
|
||||
| `tools.tool_policy.*` | Feature YAML decodes `max_result_chars` and `parallel_execution`; no production read exists. | decoded-but-unwired |
|
||||
| `indexing.index_dir`, `indexing.db_path` | `finalize` derives paths under `work_dir`; no entrypoint constructs `internal/indexing.Manager`. | decoded-but-unwired |
|
||||
| `extra` / unknown `conf.d` values | Test/library-only `LoadDir` stores untyped data; no core production consumer. | decoded-but-unwired |
|
||||
|
||||
|
||||
@@ -270,7 +270,6 @@ listen = "127.0.0.1:8484"
|
||||
# nothing. Leave it unset.
|
||||
# [memory]
|
||||
# engine = "builtin" # "builtin" is the only engine implemented so far
|
||||
# session_ttl = "0s"
|
||||
|
||||
# Image generation capability (internal/domain/image). No provider is
|
||||
# implemented yet -- this section defines the contract/config surface only
|
||||
|
||||
@@ -152,9 +152,9 @@ existing structure combines different owners.
|
||||
| `Mode`, `Command`, `Env` | `LegacyAgent` | Decode-only compatibility input for the removed executor selector. Delete after the config migration window; it has no runtime settings owner. |
|
||||
| `Type`, `Host`, `Token` / `TokenEnv` (older form) | `Forge` | Forge adapter settings. The older `TokenEnv` input is accepted only at the loader boundary. |
|
||||
| `Trigger`, `AckReaction`, label names | `Dispatch` | Work-intake and forge presentation policy. Label vocabulary is configurable per forge/identity association. |
|
||||
| `Provider`, `ProviderConfig`, `SessionTTL` | `MemoryConfig` | Memory capability settings. Provider-specific data remains owned and validated by that provider. |
|
||||
| `Provider`, `ProviderConfig` | `MemoryConfig` | Memory capability settings. Provider-specific data remains owned and validated by that provider. |
|
||||
| `Name`, `Transport`, `Command`, `Args`, `WorkDir`, `URL` | `MCPServer` | One typed MCP server instance specification. Transport-specific variants must reject fields belonging to other variants. |
|
||||
| `MaxResultChars`, `ParallelExecution` | `ToolPolicy` | Tool-execution policy values, not generic daemon configuration. |
|
||||
| `MaxResultChars` | `ToolPolicy` | Tool-execution policy values, not generic daemon configuration. |
|
||||
| `URL`, `TokenEnv` | `NATSConfig` | NATS transport settings with a secret reference replacing the environment-name field. |
|
||||
| `Image`, `MaxConcurrency`, `MaxUptime`, `VolumeTTL`, `PullPolicy`, `Network` | `ContainerConfig` | Mandatory managed-worker infrastructure settings and resource policy. The legacy `enabled` input is decode-only. |
|
||||
| model mappings, email, webhook, Telegram | `ChatConfig` | Separate channel instance settings plus channel-routing associations; there is no chat-wide settings owner. |
|
||||
|
||||
@@ -328,7 +328,6 @@ type MemoryConfig struct {
|
||||
// mechanism than Engine. See archie-core-1786637499161-356-e424e40d.1.
|
||||
Provider string `toml:"provider" yaml:"provider" json:"provider"`
|
||||
ProviderConfig map[string]string `toml:"provider_config" yaml:"provider_config" json:"provider_config"`
|
||||
SessionTTL Duration `toml:"session_ttl" yaml:"session_ttl" json:"session_ttl"`
|
||||
}
|
||||
|
||||
// MCPServer describes one MCP server connection.
|
||||
@@ -362,8 +361,7 @@ type ToolPolicy struct {
|
||||
// SpillDir is where results too large to inline are written so the model
|
||||
// can be handed a path instead of losing the content. Empty disables
|
||||
// spilling, leaving inline truncation as the only option.
|
||||
SpillDir string `toml:"spill_dir" yaml:"spill_dir" json:"spill_dir"`
|
||||
ParallelExecution bool `toml:"parallel_execution" yaml:"parallel_execution" json:"parallel_execution"`
|
||||
SpillDir string `toml:"spill_dir" yaml:"spill_dir" json:"spill_dir"`
|
||||
}
|
||||
|
||||
// WebFetchConfig controls the web_fetch tool.
|
||||
|
||||
@@ -201,7 +201,6 @@ func tmpConfigDir(t *testing.T) string {
|
||||
// provider_config:
|
||||
// api_url: https://honcho.example.test
|
||||
// api_key_env: HONCHO_KEY
|
||||
// session_ttl: 72h
|
||||
// `)
|
||||
|
||||
// cfg, err := loadDir(dir, "")
|
||||
@@ -215,9 +214,6 @@ func tmpConfigDir(t *testing.T) string {
|
||||
// if cfg.Memory.ProviderConfig["api_url"] != "https://honcho.example.test" {
|
||||
// t.Errorf("Memory api_url = %q", cfg.Memory.ProviderConfig["api_url"])
|
||||
// }
|
||||
// if cfg.Memory.SessionTTL.Std() != 72*time.Hour {
|
||||
// t.Errorf("Memory session_ttl = %v", cfg.Memory.SessionTTL.Std())
|
||||
// }
|
||||
// }
|
||||
|
||||
// ── 6. Tools feature file ─────────────────────────────────────────
|
||||
@@ -236,7 +232,6 @@ func tmpConfigDir(t *testing.T) string {
|
||||
// url: https://search-mcp.example.test
|
||||
// tool_policy:
|
||||
// max_result_chars: 100000
|
||||
// parallel_execution: true
|
||||
// `)
|
||||
|
||||
// cfg, err := loadDir(dir, "")
|
||||
@@ -258,9 +253,6 @@ func tmpConfigDir(t *testing.T) string {
|
||||
// if cfg.Tools.Policy.MaxResultChars != 100000 {
|
||||
// t.Errorf("max_result_chars = %d", cfg.Tools.Policy.MaxResultChars)
|
||||
// }
|
||||
// if !cfg.Tools.Policy.ParallelExecution {
|
||||
// t.Error("parallel_execution should be true")
|
||||
// }
|
||||
// }
|
||||
|
||||
// ── 7. Identities feature file ────────────────────────────────────
|
||||
|
||||
@@ -3,6 +3,7 @@ package configuration
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -125,3 +126,43 @@ func TestDeploymentOverlaysHaveNoUnknownKeys(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestRemovedFieldsSurfaceAsUnknownKeys pins the removal of two fields that
|
||||
// were decoded but read nowhere. Once they are gone the compiler guards
|
||||
// nothing, so the unknown-key detector is the only thing left that can tell an
|
||||
// operator their setting does nothing -- which is the whole reason to remove
|
||||
// them rather than leave a live-looking knob wired to nothing.
|
||||
func TestRemovedFieldsSurfaceAsUnknownKeys(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
block string
|
||||
key string
|
||||
}{
|
||||
{
|
||||
name: "memory session_ttl",
|
||||
block: "[memory]\nsession_ttl = \"72h\"\n",
|
||||
key: "memory.session_ttl",
|
||||
},
|
||||
{
|
||||
name: "tool policy parallel_execution",
|
||||
block: "[tools.tool_policy]\nparallel_execution = true\n",
|
||||
key: "tools.tool_policy.parallel_execution",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "config.toml")
|
||||
if err := os.WriteFile(path, []byte(minimalValidConfigTOML+tt.block), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
doc, err := New(nil).File(path)
|
||||
if err != nil {
|
||||
t.Fatalf("File: %v (a removed key must not fail the load)", err)
|
||||
}
|
||||
if slices.Contains(doc.UnknownKeys, tt.key) {
|
||||
return
|
||||
}
|
||||
t.Errorf("UnknownKeys = %v, want it to contain %q", doc.UnknownKeys, tt.key)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user