7c4663b8ee
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 18s
CI / build (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 38s
CI / security (pull_request) Successful in 46s
CI / integration_tests (pull_request) Successful in 2m52s
CI / unit_tests (pull_request) Successful in 12m35s
CI / docker (pull_request) Successful in 38s
CI / benchmark-regression (pull_request) Successful in 20m57s
CI / coverage (pull_request) Successful in 47m23s
CI / lint (push) Successful in 12s
CI / build (push) Successful in 14s
CI / quality (push) Successful in 17s
CI / typecheck (push) Successful in 32s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 40s
CI / integration_tests (push) Successful in 2m52s
CI / benchmark-publish (push) Successful in 12m29s
CI / unit_tests (push) Successful in 12m31s
CI / docker (push) Successful in 38s
CI / coverage (push) Successful in 47m17s
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
113 lines
6.1 KiB
Gherkin
113 lines
6.1 KiB
Gherkin
Feature: Config CLI uncovered branches
|
|
Cover missed lines and branches in config.py:
|
|
_settings_defaults registry path, _validate_key empty,
|
|
_write_config_file existing-file path, _resolve_source env path,
|
|
config_set/get non-rich formats, config_list empty result,
|
|
config_set --project flag, config_get --verbose flag.
|
|
|
|
# -- _settings_defaults returns defaults from registry --
|
|
Scenario: config cli branch settings defaults returns registry defaults
|
|
When I config cli branch call _settings_defaults
|
|
Then the config cli branch defaults should contain registry default values
|
|
|
|
# -- _settings_defaults with a mocked registry entry having None default --
|
|
Scenario: config cli branch settings defaults returns None for None-default entry
|
|
Given a config cli branch mocked registry entry with None default
|
|
When I config cli branch call _settings_defaults
|
|
Then the config cli branch defaults should contain None for the mocked key
|
|
|
|
# -- _validate_key with empty key (L102-103) --
|
|
Scenario: config cli branch validate_key rejects empty key
|
|
When I config cli branch call _validate_key with an empty key
|
|
Then the config cli branch call should raise BadParameter
|
|
|
|
# -- _write_config_file when file already exists --
|
|
Scenario: config cli branch write_config_file merges into existing file
|
|
Given a config cli branch temp config directory
|
|
And a config cli branch existing config file with key "core.log.level" set to "DEBUG"
|
|
When I config cli branch write config with key "plan.concurrency" set to "4"
|
|
Then the config cli branch config file should contain both keys
|
|
|
|
# -- _resolve_source returns "env_var" when env var is set --
|
|
Scenario: config cli branch resolve_source returns env_var when env var is set
|
|
Given a config cli branch temp config directory
|
|
And the config cli branch env var "CLEVERAGENTS_LOG_LEVEL" is set to "WARNING"
|
|
When I config cli branch call _resolve_source for "core.log.level"
|
|
Then the config cli branch source should be "env_var"
|
|
|
|
# -- config_set with non-rich format --
|
|
Scenario: config cli branch config set with json format uses format_output
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config set "core.log.level" "DEBUG" with format "json"
|
|
Then the config cli branch set result should be valid JSON
|
|
And the config cli branch set JSON should contain key "key"
|
|
And the config cli branch set JSON should contain key "value"
|
|
|
|
# -- config_set with --project flag --
|
|
Scenario: config cli branch config set with project flag writes project-scoped value
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config set "core.automation-profile" "manual" with project "local/prod"
|
|
Then the config cli branch set result for project should succeed
|
|
And the config cli branch set result should contain scope "project:local/prod"
|
|
|
|
# -- config_get with --verbose flag --
|
|
Scenario: config cli branch config get with verbose shows resolution chain
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config get "core.log.level" with verbose
|
|
Then the config cli branch get verbose result should succeed
|
|
And the config cli branch get verbose output should contain resolution chain
|
|
|
|
# -- config_get with non-rich format and Path value --
|
|
Scenario: config cli branch config get with json format serialises Path values
|
|
Given a config cli branch temp config directory
|
|
And config cli branch resolve returns a Path value for "core.log.dir"
|
|
When I config cli branch run config get "core.log.dir" with format "json"
|
|
Then the config cli branch get result should be valid JSON
|
|
And the config cli branch get JSON value should be a string not a Path
|
|
|
|
# -- config_set with bool value coercion --
|
|
Scenario: config cli branch config set coerces bool value
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config set "core.log.file-enabled" "false" with format "json"
|
|
Then the config cli branch set result should be valid JSON
|
|
And the config cli branch set JSON value should be bool false
|
|
|
|
# -- config_set with int value coercion --
|
|
Scenario: config cli branch config set coerces int value
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config set "plan.concurrency" "8" with format "json"
|
|
Then the config cli branch set result should be valid JSON
|
|
And the config cli branch set JSON value should be int 8
|
|
|
|
# -- config_set with float value coercion --
|
|
Scenario: config cli branch config set coerces float value
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config set "plan.budget.warn-threshold" "0.5" with format "json"
|
|
Then the config cli branch set result should be valid JSON
|
|
And the config cli branch set JSON value should be float 0.5
|
|
|
|
# -- config_list with filter matching nothing --
|
|
Scenario: config cli branch config list prints message when no matches
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config list with pattern "zzz_nonexistent_pattern_xyz"
|
|
Then the config cli branch list output should say no values match
|
|
|
|
# -- config_list with invalid regex --
|
|
Scenario: config cli branch config list with invalid regex fails
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config list with pattern "[invalid"
|
|
Then the config cli branch list result should fail with regex error
|
|
|
|
# -- config_get with unknown key --
|
|
Scenario: config cli branch config get with unknown key fails
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config get "totally.bogus.key" with format "json"
|
|
Then the config cli branch get result should fail with unknown key error
|
|
|
|
# -- secret masking in list --
|
|
Scenario: config cli branch config list masks secret values
|
|
Given a config cli branch temp config directory
|
|
When I config cli branch run config list with format "json"
|
|
Then the config cli branch list result should be valid JSON
|
|
And the config cli branch list JSON should mask api-key values
|