bug(testing): TDD infrastructure fails to invert non-AssertionError exceptions in expected-fail tests #3472

Open
opened 2026-04-05 18:11:04 +00:00 by freemo · 2 comments
Owner

Description

The TDD support infrastructure in features/environment.py incorrectly handles tests marked with @tdd_expected_fail.

The apply_tdd_inversion function contains a guard that prevents it from inverting test results if the failure is caused by any exception other than an AssertionError.

This is incorrect. The purpose of a TDD bug-capture test is often to reproduce a specific, non-assertion exception (e.g., JSONDecodeError, TypeError, KeyError). The current logic misclassifies these expected exceptions as infrastructure failures, which causes the test runner to exit with a non-zero code, breaking the TDD workflow.

Acceptance Criteria

  • The guard for non-AssertionError exceptions in apply_tdd_inversion is removed.
  • A test tagged with @tdd_expected_fail that fails with any exception type should be correctly inverted and result in a nox exit code of 0.
## Description The TDD support infrastructure in `features/environment.py` incorrectly handles tests marked with `@tdd_expected_fail`. The `apply_tdd_inversion` function contains a guard that prevents it from inverting test results if the failure is caused by any exception other than an `AssertionError`. This is incorrect. The purpose of a TDD bug-capture test is often to reproduce a specific, non-assertion exception (e.g., `JSONDecodeError`, `TypeError`, `KeyError`). The current logic misclassifies these expected exceptions as infrastructure failures, which causes the test runner to exit with a non-zero code, breaking the TDD workflow. ## Acceptance Criteria - The guard for non-`AssertionError` exceptions in `apply_tdd_inversion` is removed. - A test tagged with `@tdd_expected_fail` that fails with any exception type should be correctly inverted and result in a `nox` exit code of 0.
freemo added this to the v3.7.0 milestone 2026-04-05 18:12:33 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog (confirmed) — TDD infrastructure bug affecting test inversion for non-AssertionError exceptions. Important for test reliability.
  • Milestone: v3.7.0 (assigned — test infrastructure improvement)
  • Story Points: 2 (S) — Fix exception handling in TDD test infrastructure
  • MoSCoW: Should Have — TDD infrastructure reliability affects developer productivity and test quality. Not blocking current milestones but important for ongoing development.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog (confirmed) — TDD infrastructure bug affecting test inversion for non-AssertionError exceptions. Important for test reliability. - **Milestone**: v3.7.0 (assigned — test infrastructure improvement) - **Story Points**: 2 (S) — Fix exception handling in TDD test infrastructure - **MoSCoW**: Should Have — TDD infrastructure reliability affects developer productivity and test quality. Not blocking current milestones but important for ongoing development. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Transitioning issue #3472 to State/In Progress.

Preconditions checked:

  • Current State label: State/Verified present; no Blocked label detected.
  • No blocker in place; precondition satisfied for In Progress.

Planned actions:

  • Remove old State/* label(s): State/Verified
  • Add new State/In Progress label
  • Do not close issue (transition is to In Progress, not Completed)

Status: Unable to apply label changes with the current Forgejo API tooling in this environment. The API wrapper provided does not expose direct label management endpoints. I can perform the changes if you authorize/enable label editing endpoints, or if you provide a workaround (e.g., a direct REST call).

Current labels on the issue (before): [State/Verified, MoSCoW/Should Have, Priority/Backlog, Type/Bug]
Expected labels after transition (if applied): [State/In Progress, MoSCoW/Should Have, Priority/Backlog, Type/Bug]


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-state-updater

Transitioning issue #3472 to State/In Progress. Preconditions checked: - Current State label: State/Verified present; no Blocked label detected. - No blocker in place; precondition satisfied for In Progress. Planned actions: - Remove old State/* label(s): State/Verified - Add new State/In Progress label - Do not close issue (transition is to In Progress, not Completed) Status: Unable to apply label changes with the current Forgejo API tooling in this environment. The API wrapper provided does not expose direct label management endpoints. I can perform the changes if you authorize/enable label editing endpoints, or if you provide a workaround (e.g., a direct REST call). Current labels on the issue (before): [State/Verified, MoSCoW/Should Have, Priority/Backlog, Type/Bug] Expected labels after transition (if applied): [State/In Progress, MoSCoW/Should Have, Priority/Backlog, Type/Bug] --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-state-updater
freemo removed this from the v3.7.0 milestone 2026-04-06 23:48:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#3472
No description provided.