aditya
36c36bc0ee
test(cli): add regression-guard tests for Container.resolve() crash
...
Add Behave and Robot Framework regression tests for bug #647 , where
plan tree, plan explain, and plan correct CLI commands crashed with
AttributeError when resolving DecisionService from the DI container.
Tests use a real DI container with seeded decisions (not MagicMock)
to catch the exact class of bug that existing M3 tests missed.
Assertions verify successful execution and command-specific output
content. Includes Settings.reset() classmethod for robust singleton
cleanup in test teardown.
Review feedback addressed (hurui200320 Round 5):
- Fixed Behave step engine leak by capturing UoW in cleanup closure
- Removed dead @then decorator; renamed to private _assert_command_succeeded
- Strengthened plan correct assertions with revert/dry-run content checks
- Updated misleading get_container() comment to reflect singleton warming
- Added test-only warning to Settings.reset() docstring
- Added type annotations to 4 settings step functions
- Fixed CONTRIBUTORS.md alphabetical ordering and removed duplicate entry
- Replaced glob.glob with pathlib suffix iteration in Robot helper
- Fixed feature description line break for readability
- Removed redundant TYPE_CHECKING import for Decision
ISSUES CLOSED : #648
2026-03-24 08:46:58 +00:00
hurui200320
09d92ac67b
test(e2e): validate M4 acceptance criteria for v3.3.0 milestone closure ( #560 )
...
## Summary
Validates all M4 acceptance criteria for v3.3.0 milestone closure. Adds CLI-exercising integration tests for the three subplan commands that lacked actual CLI invocation, fixes a pre-existing unit test failure, and corrects CONTRIBUTORS.md ordering.
## Changes
### New CLI Integration Tests (Robot Framework)
Three new test cases in `robot/m4_e2e_verification.robot` with helper functions in `robot/helper_m4_e2e_verification.py`:
| Test | CLI Command | Mocking Approach |
|------|-------------|-----------------|
| `CLI Plan Use Creates Plan With Subplan Config` | `plan use local/refactor-action local/monorepo` | Patches `_get_lifecycle_service`; mocks `get_action_by_name` + `use_action` |
| `CLI Plan Execute Transitions With Subplans` | `plan execute <plan_id>` | Patches `_get_lifecycle_service`; mocks `get_plan` + `execute_plan` |
| `CLI Plan Tree Displays Subplan Hierarchy` | `plan tree <plan_id> --format json` | Patches `get_container`; real `Decision` objects with `SUBPLAN_SPAWN`/`SUBPLAN_PARALLEL_SPAWN` types |
All three follow the same pattern as the existing `plan-diff` test: Typer `CliRunner.invoke()` with mocked services.
### Pre-existing Unit Test Fix
**File:** `features/steps/repositories_uncovered_branches_steps.py`
**Scenario:** `repo branch cov upsert profile with schema version mismatch` (line 110)
**Root cause:** Plain `sessionmaker` returns a new session per call. The `Given` step inserted via session A and committed session B (different session), so the `When` step's session C couldn't see the uncommitted data.
**Fix:** Changed to `scoped_session(sessionmaker(...))` so all factory calls return the same thread-local session.
### Other Fixes
- **CONTRIBUTORS.md**: Moved "Rui Hu" to correct alphabetical position (between Freeman and Khyari)
- **CHANGELOG.md**: Updated #495 entry to document CLI test additions
## M4 Acceptance Criteria Verification
All 7 criteria exercised by 10 E2E tests (7 existing + 3 new) + 8 smoke tests:
| # | Criterion | Test(s) | Status |
|---|-----------|---------|--------|
| 1 | Subplans spawned during Execute via SubplanConfig | `spawn-subplans`, **`cli-plan-use`**, **`cli-plan-execute`** | PASS |
| 2 | Parallel execution with max_parallel bounds | `parallel-exec` | PASS |
| 3 | Three-way merge combines non-conflicting changes | `merge-clean` | PASS |
| 4 | Merge conflicts surfaced with git markers | `merge-conflict` | PASS |
| 5 | Parent plan tracks subplan statuses | `parent-tracking` | PASS |
| 6 | Plan tree displays subplan hierarchy | `plan-tree`, **`cli-plan-tree`** | PASS |
| 7 | Plan diff shows merged results | `plan-diff` (already uses CLI) | PASS |
## Quality Gates
| Stage | Result |
|-------|--------|
| lint | pass |
| format | pass (1074 files unchanged) |
| typecheck | pass (0 errors) |
| unit_tests | 8524 scenarios, 0 failures |
| integration_tests | 1110/1118 pass (8 pre-existing failures in `cli_plan_context_commands.robot`, identical on master) |
| coverage_report | 97% (threshold: 97%) |
| security_scan | pass |
| dead_code | pass |
| docs | pass |
| build | pass |
| benchmark | pass |
## Files Changed
- `CHANGELOG.md` — Updated #495 entry
- `CONTRIBUTORS.md` — Fixed alphabetical ordering
- `features/steps/repositories_uncovered_branches_steps.py` — `scoped_session` fix
- `robot/helper_m4_e2e_verification.py` — 3 new helper functions + imports
- `robot/m4_e2e_verification.robot` — 3 new test cases
ISSUES CLOSED : #495
Reviewed-on: cleveragents/cleveragents-core#560
Reviewed-by: Luis Mendes <luis.mendes@cleverthis.com >
Co-authored-by: Rui Hu <rui.hu@cleverthis.com >
Co-committed-by: Rui Hu <rui.hu@cleverthis.com >
2026-03-06 03:22:45 +00:00
hurui200320
cb1403c24d
test(e2e): validate M3 acceptance criteria for v3.2.0 milestone closure ( #559 )
...
## Summary
Validates all 10 M3 (v3.2.0) acceptance criteria via the E2E verification suite. This is the final gate before closing milestone v3.2.0.
### Single Commit (Squashed per CONTRIBUTING.md)
Branch history was squashed from 2 commits into 1 (`e1665c6e`) to comply with the one-commit-per-issue rule. The single commit includes:
1. **Original work**: Suite-level Force Tags, per-test acceptance criteria tags, enhanced documentation with milestone cross-references, CHANGELOG and CONTRIBUTORS entries.
2. **Review feedback fixes** (addressing Luis's CRITICAL/HIGH findings): Replaced fixture-self-assertion patterns with real CLI-path validation for all 10 acceptance criteria, added persistence-backed decision tree checks, robust JSON output parsing, explicit Robot process timeouts, and clearer correction tags.
3. **Rebase onto current master** (`fff6bb38`): Clean rebase resolving CHANGELOG conflict, as requested by PM (freemo).
4. **Bug fix — `async_enabled` attribute**: `PlanLifecycleService.execute_plan()` accesses `self.settings.async_enabled` (`plan_lifecycle_service.py:283`). The test helper's `_make_settings()` used `create_autospec(Settings)` but didn't set this attribute, causing `plan execute` CLI tests to fail with `AttributeError`. Fixed by adding `settings.async_enabled = False`.
5. **Timeout fixes for parallel execution**: When `pabot` runs 16 parallel Robot processes, cold-start import times + Alembic migrations cause 30s timeouts to be insufficient. Increased timeouts from 30s to 120s in 3 robot files: `actor_context_management.robot`, `decision_di_wiring_smoke.robot`, `changeset_persistence.robot`.
### Files Changed (7)
| File | Change |
|------|--------|
| `robot/helper_m3_e2e_verification.py` | Rewritten for real CLI-path validation; `_make_settings()` fixed with `async_enabled = False` |
| `robot/m3_e2e_verification.robot` | Force Tags, per-test tags, timeouts, enhanced docs |
| `robot/actor_context_management.robot` | Timeout 30s → 120s (line 92) |
| `robot/decision_di_wiring_smoke.robot` | Timeout 30s → 120s (lines 14, 21) |
| `robot/changeset_persistence.robot` | `${TIMEOUT}` 30s → 120s (line 12) |
| `CHANGELOG.md` | Entry for #494 |
| `CONTRIBUTORS.md` | Added Rui Hu |
### Acceptance Criteria Verified (10/10)
**Success Criteria:**
- `plan use` + `plan execute` generates decisions during Strategize
- `plan tree` displays decision tree correctly (via CLI invocation)
- `plan explain` shows full decision context (via CLI invocation)
- `invariant add --project` / `invariant list --project` work with project scope
- `plan correct --dry-run` performs impact analysis (via CLI invocation)
- `plan correct --mode=revert` executes live correction (via CLI invocation)
**Technical Criteria:**
- Decisions recorded with full context snapshot
- Decision tree persists to database and renders correctly
- Correction in revert mode re-executes from decision point
- Invariants enforced during strategize
### Quality Gates (Full Nox Suite)
| Session | Result | Details |
|---------|--------|---------|
| `lint` | PASS | ruff clean |
| `format` | PASS | ruff format clean |
| `typecheck` | PASS | pyright 0 errors, 0 warnings |
| `security_scan` | PASS | bandit clean |
| `dead_code` | PASS | vulture clean |
| `unit_tests` | PASS | 8500 BDD scenarios, 0 failures |
| `integration_tests` | PASS | 1194/1194 tests, 0 failures |
| `docs` | PASS | mkdocs build clean |
| `build` | PASS | wheel built |
| `benchmark` | PASS | performance benchmarks pass |
| `coverage_report` | PASS | 96.96% → rounds to 97% (meets `--fail-under=97`) |
Closes #494
Reviewed-on: cleveragents/cleveragents-core#559
Reviewed-by: Luis Mendes <luis.mendes@cleverthis.com >
Co-authored-by: Rui Hu <rui.hu@cleverthis.com >
Co-committed-by: Rui Hu <rui.hu@cleverthis.com >
2026-03-05 15:09:19 +00:00
khyari hamza
27bef69ddd
feat(decision): add decision persistence
...
Add decision persistence layer with DecisionRepository, DecisionModel,
and Alembic migration. Includes tree queries (BFS traversal via deque,
path-to-root), superseded lookup, ordered decision path retrieval,
concrete Decision type annotations (via TYPE_CHECKING), and comprehensive
test coverage (Behave BDD, Robot Framework, ASV benchmarks). Updated
database_schema.md, CHANGELOG.md, and CONTRIBUTORS.md.
ISSUES CLOSED : #171
2026-02-26 13:40:07 +00:00
brent.edwards
3b58432ecc
docs(merge): merge new docs into branch
2026-02-25 19:41:56 +00:00
CoreRasurae
0e8d43c04b
chore: Update CHANGELOG and CONTRIBUTORS for the implemented features in PR 417
2026-02-25 10:07:16 +00:00
brent.edwards
f3ddb48faf
chore(pr): address code review feedback for PR #420
...
Added CHANGELOG entry for CLI extension test suite. Added Brent Edwards
to CONTRIBUTORS.md. Replaced broad except Exception with specific
ValidationError catch in benchmark. Moved import json to module
top-level in robot helper script.
ISSUES CLOSED : #326
2026-02-25 02:55:40 +00:00
freemo
635b100322
Initial commit
2024-01-25 23:10:04 -05:00