1fda56b778
CI / lint (pull_request) Successful in 29s
CI / typecheck (pull_request) Successful in 58s
CI / quality (pull_request) Successful in 29s
CI / security (pull_request) Successful in 1m11s
CI / build (pull_request) Successful in 24s
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 4m22s
CI / e2e_tests (pull_request) Successful in 4m39s
CI / unit_tests (pull_request) Successful in 9m51s
CI / coverage (pull_request) Successful in 13m30s
CI / docker (pull_request) Successful in 1m23s
CI / status-check (pull_request) Successful in 2s
Implement spec-compliant correction diff output for `agents plan diff --correction <CORRECTION_ATTEMPT_ID>`. Fixes the following issues from the cycle-1 PR review: - C1/M1: Replace direct `unit_of_work.correction_attempts` access with the proper `unit_of_work.transaction()` context manager, eliminating the AttributeError crash and the resource (session) leak. - C2: Add `unit_of_work: UnitOfWork | None = None` constructor parameter to `PlanApplyService` and wire it in `_get_apply_service()` via `container.unit_of_work()`, removing the illegal `get_container()` call inside the method body (ADR-003 DI violation). - C3: Replace metadata serialization stub with a three-section structured diff (Correction Diff summary, Comparison table, Patch Preview) as specified in §agents plan diff of the specification. - C4/M2: Add `features/plan_correction_diff.feature` with 6 BDD scenarios covering all 4 output formats plus plan-not-found and correction-not-found error paths. - C5: Update the three existing BDD scenarios that tested old stub behavior to mock `_get_apply_service()` and assert the new output. - C6: Rename branch to `bugfix/m4-plan-diff-correction-stub` per CONTRIBUTING.md convention. - C7: Amend commit message with body and ISSUES CLOSED footer. - C8: Narrow `except Exception` to `except CorrectionAttemptNotFoundError` to avoid masking programming errors. - M3: Add `robot/plan_correction_diff.robot` and `robot/helper_plan_correction_diff.py` integration test covering rich, plain, and JSON formats and the not-found error path. - M4: Type `_build_correction_diff_dict` parameter as `CorrectionAttemptRecord` instead of `Any`. - M5: Change `fmt: str` to `fmt: Literal["rich", "plain", "json", "yaml"]` on both `diff()` and `correction_diff()`, with a `cast()` call in the CLI layer where Typer supplies a plain `str`. - M6: Add `ValueError` guards for empty `plan_id` and `correction_attempt_id` at the top of `correction_diff()`. - M7: Add blank line between `diff()` and `correction_diff()` method definitions. - M8: Update PR description to reflect actual implementation. - m1: Remove unused `plan` variable in `correction_diff()`. - m2: Reduce three blank lines to two between top-level definitions in `plan_apply_service.py`. - n1: Remove trailing whitespace from blank line in `plan.py`. Quality gates: lint (ruff), typecheck (pyright strict), unit_tests (Behave 632 features / 0 failures) all pass. ISSUES CLOSED: #9085
55 lines
2.9 KiB
Plaintext
55 lines
2.9 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration tests for plan diff --correction command.
|
|
... Verifies that correction_diff() on PlanApplyService produces
|
|
... the three-section structured output (Correction Diff summary,
|
|
... Comparison, Patch Preview) defined in the specification.
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER_SCRIPT} robot/helper_plan_correction_diff.py
|
|
|
|
*** Test Cases ***
|
|
Correction Diff Rich Format
|
|
[Documentation] Verify correction_diff() generates rich-format three-section output
|
|
[Tags] correction plan diff rich
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-diff-rich cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-diff-rich-ok
|
|
|
|
Correction Diff Plain Format
|
|
[Documentation] Verify correction_diff() generates plain-format three-section output
|
|
[Tags] correction plan diff plain
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-diff-plain cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-diff-plain-ok
|
|
|
|
Correction Diff JSON Format
|
|
[Documentation] Verify correction_diff() generates JSON output with all three sections
|
|
[Tags] correction plan diff json
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-diff-json cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-diff-json-ok
|
|
|
|
Correction Diff YAML Format
|
|
[Documentation] Verify correction_diff() generates YAML output with all three sections
|
|
[Tags] correction plan diff yaml
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-diff-yaml cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-diff-yaml-ok
|
|
|
|
Correction Diff Raises When Correction Not Found
|
|
[Documentation] Verify correction_diff() raises PlanError on missing correction attempt
|
|
[Tags] correction plan diff error
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-not-found cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-not-found-ok
|
|
|
|
Correction Diff Raises When Unit Of Work Is None
|
|
[Documentation] Verify correction_diff() raises ValidationError when unit_of_work is None
|
|
[Tags] correction plan diff error validation
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} correction-diff-uow-none cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} correction-diff-uow-none-ok
|