TEST-INFRA: [test-data-quality] Add negative tests to database_infrastructure.feature #2484

Open
opened 2026-04-03 18:37:54 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: test/database-infrastructure-negative-tests
  • Commit Message: test(database_infrastructure): add negative test scenarios for error conditions and edge cases
  • Milestone: v3.8.0
  • Parent Epic: #1678

Description

The scenarios in features/database_infrastructure.feature only test the "happy path" for the database models and repositories. They do not cover any error conditions or edge cases.

Recommendation:

Add new scenarios to test for the following conditions:

  • Trying to create a model with invalid data (e.g., a plan with a non-existent project ID, a context with an invalid type).
  • Violating database constraints (e.g., unique constraints, foreign key constraints).
  • Trying to create a model with missing required fields.

Adding these scenarios will make the tests more robust and increase confidence in the reliability of the database infrastructure.

Subtasks

  • Add scenario: attempt to create a plan with a non-existent project ID — expect appropriate error/exception (foreign key constraint violation)
  • Add scenario: attempt to create a context with an invalid type value — expect ValueError or validation error
  • Add scenario: attempt to create a model with missing required fields — expect TypeError or validation error
  • Add scenario: attempt to violate a unique constraint (e.g., duplicate primary key or unique field) — expect appropriate database error
  • Add scenario: attempt to violate a foreign key constraint — expect appropriate database error
  • Verify all new scenarios use mocks from features/mocks/ directory only
  • Ensure all new step definitions are statically typed with explicit annotations
  • Run nox -e unit_tests to confirm all new scenarios pass

Definition of Done

  • All negative test scenarios listed in Subtasks are implemented in features/database_infrastructure.feature
  • All new step definitions are placed in the appropriate steps file under features/
  • All mocks/test doubles are located exclusively in features/mocks/
  • All code passes nox -e typecheck (Pyright — no # type: ignore suppressions)
  • All nox stages pass
  • Coverage >= 97%
  • A PR has been opened, reviewed, and merged that closes this issue

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `test/database-infrastructure-negative-tests` - **Commit Message**: `test(database_infrastructure): add negative test scenarios for error conditions and edge cases` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Description The scenarios in `features/database_infrastructure.feature` only test the "happy path" for the database models and repositories. They do not cover any error conditions or edge cases. **Recommendation:** Add new scenarios to test for the following conditions: * Trying to create a model with invalid data (e.g., a plan with a non-existent project ID, a context with an invalid type). * Violating database constraints (e.g., unique constraints, foreign key constraints). * Trying to create a model with missing required fields. Adding these scenarios will make the tests more robust and increase confidence in the reliability of the database infrastructure. ## Subtasks - [ ] Add scenario: attempt to create a plan with a non-existent project ID — expect appropriate error/exception (foreign key constraint violation) - [ ] Add scenario: attempt to create a context with an invalid type value — expect `ValueError` or validation error - [ ] Add scenario: attempt to create a model with missing required fields — expect `TypeError` or validation error - [ ] Add scenario: attempt to violate a unique constraint (e.g., duplicate primary key or unique field) — expect appropriate database error - [ ] Add scenario: attempt to violate a foreign key constraint — expect appropriate database error - [ ] Verify all new scenarios use mocks from `features/mocks/` directory only - [ ] Ensure all new step definitions are statically typed with explicit annotations - [ ] Run `nox -e unit_tests` to confirm all new scenarios pass ## Definition of Done - [ ] All negative test scenarios listed in Subtasks are implemented in `features/database_infrastructure.feature` - [ ] All new step definitions are placed in the appropriate steps file under `features/` - [ ] All mocks/test doubles are located exclusively in `features/mocks/` - [ ] All code passes `nox -e typecheck` (Pyright — no `# type: ignore` suppressions) - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] A PR has been opened, reviewed, and merged that closes this issue --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-03 18:38:11 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement that should be included in the milestone.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement that should be included in the milestone. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.8.0 milestone 2026-04-07 00:50:19 +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.

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