TDD: Write failing test for #1025 — plan correct auto-resolve fails #1035

Closed
opened 2026-03-17 18:19:13 +00:00 by freemo · 4 comments
Owner

Metadata

  • Commit Message: test: add TDD bug-capture test for #1025 — plan correct auto-resolve
  • Branch: tdd/m4-plan-correct-auto-resolve

Background and Context

This is the TDD counterpart to bug #1025. Per CONTRIBUTING.md Bug Fix Workflow, a tagged test must be written first.

See #1025 for full bug details.

Expected Behavior

A test captures that plan correct auto-resolve mode fails to correctly recompute the decision subtree.

Acceptance Criteria

  • Tagged with @tdd_bug, @tdd_bug_1025, @tdd_expected_fail.
  • CI passes. Tag validation passes. Coverage >=97%.

Definition of Done

Commit pushed, PR merged to master.

Subtasks

  • Code: Analyze the auto-resolve failure described in #1025.
  • Tests (Behave): Write scenario exercising plan correct auto-resolve. Tag appropriately.
  • Tests (Robot): Add Robot test if integration behavior warrants it.
  • Docs: Comment in test file.
  • Quality: CI, tag validation, coverage, nox.
## Metadata - **Commit Message**: `test: add TDD bug-capture test for #1025 — plan correct auto-resolve` - **Branch**: `tdd/m4-plan-correct-auto-resolve` ## Background and Context This is the TDD counterpart to bug #1025. Per `CONTRIBUTING.md` Bug Fix Workflow, a tagged test must be written first. See #1025 for full bug details. ## Expected Behavior A test captures that `plan correct` auto-resolve mode fails to correctly recompute the decision subtree. ## Acceptance Criteria - [x] Tagged with `@tdd_bug`, `@tdd_bug_1025`, `@tdd_expected_fail`. - [x] CI passes. Tag validation passes. Coverage >=97%. ## Definition of Done Commit pushed, PR merged to `master`. ## Subtasks - [x] Code: Analyze the auto-resolve failure described in #1025. - [x] Tests (Behave): Write scenario exercising plan correct auto-resolve. Tag appropriately. - [x] Tests (Robot): Add Robot test if integration behavior warrants it. - [x] Docs: Comment in test file. - [x] Quality: CI, tag validation, coverage, nox.
freemo added this to the v3.3.0 milestone 2026-03-17 18:19:23 +00:00
Author
Owner

Planning Agent — Dependency Note

This TDD issue (#1035) blocks bug fix #1025. Dependencies to create in Forgejo UI: #1025 depends on → #1035.

**Planning Agent — Dependency Note** This TDD issue (#1035) blocks bug fix #1025. **Dependencies to create in Forgejo UI**: #1025 depends on → #1035.
Author
Owner

Assigned to @hurui200320 for TDD test writing for bug #1025 (plan correct auto-resolve). This TDD counterpart is top priority per project policy — bugs always take precedence over feature work.

Assigned to @hurui200320 for TDD test writing for bug #1025 (plan correct auto-resolve). This TDD counterpart is top priority per project policy — bugs always take precedence over feature work.
brent.edwards added reference tdd/m4-plan-correct-auto-resolve 2026-03-26 01:00:02 +00:00
Member

Implementation Journal (TDD capture for bug #1025)

Scope and intent

This change is test-only for the TDD counterpart. It intentionally captures the current failure mode described in #1025 and does not modify production code.

Working baseline for traceability: 34c2acc3.

Design decisions and rationale

  1. Dual-layer TDD coverage (Behave + Robot)

    • Behave scenarios capture unit-level CLI behavior for plan correct when --plan is omitted.
    • Robot scenarios validate the same behavior through subprocess invocation (integration-style execution path).
    • Rationale: issue #1025 is specifically about isolated subprocess/E2E behavior, so both layers are needed.
  2. Isolated-environment simulation via divergent container resolution

    • Implemented shared fixtures that return different containers across sequential get_container() calls:
      • first call: container with an Execute/COMPLETE plan present
      • second call: isolated container with empty list_plans()
    • This reproduces the failure path where _resolve_active_plan_id() cannot find an active plan.
    • Rationale: reproduces the observed bug behavior deterministically without mutating global runtime state.
  3. Shared mock fixtures for consistency

    • Centralized reusable builders in features.mocks.tdd_plan_correct_auto_resolve_fixtures.
    • Both Behave steps and Robot helper import the same fixtures.
    • Rationale: prevents drift between unit and integration TDD capture logic.
  4. Mode coverage

    • Added scenarios for both correction modes (revert and append).
    • Rationale: auto-resolution path is common; both user-facing paths should be pinned by regression tests.
  5. Performance artifact included

    • Added an ASV benchmark focused on active-plan filtering overhead when --plan is omitted.
    • Rationale: issue path invokes plan listing/filtering repeatedly in CLI usage; benchmark provides a baseline for later fix validation.

Code locations (logical references)

  • Behave feature: features/tdd_plan_correct_auto_resolve.feature
  • Behave steps: features.steps.tdd_plan_correct_auto_resolve_steps
  • Shared fixtures: features.mocks.tdd_plan_correct_auto_resolve_fixtures
  • Robot suite: robot/tdd_plan_correct_auto_resolve.robot
  • Robot helper: robot.helper_tdd_plan_correct_auto_resolve
  • Benchmark: benchmarks/tdd_plan_correct_auto_resolve_bench.ResolveActivePlanSuite

Test and quality results

Executed through nox sessions:

  • nox -s unit_tests -- features/tdd_plan_correct_auto_resolve.feature
  • nox -s integration_tests -- --include tdd_bug_1025
  • nox -s lint
  • nox -s typecheck
  • nox -s coverage_report (coverage: 97.651253%)
  • nox (full default suite)

Notes / deviations

  • No production-module modifications were made in this TDD issue by design.
  • Existing unrelated working-tree changes in .devcontainer/Dockerfile were left untouched.
## Implementation Journal (TDD capture for bug #1025) ### Scope and intent This change is test-only for the TDD counterpart. It intentionally captures the current failure mode described in #1025 and does **not** modify production code. Working baseline for traceability: `34c2acc3`. ### Design decisions and rationale 1. **Dual-layer TDD coverage (Behave + Robot)** - Behave scenarios capture unit-level CLI behavior for `plan correct` when `--plan` is omitted. - Robot scenarios validate the same behavior through subprocess invocation (integration-style execution path). - Rationale: issue #1025 is specifically about isolated subprocess/E2E behavior, so both layers are needed. 2. **Isolated-environment simulation via divergent container resolution** - Implemented shared fixtures that return different containers across sequential `get_container()` calls: - first call: container with an `Execute/COMPLETE` plan present - second call: isolated container with empty `list_plans()` - This reproduces the failure path where `_resolve_active_plan_id()` cannot find an active plan. - Rationale: reproduces the observed bug behavior deterministically without mutating global runtime state. 3. **Shared mock fixtures for consistency** - Centralized reusable builders in `features.mocks.tdd_plan_correct_auto_resolve_fixtures`. - Both Behave steps and Robot helper import the same fixtures. - Rationale: prevents drift between unit and integration TDD capture logic. 4. **Mode coverage** - Added scenarios for both correction modes (`revert` and `append`). - Rationale: auto-resolution path is common; both user-facing paths should be pinned by regression tests. 5. **Performance artifact included** - Added an ASV benchmark focused on active-plan filtering overhead when `--plan` is omitted. - Rationale: issue path invokes plan listing/filtering repeatedly in CLI usage; benchmark provides a baseline for later fix validation. ### Code locations (logical references) - Behave feature: `features/tdd_plan_correct_auto_resolve.feature` - Behave steps: `features.steps.tdd_plan_correct_auto_resolve_steps` - Shared fixtures: `features.mocks.tdd_plan_correct_auto_resolve_fixtures` - Robot suite: `robot/tdd_plan_correct_auto_resolve.robot` - Robot helper: `robot.helper_tdd_plan_correct_auto_resolve` - Benchmark: `benchmarks/tdd_plan_correct_auto_resolve_bench.ResolveActivePlanSuite` ### Test and quality results Executed through `nox` sessions: - `nox -s unit_tests -- features/tdd_plan_correct_auto_resolve.feature` ✅ - `nox -s integration_tests -- --include tdd_bug_1025` ✅ - `nox -s lint` ✅ - `nox -s typecheck` ✅ - `nox -s coverage_report` ✅ (coverage: **97.651253%**) - `nox` (full default suite) ✅ ### Notes / deviations - No production-module modifications were made in this TDD issue by design. - Existing unrelated working-tree changes in `.devcontainer/Dockerfile` were left untouched.
Member

Update: opened PR #1172 for this TDD capture and moved the issue to State/In Review.

  • PR: #1172
  • Commit: fb5b55fa (test: add TDD bug-capture test for #1025 — plan correct auto-resolve)
  • Branch: tdd/m4-plan-correct-auto-resolve
Update: opened PR #1172 for this TDD capture and moved the issue to State/In Review. - PR: https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/1172 - Commit: fb5b55fa (`test: add TDD bug-capture test for #1025 — plan correct auto-resolve`) - Branch: `tdd/m4-plan-correct-auto-resolve`
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#1035
No description provided.