forked from cleveragents/cleveragents-core
7c4663b8ee
Implement the complete configuration system with multi-level resolution chain, typed key registry, and CLI integration per specification. ConfigService changes: - Expand _build_catalog() to register all 102 spec-aligned config keys across 8 groups: core (14), server (4), actor (5), plan (8), sandbox (5), index (12), context (43), provider (11) - Each key carries exact dotted-dash name, Python type, default value, explicit env var name per spec, project-scopability flag, and description - Fix _env_name() to convert dots and dashes to underscores - Provider keys use standard env var names (e.g., OPENAI_API_KEY) CLI commands rewiring: - Rewrite config set/get/list to use ConfigService instead of Settings - Add --verbose flag to config get showing full 5-level resolution chain - Add --project flag to config set/get/list for project-scoped overrides - Support both glob and regex patterns in config list - Validate keys against ConfigService registry with actionable errors - Retain backward-compatible helper functions delegating to ConfigService Documentation: - Add docs/reference/config_resolution.md covering resolution chain, all 102 config keys, CLI commands, TOML format, and provider credentials Testing: - Update all 4 Behave feature files and step definitions to use new spec-aligned key names, env vars, and defaults (119 scenarios passing) - Add robot/config_resolution.robot with 10 integration test cases - Add benchmarks/config_resolution_bench.py with 8 time + 2 memory suites ISSUES CLOSED: #258
100 lines
3.5 KiB
Gherkin
100 lines
3.5 KiB
Gherkin
Feature: Config CLI commands
|
|
As a developer
|
|
I want to manage configuration via CLI
|
|
So that I can set, get, and list runtime configuration values
|
|
|
|
Background:
|
|
Given a clean config CLI test environment
|
|
|
|
# --- SET ---
|
|
Scenario: Set a configuration value
|
|
When I run config set "core.log.level" "DEBUG"
|
|
Then the config set should succeed
|
|
And the config set output should contain key "core.log.level"
|
|
And the config set output should contain value "DEBUG"
|
|
|
|
Scenario: Set a configuration value with underscore normalization
|
|
When I run config set "core_log_level" "INFO"
|
|
Then the config set should succeed
|
|
And the config set output should contain key "core.log.level"
|
|
|
|
Scenario: Set an unknown key fails
|
|
When I run config set "nonexistent_key" "value"
|
|
Then the config set should fail with unknown key error
|
|
|
|
# --- GET ---
|
|
Scenario: Get a configuration value
|
|
When I run config get "core.log.level" with verbose
|
|
Then the config get should succeed
|
|
And the config get output should contain key "core.log.level"
|
|
And the config get output should show the resolution chain
|
|
|
|
Scenario: Get a value after setting it
|
|
Given I have set config "core.log.level" to "WARNING"
|
|
When I run config get "core.log.level"
|
|
Then the config get should succeed
|
|
|
|
Scenario: Get with underscore alias
|
|
When I run config get "plan_concurrency"
|
|
Then the config get should succeed
|
|
And the config get output should contain key "plan.concurrency"
|
|
|
|
Scenario: Get an unknown key fails
|
|
When I run config get "totally_bogus_key"
|
|
Then the config get should fail with unknown key error
|
|
|
|
# --- LIST ---
|
|
Scenario: List all configuration values
|
|
When I run config list
|
|
Then the config list should succeed
|
|
And the config list output should contain multiple settings
|
|
|
|
Scenario: List with key regex filter
|
|
When I run config list "core\.log.*"
|
|
Then the config list should succeed
|
|
And every listed key should match "core\.log.*"
|
|
|
|
Scenario: List with value regex filter
|
|
When I run config list with --filter-values "FATAL"
|
|
Then the config list should succeed
|
|
|
|
Scenario: List with invalid key regex fails
|
|
When I run config list with invalid regex "[invalid"
|
|
Then the config list should fail with regex error
|
|
|
|
Scenario: List with invalid value regex fails
|
|
When I run config list with invalid value regex "[bad"
|
|
Then the config list should fail with regex error
|
|
|
|
# --- SECRET MASKING ---
|
|
Scenario: Secret values are masked by default
|
|
When I run config list
|
|
Then secret keys should show masked values
|
|
|
|
Scenario: Show-secrets reveals secret values
|
|
When I run config list with --show-secrets
|
|
Then secret keys should show actual values
|
|
|
|
# --- RESOLUTION CHAIN ---
|
|
Scenario: Resolution chain shows default source
|
|
When I run config get key "core.log.level" formatted as "json"
|
|
Then the resolution chain should include "default" source
|
|
|
|
# --- SET/GET ROUNDTRIP ---
|
|
Scenario: Set and get roundtrip
|
|
Given I have set config "core.log.file-enabled" to "true"
|
|
When I run config get key "core.log.file-enabled" formatted as "json"
|
|
Then the config get should succeed
|
|
And the get value source should be "global"
|
|
|
|
# --- FORMAT ---
|
|
Scenario: Config list with JSON format
|
|
When I run config list with format "json"
|
|
Then the config list should succeed
|
|
And the output should be valid JSON
|
|
|
|
Scenario: Config get with JSON format
|
|
When I run config get key "core.format" formatted as "json"
|
|
Then the config get should succeed
|
|
And the output should be valid JSON
|