UAT: Prohibited # type: ignore suppression comments found in domain model files #3411

Open
opened 2026-04-05 16:33:35 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/domain-models-remove-type-ignore
  • Commit Message: fix(domain): remove prohibited type: ignore suppressions from domain model files
  • Milestone: (none — backlog)
  • Parent Epic: #362

Bug Description

The project specification and CONTRIBUTING.md explicitly prohibit the use of # type: ignore or any other mechanism to suppress or disable type checking:

"The use of # type: ignore or any other mechanism to suppress or disable type checking is strictly prohibited."

However, two # type: ignore comments were found in domain model files under src/cleveragents/domain/models/core/.

Violation 1 — project_legacy.py, line 75

settings: ProjectSettings = Field(
    default_factory=lambda: ProjectSettings()  # type: ignore[arg-type]
)

The # type: ignore[arg-type] suppresses a Pyright type error about an argument type mismatch in the default_factory lambda. The correct fix is to resolve the underlying type incompatibility — for example, by adjusting the ProjectSettings default construction to satisfy Pyright's type narrowing, or by correcting the field type annotation — rather than silencing the error.

Violation 2 — multi_project.py, line 178

@computed_field  # type: ignore[prop-decorator]
@property
def total_projects(self) -> int:
    """Number of projects tracked in this metadata."""
    return len(self.project_scopes)

The # type: ignore[prop-decorator] suppresses a Pyright error about the @computed_field decorator being applied to a @property. The correct fix is to use the proper Pydantic v2 pattern for computed fields that satisfies Pyright — typically by importing computed_field from pydantic and ensuring the decorator stacking order is compatible with Pyright's type narrowing for Pydantic v2.

Steps to Reproduce

  1. Run: grep -rn "type: ignore" src/cleveragents/domain/models/
  2. Observe two violations:
    • src/cleveragents/domain/models/core/project_legacy.py:75
    • src/cleveragents/domain/models/core/multi_project.py:178

Expected: No # type: ignore comments in any domain model file
Actual: Two # type: ignore comments found in domain model files

Subtasks

  • Write a TDD issue-capture Behave scenario (tagged @tdd_expected_fail) that fails while the violations exist, demonstrating the bug
  • Fix project_legacy.py line 75: resolve the underlying arg-type Pyright error in the ProjectSettings default_factory lambda without using # type: ignore
  • Fix multi_project.py line 178: replace the @computed_field + @property pattern with the correct Pydantic v2 computed_field usage that satisfies Pyright without # type: ignore
  • Remove both # type: ignore comments
  • Run nox -e typecheck and confirm Pyright reports zero errors in both files
  • Update the TDD scenario tag from @tdd_expected_fail to passing
  • Run nox -e unit_tests and confirm all Behave scenarios pass
  • Run nox -e coverage_report and confirm coverage ≥ 97%

Definition of Done

  • Zero # type: ignore comments remain in src/cleveragents/domain/models/core/project_legacy.py
  • Zero # type: ignore comments remain in src/cleveragents/domain/models/core/multi_project.py
  • nox -e typecheck passes with no suppression workarounds in either file
  • The underlying Pyright type errors are resolved at the source (correct types / correct Pydantic v2 patterns), not silenced
  • Behave unit tests cover the corrected field definitions
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/domain-models-remove-type-ignore` - **Commit Message**: `fix(domain): remove prohibited type: ignore suppressions from domain model files` - **Milestone**: *(none — backlog)* - **Parent Epic**: #362 ## Bug Description The project specification and CONTRIBUTING.md explicitly prohibit the use of `# type: ignore` or any other mechanism to suppress or disable type checking: > "The use of `# type: ignore` or any other mechanism to suppress or disable type checking is strictly prohibited." However, two `# type: ignore` comments were found in domain model files under `src/cleveragents/domain/models/core/`. ### Violation 1 — `project_legacy.py`, line 75 ```python settings: ProjectSettings = Field( default_factory=lambda: ProjectSettings() # type: ignore[arg-type] ) ``` The `# type: ignore[arg-type]` suppresses a Pyright type error about an argument type mismatch in the `default_factory` lambda. The correct fix is to resolve the underlying type incompatibility — for example, by adjusting the `ProjectSettings` default construction to satisfy Pyright's type narrowing, or by correcting the field type annotation — rather than silencing the error. ### Violation 2 — `multi_project.py`, line 178 ```python @computed_field # type: ignore[prop-decorator] @property def total_projects(self) -> int: """Number of projects tracked in this metadata.""" return len(self.project_scopes) ``` The `# type: ignore[prop-decorator]` suppresses a Pyright error about the `@computed_field` decorator being applied to a `@property`. The correct fix is to use the proper Pydantic v2 pattern for computed fields that satisfies Pyright — typically by importing `computed_field` from `pydantic` and ensuring the decorator stacking order is compatible with Pyright's type narrowing for Pydantic v2. ### Steps to Reproduce 1. Run: `grep -rn "type: ignore" src/cleveragents/domain/models/` 2. Observe two violations: - `src/cleveragents/domain/models/core/project_legacy.py:75` - `src/cleveragents/domain/models/core/multi_project.py:178` **Expected**: No `# type: ignore` comments in any domain model file **Actual**: Two `# type: ignore` comments found in domain model files ## Subtasks - [ ] Write a TDD issue-capture Behave scenario (tagged `@tdd_expected_fail`) that fails while the violations exist, demonstrating the bug - [ ] Fix `project_legacy.py` line 75: resolve the underlying `arg-type` Pyright error in the `ProjectSettings` `default_factory` lambda without using `# type: ignore` - [ ] Fix `multi_project.py` line 178: replace the `@computed_field` + `@property` pattern with the correct Pydantic v2 `computed_field` usage that satisfies Pyright without `# type: ignore` - [ ] Remove both `# type: ignore` comments - [ ] Run `nox -e typecheck` and confirm Pyright reports zero errors in both files - [ ] Update the TDD scenario tag from `@tdd_expected_fail` to passing - [ ] Run `nox -e unit_tests` and confirm all Behave scenarios pass - [ ] Run `nox -e coverage_report` and confirm coverage ≥ 97% ## Definition of Done - [ ] Zero `# type: ignore` comments remain in `src/cleveragents/domain/models/core/project_legacy.py` - [ ] Zero `# type: ignore` comments remain in `src/cleveragents/domain/models/core/multi_project.py` - [ ] `nox -e typecheck` passes with no suppression workarounds in either file - [ ] The underlying Pyright type errors are resolved at the source (correct types / correct Pydantic v2 patterns), not silenced - [ ] Behave unit tests cover the corrected field definitions - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog (unchanged)
  • Story Points: 2 — S — Remove # type: ignore comments from domain model files.
  • MoSCoW: Should Have — Per project rules, type suppression is strictly forbidden. These need to be fixed.
  • Parent Epic: #2810 (CI Quality Gates Restoration)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog (unchanged) - **Story Points**: 2 — S — Remove `# type: ignore` comments from domain model files. - **MoSCoW**: Should Have — Per project rules, type suppression is strictly forbidden. These need to be fixed. - **Parent Epic**: #2810 (CI Quality Gates Restoration) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Blocks
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3411
No description provided.