forked from cleveragents/cleveragents-core
7b3fcaf466
Implement three-scope configuration resolution (local > project > global) with deep merge. Add ConfigScope enum, project-root discovery, and config.local.toml file support. Changes: - Add LOCAL to ConfigLevel enum and new ConfigScope enum (GLOBAL, PROJECT, LOCAL) - Implement discover_project_root() walking up from CWD for cleveragents.toml/.cleveragents - Implement config.local.toml file loading in ConfigService - Implement three-scope deep merge via _deep_merge() helper - Add read_project_config(), read_local_config(), read_merged_config() methods - Add write_scoped_config() for writing to any scope file - Update set_value() to accept optional scope parameter - Update resolve() with six-level precedence chain (CLI > env > local > project > global > default) - Update CLI config set with --scope flag (global/project/local) - Add config.local.toml to .gitignore and DEFAULT_IGNORE_PATTERNS - Add Behave BDD scenarios for three-scope resolution, deep merge, and project-root discovery ISSUES CLOSED: #937
90 lines
4.2 KiB
Plaintext
90 lines
4.2 KiB
Plaintext
*** Settings ***
|
|
Documentation End-to-end tests for Config Service with multi-level resolution
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER} ${CURDIR}/helper_config_resolution.py
|
|
|
|
*** Test Cases ***
|
|
Config Service Registers All Spec Keys
|
|
[Documentation] Verify that the registry contains exactly 105 keys (102 spec + 1 skills + 2 server stubs)
|
|
${result}= Run Process ${PYTHON} ${HELPER} registry-key-count cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-registry-key-count-ok
|
|
|
|
Config Resolution Returns Default
|
|
[Documentation] Verify that resolving a key with no overrides returns the default
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-default cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-default-ok
|
|
|
|
Config Resolution With Global Config
|
|
[Documentation] Verify that a value written to the TOML file overrides the default
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-global cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-global-ok
|
|
|
|
Config Resolution With Env Var
|
|
[Documentation] Verify that an env var overrides the global config value
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-env cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-env-ok
|
|
|
|
Config Resolution With CLI Override
|
|
[Documentation] Verify that cli_value has the highest priority in the chain
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-cli cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-cli-ok
|
|
|
|
Config Resolution Project Scope
|
|
[Documentation] Verify that project-scoped config is resolved via project_name
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-project cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-project-ok
|
|
|
|
Config Resolution Verbose Chain
|
|
[Documentation] Verify that verbose=True returns all 6 chain entries
|
|
${result}= Run Process ${PYTHON} ${HELPER} resolve-verbose-chain cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-resolution-verbose-chain-ok
|
|
|
|
Config Env Var For Provider Keys
|
|
[Documentation] Verify provider.openai.api-key maps to OPENAI_API_KEY
|
|
${result}= Run Process ${PYTHON} ${HELPER} env-var-provider cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-env-var-provider-ok
|
|
|
|
Config Validate Type Coercion
|
|
[Documentation] Verify str to int, float, and bool coercion via validate_type
|
|
${result}= Run Process ${PYTHON} ${HELPER} type-coercion cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-type-coercion-ok
|
|
|
|
Config List Command Integration
|
|
[Documentation] Verify that ``agents config list`` outputs all registered keys
|
|
${result}= Run Process ${PYTHON} ${HELPER} cli-list-integration cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} config-cli-list-integration-ok
|