diff --git a/CHANGELOG.md b/CHANGELOG.md index a0734842d..4cf42dd2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Unreleased +- Restored deleted E2E test files (`features/cli_main_cov3.feature`, `robot/plan_diff_artifacts.robot`) removed by commit 8ea00f51 which covered CLI main line coverage and plan diff/artifacts workflows. Step definitions and helper utilities were already present in the codebase. Resolves AUTO-WDOG announcement #8490 and blocks milestone acceptance criteria validation for v3.2.0. - Hardened the TDD bug-fix quality gate for issue #629: PR parsing now requires whole-word closing keywords (avoids false positives like "prefixes #12"), TDD bug tag discovery now uses exact token matching diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index dbef154a9..bfa87fb47 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -5,6 +5,7 @@ * HAL 9000 * Hamza Khyari * Jeffrey Phillips Freeman +* Jeffrey Phillips Freeman * Luis Mendes * Rui Hu diff --git a/features/cli_main_cov3.feature b/features/cli_main_cov3.feature new file mode 100644 index 000000000..930a48a75 --- /dev/null +++ b/features/cli_main_cov3.feature @@ -0,0 +1,65 @@ +Feature: CLI main.py coverage round 3 + As a developer + I want to cover remaining uncovered lines in cleveragents.cli.main + So that code coverage gaps on lines 104-110, 582-590, and 593-594 are closed + + # ------------------------------------------------------------------- + # Lines 104-110: _register_subcommands exception handler + # ------------------------------------------------------------------- + + Scenario: _register_subcommands handles import failure gracefully + Given cmcov3 the _subcommands_registered flag is reset to False + When cmcov3 _register_subcommands is called and an import raises an error + Then cmcov3 the error console should have printed the failure message + And cmcov3 the _subcommands_registered flag should still be False + + # ------------------------------------------------------------------- + # Lines 582-586: completion command with subprocess returning stdout + # ------------------------------------------------------------------- + + Scenario: completion command outputs subprocess stdout when present + Given cmcov3 subprocess.run is mocked to return stdout "echo hello" + When cmcov3 the completion command is invoked with shell "bash" + Then cmcov3 the output should contain "echo hello" + + # ------------------------------------------------------------------- + # Lines 587-590: completion command with empty subprocess stdout + # ------------------------------------------------------------------- + + Scenario: completion command outputs placeholder when subprocess has no stdout + Given cmcov3 subprocess.run is mocked to return empty stdout + When cmcov3 the completion command is invoked with shell "zsh" + Then cmcov3 the output should contain "# Completion script for zsh" + And cmcov3 the output should contain "# Shell: zsh" + + # ------------------------------------------------------------------- + # Lines 593-594+: convert_exit_code function coverage + # ------------------------------------------------------------------- + + Scenario: convert_exit_code returns 0 for None input + When cmcov3 convert_exit_code is called with None + Then cmcov3 the exit code result should be 0 + + Scenario: convert_exit_code extracts exit_code attribute from object + When cmcov3 convert_exit_code is called with an object having exit_code 42 + Then cmcov3 the exit code result should be 42 + + Scenario: convert_exit_code clamps large positive code to 255 + When cmcov3 convert_exit_code is called with integer 999 + Then cmcov3 the exit code result should be 255 + + Scenario: convert_exit_code passes through negative codes + When cmcov3 convert_exit_code is called with integer -1 + Then cmcov3 the exit code result should be -1 + + Scenario: convert_exit_code returns 1 for non-integer string + When cmcov3 convert_exit_code is called with a non-convertible value + Then cmcov3 the exit code result should be 1 + + Scenario: convert_exit_code handles zero correctly + When cmcov3 convert_exit_code is called with integer 0 + Then cmcov3 the exit code result should be 0 + + Scenario: convert_exit_code handles normal positive code + When cmcov3 convert_exit_code is called with integer 7 + Then cmcov3 the exit code result should be 7 diff --git a/robot/plan_diff_artifacts.robot b/robot/plan_diff_artifacts.robot new file mode 100644 index 000000000..63d85ae5f --- /dev/null +++ b/robot/plan_diff_artifacts.robot @@ -0,0 +1,67 @@ +*** Settings *** +Documentation Integration tests for plan diff and artifacts output. +... Tests D0b.apply features: diff rendering, artifacts summary, +... empty changeset guard, apply summary persistence, and merge failure handling. +Resource ${CURDIR}/common.resource +Suite Setup Setup Test Environment +Suite Teardown Cleanup Test Environment + +*** Variables *** +${HELPER_SCRIPT} robot/helper_plan_diff_artifacts.py + +*** Test Cases *** +Plan Diff Renders Changeset Summary + [Documentation] Verify plan diff shows file changes grouped by path + [Tags] diff plan changeset + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} diff-output cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} diff-output-ok + +Plan Artifacts Shows Changeset Metadata + [Documentation] Verify plan artifacts shows changeset ID, sandbox refs, and file list + [Tags] artifacts plan changeset + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} artifacts-output cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} artifacts-output-ok + +Empty Changeset Guard Blocks Apply + [Documentation] Verify apply is blocked when changeset is empty + [Tags] guard plan apply + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} empty-guard cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} empty-guard-ok + +Empty Changeset Guard Allows With Flag + [Documentation] Verify apply proceeds when --allow-empty is set + [Tags] guard plan apply + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} empty-guard-allow cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} empty-guard-allow-ok + +Apply Summary Persistence + [Documentation] Verify apply summary metadata is persisted into plan + [Tags] apply plan metadata + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} apply-summary cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} apply-summary-ok + +Merge Failure Handling + [Documentation] Verify merge failure sets plan to errored with conflict details + [Tags] merge plan error + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} merge-failure cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} merge-failure-ok + +Diff JSON Format Output + [Documentation] Verify diff JSON format includes entries and summary + [Tags] diff plan json + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} diff-json cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} diff-json-ok + +Diff YAML Format Output + [Documentation] Verify diff YAML format includes changeset metadata + [Tags] diff plan yaml + ${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} diff-yaml cwd=${WORKSPACE} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} diff-yaml-ok