test(e2e): workflow example 7 — CI/CD integration, automated PR review and fix (ci profile) #804

Merged
CoreRasurae merged 3 commits from test/e2e-wf07-cicd into master 2026-03-26 18:26:12 +00:00

3 Commits

Author SHA1 Message Date
CoreRasurae cefbca73c2 test(e2e): workflow example 7 — CI/CD integration, automated PR review and fix (ci profile)
CI / lint (pull_request) Successful in 3m18s
CI / build (pull_request) Successful in 45s
CI / typecheck (pull_request) Successful in 3m49s
CI / security (pull_request) Successful in 4m7s
CI / quality (pull_request) Successful in 4m9s
CI / benchmark-publish (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 7m11s
CI / unit_tests (pull_request) Successful in 7m53s
CI / docker (pull_request) Successful in 1m2s
CI / e2e_tests (pull_request) Successful in 12m13s
CI / coverage (pull_request) Successful in 11m54s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 20s
CI / lint (push) Successful in 3m15s
CI / quality (push) Successful in 3m39s
CI / typecheck (push) Successful in 3m56s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m24s
CI / unit_tests (push) Successful in 6m7s
CI / integration_tests (push) Successful in 6m53s
CI / docker (push) Successful in 1m49s
CI / e2e_tests (push) Successful in 12m4s
CI / coverage (push) Successful in 10m14s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 53m11s
Implemented Robot Framework E2E test suite validating Specification
Workflow Example 7 (CI/CD Integration).  Tests exercise the real
CleverAgents CLI with zero mocking, covering:

- ci-profile configuration with JSON output format and WARN log level
  (spec Step 1)
- Idempotent resource and project registration with resource linking,
  verified via strict occurrence-count assertions
- Three-validation registration (lint, typecheck, tests) with project
  attachment and tool-list verification
- CI plan launch with action args (pr_branch, base_branch), explicit
  plan execute for lifecycle progression, and terminal-state assertion
- JSON output verification via json.loads() with raw_decode fallback
  for mixed log/JSON CLI output
- Graceful degradation via Skip If No LLM Keys when API keys are
  unavailable

Resource/project naming follows spec convention (local/ci-workspace
project, local/ci-main resource).  Entity creation commands tolerate
"already exists" for CI re-runnability.  Config assertions use
stdout-only matching and exact equality.  Validation naming aligned
with spec (local/ci-lint per §Example 7, line 39130).

Added robot/common_vars.py module placeholder for shared Robot
Framework variables.

ISSUES CLOSED: #753
2026-03-26 18:10:14 +00:00
Luis Mendes 01efa2922c fix(test): align behave BDD scenarios with updated lifecycle-apply behavior
Updated automation_levels.feature to expect "applied" processing state
instead of "queued" after completing execute on a full_automation plan,
matching the new auto_progress() behavior that drives Apply to terminal
state.

Updated plan_cli_coverage_boost_steps.py to properly mock the full apply
lifecycle (get_plan → apply_plan → start_apply → complete_apply) instead
of returning a single plan from apply_plan, matching the updated
lifecycle_apply_plan command handler that now drives plans through to the
terminal applied state.

Refs: #753
2026-03-26 17:35:34 +00:00
Luis Mendes 59be111e1d fix(plan): complete apply phase inline in auto_progress and lifecycle-apply CLI
Modified auto_progress() to complete the Apply phase immediately after
transitioning from Execute to Apply, since Apply is a metadata transition
with no LLM processing.  This ensures `plan execute` drives the plan to
the terminal `applied` state when the automation profile permits (ci,
full-auto profiles with auto_apply < 1.0).

Extracted `_complete_apply_if_queued()` helper that consolidates the
Apply-completion pattern (start_apply + complete_apply) into a single
method with error recovery (calls `fail_apply` on failure) and async-job
guard (skips inline completion when async execution is enabled to avoid
orphaning enqueued jobs).  Used by `auto_progress()`,
`lifecycle_apply_plan()`, and `try_auto_run()`.

Added PlanLifecycleService.try_auto_run() that drives plans through all
lifecycle phases (strategize → execute → apply) when automation-profile
thresholds allow automatic progression.  Each phase checks the profile's
auto_* threshold before proceeding; a threshold of 1.0 stops the plan at
that phase boundary for human approval.

Fixed `lifecycle-apply` CLI leaving plans stuck in `apply/queued` without
completing.  The command now calls `_complete_apply_if_queued()` when the
plan is in Apply/queued, driving it to the terminal `applied` state.

Fixed stale RICH output in `lifecycle_apply_plan` that printed
"Plan is now in Apply phase (queued)" after the plan had already reached
terminal `applied` state; now branches on `plan.is_terminal`.

Additional fixes:
- SQLite UNIQUE constraint violation in LifecyclePlanRepository.update():
  added session.flush() after clear() on child collections (project_links,
  arguments, invariants) before re-inserting rows
- Added 'state' alias in _plan_spec_dict() JSON output for spec §Example 7
  jq compatibility
- Updated plan execute and lifecycle-apply reference documentation

Refs: #753
2026-03-26 17:35:24 +00:00