Files
cleveragents-core/features/yaml_template_engine_coverage_boost.feature
freemo a808c395f9
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m46s
CI / integration_tests (pull_request) Successful in 3m16s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m6s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 18s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m52s
CI / integration_tests (push) Successful in 3m8s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 5m53s
CI / benchmark-publish (push) Successful in 16m55s
CI / benchmark-regression (pull_request) Successful in 33m0s
test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

65 lines
3.3 KiB
Gherkin

Feature: YAML Template Engine coverage boost for uncovered lines
Targets uncovered lines 101-105, 134-136, 138-142, 172, 236-237
Background:
Given a fresh YAML template engine instance
# ── Lines 101-105: fallback path returns a valid dict after _fix_common_yaml_issues ──
Scenario: Fallback fix path returns a dict after first parse raises YAMLError
Given a YAML template with Jinja2 that renders valid content
And a context that produces parseable YAML on fix retry
When I render and parse with a forced first-parse YAMLError returning a dict
Then the fallback parse should return a dict result
# ── Lines 101-104: fallback path raises ValueError when fixed YAML is not a dict ──
Scenario: Fallback fix path raises ValueError when repaired YAML is not a dict
Given a YAML template with Jinja2 that renders valid content
And a context that produces parseable YAML on fix retry
When I render and parse with a forced first-parse YAMLError returning a list
Then a ValueError should be raised from the fallback path
# ── Lines 134-136: _postprocess_rendered_yaml reaches value_words split branch ──
Scenario: Postprocess reaches value_words splitting logic for single-colon line with spaced value
Given rendered YAML with a single-colon line whose value has multiple words
When I postprocess the YAML content
Then the value_words branch should be entered and evaluated
# ── Lines 138-142: dead code in postprocess (guard conflict prevents entry) ──
# These lines are structurally unreachable due to conflicting guards on lines 128+133 vs 135-136.
# We exercise the closest reachable branch and document the dead code.
Scenario: Postprocess value_words inner condition evaluates False for no-colon values
Given rendered YAML content " key: alpha beta gamma" with spaces in value
When I postprocess the YAML content
Then the line should pass through unchanged because value words lack colons
# ── Line 172: _fix_common_yaml_issues appends line with single or zero colons ──
Scenario: Fix common YAML issues preserves a line with exactly one colon
Given YAML content with a single-colon line "simple: value"
When I apply fix common YAML issues
Then the single-colon line should be preserved verbatim
Scenario: Fix common YAML issues preserves a line with zero colons
Given YAML content with a zero-colon line "no colons here"
When I apply fix common YAML issues
Then the zero-colon line should be preserved verbatim
# ── Lines 236-237: _sum_filter raises ValueError for non-summable input ──
# (pragma: no cover marked, but we exercise it anyway)
Scenario: Sum filter raises ValueError for non-summable sequences
Given a sequence of non-summable items
When I call the sum filter on the non-summable sequence
Then a ValueError should be raised with a descriptive message
# ── Integration: end-to-end render that exercises fallback fix returning a dict ──
Scenario: End-to-end render with mocked first-parse failure and successful fix
Given a template "result: {{ val }}" with context val set to "ok"
When rendering triggers a YAMLError on first parse but fix produces a dict
Then the final result should be the fixed dict