test: add TDD bug-capture test for #968 — plan explain plan_id handling #1052
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#978 TDD: Write failing test for #968 — plan explain expects decision_id but test passes plan_id
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!1052
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tdd/m3-plan-explain-plan-id"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add TDD bug-capture tests for bug #968: the
plan explainCLI command fails with rc=1 when given a plan_id becauseexplain_decision_cmdtreats its argument as a decision_id andsvc.get_decision(plan_id)raisesDecisionNotFoundError.These tests capture the exact failure condition described in #968 and are tagged with
@tdd_expected_fail,@tdd_bug, and@tdd_bug_968. The@tdd_expected_failtag inverts the test result so that CI passes while the bug is unfixed. Once bug #968 is fixed, the@tdd_expected_failtag will be removed and the tests will serve as permanent regression tests.Closes #978
Changes
Behave Tests (
features/tdd_plan_explain_plan_id.feature)DecisionServicesoget_decision(plan_id)raisesDecisionNotFoundError(the bug) andlist_decisions(plan_id)returns decisions. Invokesplan explain <plan_id>via CliRunner and asserts rc=0 with decision details visible. Verifieslist_decisionswas called with the correctplan_id.Both scenarios currently fail (rc=1, proving the bug exists), but the
@tdd_expected_failtag makes CI pass.Robot Tests (
robot/tdd_plan_explain_plan_id.robot)DecisionService, invokesplan explain <plan_id>via subprocess, and asserts rc=0.Both tests carry
tdd_expected_fail,tdd_bug, andtdd_bug_968tags.Step Definitions (
features/steps/tdd_plan_explain_plan_id_steps.py)Step implementations for the Behave feature, following the established patterns from
plan_explain_cli_coverage_steps.py. Includeslist_decisions.assert_called_once_with(plan_id)verification to ensure the fix exercises the fallback lookup path.Helper Script (
robot/helper_tdd_plan_explain_plan_id.py)Python helper for Robot tests, following the established pattern from
helper_tdd_checkpoint_real_rollback.py. Uses a shared_run_plan_explain()helper to avoid subprocess invocation duplication, setsNO_COLOR=1in subprocess environment to prevent ANSI escape codes.CHANGELOG
Added entry under
## Unreleaseddescribing the TDD bug-capture tests for bug #968.Review Fixes Applied (Iteration 1)
_setup_plan_with_decisions()moved to module level with# noqa: E402, consistent with all otherrobot/helper_tdd_*.pyfiles.svc.get_decision.return_value = Nonechanged tosvc.get_decision.side_effect = DecisionNotFoundError(...)to match the realDecisionService.get_decision()which raisesDecisionNotFoundError, not returnsNone.assert "decision_id" in output or "question" in outputchanged to AND for a more precise assertion that verifies both fields are present.# type: ignore[arg-type](Minor) — Changedkwargs: dict[str, object]tokwargs: dictand removed the# type: ignore[arg-type]directive, per CONTRIBUTING.md type safety rules.subprocess.TimeoutExpired(Minor) — Bothsubprocess.run()calls wrapped intry/except subprocess.TimeoutExpiredwith descriptive_fail()messages.subprocess.runtimeout reduced from 60s to 45s so the helper catches timeout before Robot's 60s outer timeout kills it.list_decisions()verification afterrecord_decision()to distinguish setup failures from the actual bug.Review Fixes Applied (Iteration 2)
## Unreleaseddescribing the TDD bug-capture tests for bug #968, per CONTRIBUTING.md §"Pull Request Process".if "decision" not in combined.lower() and "question" not in combined.lower()toorso both keywords must be present, matching the Behave test's AND-based validation.NO_COLOR=1to subprocess environment (Minor) — Added_make_subprocess_env()helper that copiesos.environand setsNO_COLOR=1, following the established pattern fromrobot/helper_e2e_common.py._run_plan_explain(plan_id)function, reducing code duplication across the two test subcommands.list_decisionsmock verification (Nit, addressed) — Addedsvc.list_decisions.assert_called_once_with(plan_id)in the Behave step that checks decision details, making the test contract clearer.origin/masterper CONTRIBUTING.md §"Branch Hygiene".Quality Gates
nox -e lint— All checks passednox -e typecheck— 0 errorsnox -e unit_tests— 391 features, 11175 scenarios, 0 failednox -e integration_tests— All tests passed (including Tdd Plan Explain Plan Id)nox -e e2e_tests— 16 tests, 0 failednox -e coverage_report— 97% coverage (≥97% threshold met)ea584830cbe17f8b4f48e17f8b4f48211618e1b3Code Review — PR #1052
test: TDD bug-capture test for #968 — plan explain plan_id handlingClean TDD test with correct tag triplet (
@tdd_expected_fail @tdd_bug @tdd_bug_968). Good coverage of both CliRunner and subprocess invocation paths. The mock accurately models real behavior —get_decisionraisesDecisionNotFoundError(not returns None), matching the actualDecisionService. Thelist_decisions.assert_called_once_with(plan_id)verification ensures the fallback lookup path is exercised.Approved. No issues found.
211618e1b3058d486593New commits pushed, approval review dismissed automatically according to repository settings