Files
cleveragents-core/features/actor_config_new_coverage.feature
brent.edwards e801eb1ee8 feat(ci): add nox-based PR validation workflow
- Rewrite .forgejo/workflows/ci.yml to route all jobs through nox sessions
- Fix coverage_report nox session: serial behave mode replaces broken parallel
  mode (22% -> 97% accuracy), raise fail-under from 85% to 97%
- Pass posargs through format nox session for CI --check support
- Add 11 CI workflow validation scenarios (Behave) + Robot smoke test + ASV bench
- Add 108 new Behave scenarios covering 6 largest coverage gaps to reach 97%:
  yaml_template_engine, actor/config, actor/registry, message_router,
  context_analysis, context_service
- Update docs/development/ci-cd.md with nox-based CI docs and 97% threshold
- Restore implementation_plan.md verbose style, check off completed CI tasks

Verified: 1673 scenarios pass, 97% coverage, lint clean, typecheck clean
2026-02-12 22:01:51 +00:00

126 lines
5.4 KiB
Gherkin

Feature: Actor configuration new coverage
As a developer
I want ActorConfiguration thoroughly tested
So that file loading, env interpolation, and v2 parsing stay stable
Scenario: load_blob_from_file loads JSON config
Given a temporary JSON config file with provider and model
When I load the blob from the JSON file
Then the blob should contain provider and model keys
Scenario: load_blob_from_file raises for missing file
When I load the blob from a nonexistent path
Then an actor config ValueError should mention "not found"
Scenario: load_blob_from_file raises for non-dict JSON
Given a temporary JSON config file with a list
When I load the blob from the list JSON file
Then an actor config ValueError should mention "object"
Scenario: load_blob_from_file returns empty dict for null JSON
Given a temporary JSON config file with null content
When I load the blob from the null JSON file
Then the blob should be an empty dict
Scenario: load_blob_from_file falls back to YAML for invalid JSON
Given a temporary YAML-only config file with provider and model
When I load the blob from the YAML file
Then the blob should contain provider and model keys
Scenario: _load_v2_yaml_content parses plain YAML
When I load v2 YAML content without templates
Then the v2 result should be a dict with expected keys
Scenario: _load_v2_yaml_content handles empty YAML
When I load v2 YAML content that is empty
Then the v2 result should be an empty dict
Scenario: _load_v2_yaml_content rejects non-dict YAML
When I load v2 YAML content that is a list
Then an actor config ValueError should mention "object"
Scenario: _load_v2_yaml_content processes templated YAML
When I load v2 YAML content with Jinja2 templates
Then the actor config result should be a dict
Scenario: _restore_template_syntax restores markers in system_prompt
When I restore template syntax in a config with protected markers
Then the system_prompt should have Jinja2 syntax restored
Scenario: _restore_template_syntax recurses into lists
When I restore template syntax in a list config
Then nested list items should have markers restored
Scenario: _interpolate_env_vars substitutes environment variables
Given environment variable "TEST_ACTOR_VAR" is set to "openai"
When I interpolate env vars in config with "${TEST_ACTOR_VAR}"
Then the interpolated value should be "openai"
Scenario: _interpolate_env_vars uses default when env var missing
When I interpolate env vars with "${MISSING_VAR:fallback}"
Then the interpolated value should be "fallback"
Scenario: _interpolate_env_vars raises when env var missing without default
When I interpolate env vars with "${TOTALLY_MISSING_VAR}" and no default
Then an actor config ValueError should mention "not set"
Scenario: _interpolate_env_vars converts boolean strings
When I interpolate env vars for string "true"
Then the interpolated result should be boolean True
Scenario: _interpolate_env_vars converts integer strings
When I interpolate env vars for string "42"
Then the interpolated result should be integer 42
Scenario: _interpolate_env_vars converts float strings
When I interpolate env vars for string "3.14"
Then the interpolated result should be float 3.14
Scenario: _interpolate_env_vars handles boolean defaults
When I interpolate env vars with "${MISSING_BOOL:true}"
Then the interpolated result should be string "True"
Scenario: _interpolate_env_vars handles integer defaults
When I interpolate env vars with "${MISSING_INT:99}"
Then the interpolated result should be string "99"
Scenario: _interpolate_env_vars recurses into dicts and lists
When I interpolate env vars in a nested structure
Then all nested string values should be interpolated
Scenario: from_blob extracts provider and model
When I create an ActorConfiguration from a blob with provider and model
Then the config provider should be set
And the config model should be set
Scenario: from_blob raises when provider missing
When I create an ActorConfiguration from a blob without provider
Then an actor config ValueError should mention "provider"
Scenario: from_blob raises when model missing
When I create an ActorConfiguration from a blob without model
Then an actor config ValueError should mention "model"
Scenario: from_blob merges option overrides
When I create an ActorConfiguration from a blob with option overrides
Then the config options should include the overrides
Scenario: _extract_v2_actor parses v2 agents block
When I extract v2 actor from a v2-style config with agents block
Then the extracted provider and model should be set
And the graph descriptor should contain agent info
Scenario: _extract_v2_actor returns None for missing agents
When I extract v2 actor from a config without agents block
Then all extracted values should be None
Scenario: _extract_v2_options extracts options from v2 config
When I extract v2 options from a v2-style config
Then the extracted options should contain expected keys
Scenario: from_file loads and parses config from disk
Given a temporary JSON config file with provider and model
When I create an ActorConfiguration from the file
Then the config provider should be set
And the config model should be set