fix(cli): add <REGEX> positional argument to agents plan list command
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 29s
CI / lint (pull_request) Successful in 3m45s
CI / build (pull_request) Successful in 3m42s
CI / typecheck (pull_request) Successful in 4m24s
CI / quality (pull_request) Successful in 4m26s
CI / security (pull_request) Successful in 4m46s
CI / integration_tests (pull_request) Successful in 7m31s
CI / unit_tests (pull_request) Successful in 7m47s
CI / e2e_tests (pull_request) Successful in 7m39s
CI / docker (pull_request) Successful in 1m35s
CI / coverage (pull_request) Successful in 14m19s
CI / benchmark-regression (push) Waiting to run
CI / benchmark-publish (push) Waiting to run
CI / status-check (pull_request) Successful in 3s
CI / push-validation (push) Successful in 23s
CI / helm (push) Successful in 31s
CI / build (push) Successful in 3m48s
CI / lint (push) Successful in 3m54s
CI / quality (push) Successful in 4m21s
CI / typecheck (push) Successful in 4m29s
CI / security (push) Successful in 4m46s
CI / e2e_tests (push) Successful in 6m55s
CI / integration_tests (push) Successful in 7m18s
CI / unit_tests (push) Successful in 8m45s
CI / docker (push) Successful in 1m33s
CI / coverage (push) Successful in 15m12s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 24m35s
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 29s
CI / lint (pull_request) Successful in 3m45s
CI / build (pull_request) Successful in 3m42s
CI / typecheck (pull_request) Successful in 4m24s
CI / quality (pull_request) Successful in 4m26s
CI / security (pull_request) Successful in 4m46s
CI / integration_tests (pull_request) Successful in 7m31s
CI / unit_tests (pull_request) Successful in 7m47s
CI / e2e_tests (pull_request) Successful in 7m39s
CI / docker (pull_request) Successful in 1m35s
CI / coverage (pull_request) Successful in 14m19s
CI / benchmark-regression (push) Waiting to run
CI / benchmark-publish (push) Waiting to run
CI / status-check (pull_request) Successful in 3s
CI / push-validation (push) Successful in 23s
CI / helm (push) Successful in 31s
CI / build (push) Successful in 3m48s
CI / lint (push) Successful in 3m54s
CI / quality (push) Successful in 4m21s
CI / typecheck (push) Successful in 4m29s
CI / security (push) Successful in 4m46s
CI / e2e_tests (push) Successful in 6m55s
CI / integration_tests (push) Successful in 7m18s
CI / unit_tests (push) Successful in 8m45s
CI / docker (push) Successful in 1m33s
CI / coverage (push) Successful in 15m12s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 24m35s
The <REGEX> positional argument was already implemented in the CLI code
(src/cleveragents/cli/commands/plan.py) in a prior commit. This commit
adds the missing Robot Framework integration test that verifies the
argument is accepted and correctly filters plan names by regex pattern.
Changes:
- robot/helper_plan_cli_spec.py: Add list_regex() helper function that
creates two mock plans (local/smoke-plan and local/other-plan), invokes
'agents plan list --format json smoke.*', and verifies that only the
matching plan appears in the output.
- robot/plan_cli_spec.robot: Add 'Plan Lifecycle List Accepts Regex
Positional Argument' test case that calls the list-regex helper and
asserts the plan-cli-list-regex-ok sentinel is printed.
The Behave unit test scenario ('Plan list with regex filter') already
existed in features/plan_cli_spec_alignment.feature and the step
definition in features/steps/plan_cli_spec_alignment_steps.py.
Closes #3436
This commit was merged in pull request #3455.
This commit is contained in:
@@ -269,6 +269,57 @@ def list_columns() -> None:
|
||||
print("plan-cli-list-columns-ok")
|
||||
|
||||
|
||||
def list_regex() -> None:
|
||||
"""Verify list accepts a positional <REGEX> argument and filters by name."""
|
||||
mock_service = MagicMock()
|
||||
matching_plan = _mock_plan() # name: local/smoke-plan, action: local/smoke-action
|
||||
now = matching_plan.timestamps.created_at
|
||||
non_matching_plan = Plan(
|
||||
identity=PlanIdentity(plan_id="01KHDE6WWS2171PWW3GJEBXZ8S"),
|
||||
namespaced_name=NamespacedName.parse("local/other-plan"),
|
||||
description="Other plan",
|
||||
definition_of_done="Done",
|
||||
action_name="local/other-action",
|
||||
phase=PlanPhase.STRATEGIZE,
|
||||
processing_state=ProcessingState.QUEUED,
|
||||
project_links=[],
|
||||
arguments={},
|
||||
arguments_order=[],
|
||||
automation_profile=AutomationProfileRef(
|
||||
profile_name="trusted",
|
||||
provenance=AutomationProfileProvenance.PLAN,
|
||||
),
|
||||
estimation_actor="openai/gpt-4",
|
||||
invariant_actor="openai/gpt-4",
|
||||
strategy_actor="openai/gpt-4",
|
||||
execution_actor="openai/gpt-4",
|
||||
reusable=True,
|
||||
read_only=False,
|
||||
created_by=None,
|
||||
timestamps=PlanTimestamps(created_at=now, updated_at=now),
|
||||
)
|
||||
mock_service.list_plans.return_value = [matching_plan, non_matching_plan]
|
||||
with patch(
|
||||
"cleveragents.cli.commands.plan._get_lifecycle_service",
|
||||
return_value=mock_service,
|
||||
):
|
||||
# Use JSON format so full names are visible (rich table truncates them)
|
||||
result = runner.invoke(plan_app, ["list", "--format", "json", "smoke.*"])
|
||||
if result.exit_code != 0:
|
||||
print(f"FAIL: list regex returned {result.exit_code}", file=sys.stderr)
|
||||
print(result.output, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if "smoke-plan" not in result.output:
|
||||
print("FAIL: matching plan not in output", file=sys.stderr)
|
||||
print(result.output, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if "other-plan" in result.output:
|
||||
print("FAIL: non-matching plan appeared in output", file=sys.stderr)
|
||||
print(result.output, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print("plan-cli-list-regex-ok")
|
||||
|
||||
|
||||
def status_fields() -> None:
|
||||
"""Verify plan status renders required fields."""
|
||||
mock_service = MagicMock()
|
||||
@@ -329,6 +380,7 @@ _COMMANDS = {
|
||||
"use-actor-overrides": use_actor_overrides,
|
||||
"list-filters": list_filters,
|
||||
"list-columns": list_columns,
|
||||
"list-regex": list_regex,
|
||||
"status-fields": status_fields,
|
||||
"cancel-reason": cancel_reason,
|
||||
}
|
||||
|
||||
@@ -40,6 +40,14 @@ Plan Lifecycle List Accepts Filter Flags
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} plan-cli-list-filters-ok
|
||||
|
||||
Plan Lifecycle List Accepts Regex Positional Argument
|
||||
[Documentation] Verify that ``plan list <REGEX>`` filters plans by name regex
|
||||
${result}= Run Process ${PYTHON} ${HELPER} list-regex cwd=${WORKSPACE}
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} plan-cli-list-regex-ok
|
||||
|
||||
Plan Status Renders Required Fields
|
||||
[Documentation] Verify that ``plan status`` renders action_name, phase, state, projects, args, timestamps
|
||||
${result}= Run Process ${PYTHON} ${HELPER} status-fields cwd=${WORKSPACE}
|
||||
|
||||
Reference in New Issue
Block a user