UAT: 448 # type: ignore suppressions in production code violate the strict no-suppression policy #3845

Open
opened 2026-04-06 06:55:28 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/remove-type-ignore-suppressions
  • Commit Message: fix(types): remove all # type: ignore suppressions from production code
  • Milestone: Backlog
  • Parent Epic: #2810

Background

The project specification and CONTRIBUTING.md strictly forbid the use of # type: ignore or any other mechanism to suppress type-checking errors:

"The use of # type: ignore or any other mechanism to suppress type-checking errors is strictly forbidden."

A scan of src/cleveragents/ reveals 448 occurrences of # type: ignore across multiple files.

Affected Files

The violations are concentrated in the following files:

File Approximate Count
src/cleveragents/infrastructure/database/repositories.py ~364 occurrences
src/cleveragents/application/services/audit_service.py 8 occurrences
src/cleveragents/application/services/resource_file_watcher.py 7 occurrences
src/cleveragents/application/services/acms_service.py 4 occurrences
src/cleveragents/cli/commands/plan.py 3 occurrences
src/cleveragents/cli/commands/actor_context.py 2 occurrences
src/cleveragents/application/services/session_service.py 2 occurrences
src/cleveragents/application/services/resource_handler_service.py 2 occurrences
src/cleveragents/application/container.py 2 occurrences
src/cleveragents/domain/models/core/multi_project.py 1 occurrence
src/cleveragents/domain/models/core/project_legacy.py 1 occurrence
src/cleveragents/application/services/config_service.py 1 occurrence
src/cleveragents/application/services/validation_pipeline.py 1 occurrence
src/cleveragents/application/services/decomposition_service.py 1 occurrence
src/cleveragents/application/services/trace_service.py 1 occurrence
src/cleveragents/application/services/decomposition_clustering.py 1 occurrence
src/cleveragents/application/services/permission_service.py 1 occurrence
src/cleveragents/application/reactive_registry_adapter.py 1 occurrence
src/cleveragents/cli/commands/resource.py 1 occurrence
src/cleveragents/cli/commands/project_context.py 1 occurrence
src/cleveragents/cli/commands/actor.py 1 occurrence

Root Cause

The bulk of violations (364 out of 448) are in infrastructure/database/repositories.py, where SQLAlchemy ORM model attributes are accessed without proper type stubs or typed column definitions. The fix requires either:

  1. Adding proper SQLAlchemy type stubs (via sqlalchemy-stubs or sqlalchemy2-stubs)
  2. Using cast() with explicit types instead of # type: ignore
  3. Properly typing the ORM model columns with Mapped[T] annotations

The remaining violations in other files are due to untyped third-party libraries (watchdog, langsmith) and legitimate type narrowing issues that should be resolved with proper cast() calls or protocol definitions.

Steps to Reproduce

grep -r "# type: ignore" src/cleveragents/ --include="*.py" | wc -l
# Output: 448

Expected Behavior

Zero occurrences of # type: ignore in src/cleveragents/. All type errors must be resolved properly by fixing the underlying type issues, not suppressed.

Actual Behavior

448 occurrences of # type: ignore exist in production code, violating the project's strict type safety policy.

Subtasks

  • Audit all 448 # type: ignore occurrences and categorise by root cause (missing stubs, untyped third-party, incorrect narrowing, etc.)
  • Fix infrastructure/database/repositories.py: migrate all ~364 SQLAlchemy column accesses to Mapped[T] annotations or add sqlalchemy2-stubs
  • Fix application/services/audit_service.py: resolve 8 suppressions with proper typing or cast()
  • Fix application/services/resource_file_watcher.py: resolve 7 suppressions (likely watchdog stubs)
  • Fix remaining 69 suppressions across all other affected files
  • Run nox -e typecheck and confirm zero Pyright errors with no suppressions
  • Run nox -e unit_tests and confirm all Behave BDD scenarios pass
  • Run nox -e coverage_report and confirm coverage >= 97%
  • Run full nox suite (all default sessions) with zero failures
  • Verify zero # type: ignore occurrences remain: grep -r "# type: ignore" src/cleveragents/ --include="*.py" | wc -l outputs 0

Definition of Done

  • All # type: ignore suppressions removed from src/cleveragents/
  • Underlying type errors resolved properly (proper typing, cast(), or stubs)
  • nox -e typecheck passes with zero errors
  • All nox stages pass
  • Coverage >= 97%
  • PR merged

Backlog note: This issue was discovered during autonomous operation
on milestone Backlog. 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: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/remove-type-ignore-suppressions` - **Commit Message**: `fix(types): remove all # type: ignore suppressions from production code` - **Milestone**: Backlog - **Parent Epic**: #2810 ## Background The project specification and CONTRIBUTING.md strictly forbid the use of `# type: ignore` or any other mechanism to suppress type-checking errors: > "The use of `# type: ignore` or any other mechanism to suppress type-checking errors is strictly forbidden." A scan of `src/cleveragents/` reveals **448 occurrences** of `# type: ignore` across multiple files. ## Affected Files The violations are concentrated in the following files: | File | Approximate Count | |------|-------------------| | `src/cleveragents/infrastructure/database/repositories.py` | ~364 occurrences | | `src/cleveragents/application/services/audit_service.py` | 8 occurrences | | `src/cleveragents/application/services/resource_file_watcher.py` | 7 occurrences | | `src/cleveragents/application/services/acms_service.py` | 4 occurrences | | `src/cleveragents/cli/commands/plan.py` | 3 occurrences | | `src/cleveragents/cli/commands/actor_context.py` | 2 occurrences | | `src/cleveragents/application/services/session_service.py` | 2 occurrences | | `src/cleveragents/application/services/resource_handler_service.py` | 2 occurrences | | `src/cleveragents/application/container.py` | 2 occurrences | | `src/cleveragents/domain/models/core/multi_project.py` | 1 occurrence | | `src/cleveragents/domain/models/core/project_legacy.py` | 1 occurrence | | `src/cleveragents/application/services/config_service.py` | 1 occurrence | | `src/cleveragents/application/services/validation_pipeline.py` | 1 occurrence | | `src/cleveragents/application/services/decomposition_service.py` | 1 occurrence | | `src/cleveragents/application/services/trace_service.py` | 1 occurrence | | `src/cleveragents/application/services/decomposition_clustering.py` | 1 occurrence | | `src/cleveragents/application/services/permission_service.py` | 1 occurrence | | `src/cleveragents/application/reactive_registry_adapter.py` | 1 occurrence | | `src/cleveragents/cli/commands/resource.py` | 1 occurrence | | `src/cleveragents/cli/commands/project_context.py` | 1 occurrence | | `src/cleveragents/cli/commands/actor.py` | 1 occurrence | ## Root Cause The bulk of violations (364 out of 448) are in `infrastructure/database/repositories.py`, where SQLAlchemy ORM model attributes are accessed without proper type stubs or typed column definitions. The fix requires either: 1. Adding proper SQLAlchemy type stubs (via `sqlalchemy-stubs` or `sqlalchemy2-stubs`) 2. Using `cast()` with explicit types instead of `# type: ignore` 3. Properly typing the ORM model columns with `Mapped[T]` annotations The remaining violations in other files are due to untyped third-party libraries (`watchdog`, `langsmith`) and legitimate type narrowing issues that should be resolved with proper `cast()` calls or protocol definitions. ## Steps to Reproduce ```bash grep -r "# type: ignore" src/cleveragents/ --include="*.py" | wc -l # Output: 448 ``` ## Expected Behavior Zero occurrences of `# type: ignore` in `src/cleveragents/`. All type errors must be resolved properly by fixing the underlying type issues, not suppressed. ## Actual Behavior 448 occurrences of `# type: ignore` exist in production code, violating the project's strict type safety policy. ## Subtasks - [ ] Audit all 448 `# type: ignore` occurrences and categorise by root cause (missing stubs, untyped third-party, incorrect narrowing, etc.) - [ ] Fix `infrastructure/database/repositories.py`: migrate all ~364 SQLAlchemy column accesses to `Mapped[T]` annotations or add `sqlalchemy2-stubs` - [ ] Fix `application/services/audit_service.py`: resolve 8 suppressions with proper typing or `cast()` - [ ] Fix `application/services/resource_file_watcher.py`: resolve 7 suppressions (likely `watchdog` stubs) - [ ] Fix remaining 69 suppressions across all other affected files - [ ] Run `nox -e typecheck` and confirm zero Pyright errors with no suppressions - [ ] Run `nox -e unit_tests` and confirm all Behave BDD scenarios pass - [ ] Run `nox -e coverage_report` and confirm coverage >= 97% - [ ] Run full `nox` suite (all default sessions) with zero failures - [ ] Verify zero `# type: ignore` occurrences remain: `grep -r "# type: ignore" src/cleveragents/ --include="*.py" | wc -l` outputs `0` ## Definition of Done - [ ] All `# type: ignore` suppressions removed from `src/cleveragents/` - [ ] Underlying type errors resolved properly (proper typing, `cast()`, or stubs) - [ ] `nox -e typecheck` passes with zero errors - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] PR merged > **Backlog note:** This issue was discovered during autonomous operation > on milestone Backlog. 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: UAT Testing | Agent: ca-new-issue-creator
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#3845
No description provided.