Files
cleveragents-core/features/yaml_engine_direct_coverage.feature
T
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

103 lines
4.8 KiB
Gherkin

Feature: YAML engine direct coverage
As a developer
I want YAMLTemplateEngine directly exercised
So that all code paths are covered
Scenario: Engine construction registers filters and globals
When I construct a new YAMLTemplateEngine for direct testing
Then the direct engine should have yaml indent sum selectattr filters
And the direct engine globals should include builtins
Scenario: load_file reads and parses YAML from a temp file
Given I construct a new YAMLTemplateEngine for direct testing
And I write a temp YAML file with mapping content
When I call load_file on the direct engine without context
Then the direct load_file result should be a dict with app key
Scenario: load_string parses plain YAML mapping
Given I construct a new YAMLTemplateEngine for direct testing
When I call load_string with plain mapping YAML on direct engine
Then the direct result should have key server
Scenario: load_string raises for plain YAML list
Given I construct a new YAMLTemplateEngine for direct testing
When I call load_string with plain list YAML on direct engine
Then a direct ValueError mentioning dict should be raised
Scenario: load_string with context renders and parses template
Given I construct a new YAMLTemplateEngine for direct testing
When I call load_string with template and context on direct engine
Then the direct rendered result should have substituted values
Scenario: load_string without context defers rendering
Given I construct a new YAMLTemplateEngine for direct testing
When I call load_string with template but no context on direct engine
Then the direct deferred result should be a dict or raise YAMLError
Scenario: preprocess inserts indent hints for for loops
Given I construct a new YAMLTemplateEngine for direct testing
When I call preprocess on content with a for loop
Then the direct preprocessed result should contain indent hint
Scenario: postprocess removes blank lines before unindented content
Given I construct a new YAMLTemplateEngine for direct testing
When I call postprocess on content with blank lines before unindented
Then blank lines before unindented content should be gone
Scenario: fix_common_yaml_issues splits multi-colon lines
Given I construct a new YAMLTemplateEngine for direct testing
When I call fix_common_yaml_issues on multi-colon content
Then the fixed content should have multiple lines
Scenario: analyze_yaml_structure finds blocks and inline templates
Given I construct a new YAMLTemplateEngine for direct testing
When I call analyze_yaml_structure on mixed content
Then template_blocks and inline_templates should be populated
And hierarchy should have root key
Scenario: yaml_filter converts dict to YAML string
When I call the static yaml_filter with a dict
Then the yaml_filter result should contain key colon
Scenario: indent_filter indents lines
When I call the static indent_filter with 4 spaces
Then each direct line should start with 4 spaces
Scenario: sum_filter returns numeric sum
When I call the static sum_filter on a number list
Then the direct sum should be 10
Scenario: selectattr_filter extracts with defaults
When I call the static selectattr_filter for score
Then items with score return their value and others return 0
Scenario: create_render_context merges nested and top-level
When I call the static create_render_context with nested data
Then the direct context should have both nested and explicit keys
Scenario: render_and_parse falls back on initial YAML error
Given I construct a new YAMLTemplateEngine for direct testing
When I call render_and_parse with colon-heavy value
Then the direct engine should attempt fix or raise
Scenario: render_and_parse raises ValueError for non-dict result
Given I construct a new YAMLTemplateEngine for direct testing
When I call render_and_parse that produces a list
Then a direct ValueError mentioning dict should be raised
Scenario: simple_template_extraction raises YAMLError for invalid
Given I construct a new YAMLTemplateEngine for direct testing
When I call simple_template_extraction with invalid YAML
Then a direct YAML error should be raised
Scenario: simple_template_extraction raises ValueError for non-dict
Given I construct a new YAMLTemplateEngine for direct testing
When I call simple_template_extraction with list YAML
Then a direct ValueError mentioning dict should be raised
Scenario: load_file with context renders templates from disk
Given I construct a new YAMLTemplateEngine for direct testing
And I write a temp YAML file with template content
When I call load_file with template context on direct engine
Then the direct file result should contain rendered values