UAT: 457 # type: ignore comments in production source code — violates strict no-suppression policy #1631

Open
opened 2026-04-02 23:18:46 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/remove-type-ignore-suppressions
  • Commit Message: fix(typing): remove all type: ignore suppressions from production source
  • Milestone: v3.5.0
  • Parent Epic: #397

Background

The codebase contains 457 occurrences of # type: ignore comments spread across 41 source files. The project specification and CONTRIBUTING.md explicitly forbid the use of # type: ignore or any other mechanism to suppress or disable type-checking errors. This is a direct violation of the code standards.

What was tested:
Static analysis of all Python source files in src/cleveragents/ for # type: ignore comments.

Expected behavior (from spec/CONTRIBUTING.md):

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

Zero # type: ignore comments should exist in production source code.

Actual behavior:
457 # type: ignore comments found across 41 files:

$ grep -r "type: ignore" src/ --include="*.py" -l | wc -l
41

$ grep -r "type: ignore" src/ --include="*.py" -n | wc -l
457

Affected files (41 total):

  • src/cleveragents/a2a/facade.py (5 occurrences — return-value suppressions)
  • src/cleveragents/agents/base.py (2 — rx library attr-defined)
  • src/cleveragents/agents/context_analysis.py (1 — import-not-found)
  • src/cleveragents/agents/graphs/auto_debug.py (1 — attr-defined)
  • src/cleveragents/agents/graphs/context_analysis.py (4 — import-untyped, attr-defined)
  • src/cleveragents/agents/graphs/plan_generation.py (2 — import-untyped, override)
  • src/cleveragents/agents/plan_generation.py (1 — import-not-found)
  • src/cleveragents/application/container.py (2 — mock import suppression)
  • src/cleveragents/application/reactive_registry_adapter.py (1 — attr-defined)
  • src/cleveragents/application/services/_resource_registry_dag.py (2 — override)
  • src/cleveragents/application/services/acms_service.py (3 — dict-item)
  • src/cleveragents/application/services/audit_service.py (7 — arg-type)
  • src/cleveragents/application/services/config_service.py (1 — assignment)
  • src/cleveragents/application/services/decomposition_clustering.py (1 — arg-type)
  • src/cleveragents/application/services/decomposition_service.py (1 — arg-type)
  • src/cleveragents/application/services/permission_service.py (1 — return-value)
  • src/cleveragents/application/services/resource_file_watcher.py (5 — valid-type, union-attr)
  • src/cleveragents/application/services/resource_handler_service.py (2 — assignment)
  • src/cleveragents/application/services/session_service.py (2 — return-value)
  • src/cleveragents/application/services/trace_service.py (1 — import-untyped)
  • src/cleveragents/application/services/validation_pipeline.py (1 — override)
  • src/cleveragents/cli/commands/actor_context.py (2 — assignment)
  • src/cleveragents/cli/commands/plan.py (3 — arg-type)
  • src/cleveragents/cli/commands/project_context.py (1 — no-any-return)
  • src/cleveragents/cli/commands/resource.py (1 — union-attr)
  • src/cleveragents/config/settings.py (2 — override, arg-type)
  • src/cleveragents/domain/models/core/multi_project.py (1 — prop-decorator)
  • src/cleveragents/domain/models/core/project_legacy.py (1 — arg-type)
  • src/cleveragents/infrastructure/database/legacy_migrator.py (1 — bare)
  • src/cleveragents/infrastructure/database/models.py (18 — misc, for SQLAlchemy Base subclasses)
  • src/cleveragents/infrastructure/database/repositories.py (>200 — assignment, union-attr, arg-type)
  • src/cleveragents/infrastructure/sandbox/manager.py (1 — assignment)
  • src/cleveragents/langgraph/bridge.py (2 — bare, attr-defined)
  • src/cleveragents/langgraph/graph.py (3 — attr-defined)
  • src/cleveragents/langgraph/nodes.py (2 — bare)
  • src/cleveragents/langgraph/state.py (2 — attr-defined)
  • src/cleveragents/providers/registry.py (8 — arg-type, import-untyped)
  • src/cleveragents/reactive/application.py (2 — attr-defined, union-attr)
  • src/cleveragents/reactive/route_bridge.py (2 — attr-defined)
  • src/cleveragents/reactive/stream_router.py (8 — attr-defined, override)
  • src/cleveragents/tool/builtins/subplan_tool.py (1 — list-item)

Categories of violations:

  1. Third-party library stubs missing (import-untyped, attr-defined for rx, langgraph, watchdog, langsmith): Should be resolved by adding proper type stubs or stub files in the typings/ directory.
  2. SQLAlchemy ORM attribute access (assignment, union-attr in repositories.py and models.py): Should be resolved by using proper SQLAlchemy 2.0 mapped column types.
  3. Override incompatibilities (override): Should be resolved by fixing the method signatures to match the base class.
  4. Return value mismatches (return-value): Should be resolved by fixing the return types or adding proper type narrowing.
  5. Mock import in production code (container.py): Should be resolved by removing mock code from production.

Steps to reproduce:

grep -r "type: ignore" src/ --include="*.py" -n | wc -l
# Returns: 457

Subtasks

  • Audit all 457 # type: ignore occurrences across 41 files and categorise each by root cause
  • Add proper type stubs or typings/ stub files for untyped third-party libraries (rx, langgraph, watchdog, langsmith)
  • Migrate infrastructure/database/models.py and repositories.py to SQLAlchemy 2.0 Mapped[...] / mapped_column typed ORM patterns to eliminate >200 suppressions
  • Fix all override violations by correcting method signatures to match base-class contracts
  • Fix all return-value and no-any-return violations with proper type narrowing or corrected return annotations
  • Fix all arg-type violations by correcting call-site types or updating function signatures
  • Fix all assignment and union-attr violations with proper type guards or narrowed types
  • Remove mock imports from production code in application/container.py
  • Fix remaining miscellaneous suppressions (bare, dict-item, list-item, prop-decorator, valid-type)
  • Verify nox -e typecheck passes with zero errors and zero # type: ignore comments remaining
  • Update or add Behave unit tests to cover any logic changes introduced during the fix
  • Verify nox -e coverage_report reports coverage ≥ 97%

Definition of Done

  • All subtasks above are checked off
  • Zero # type: ignore comments exist anywhere in src/cleveragents/
  • grep -r "type: ignore" src/ --include="*.py" | wc -l returns 0
  • nox -e typecheck passes with zero Pyright errors
  • nox -e lint passes with no violations
  • nox -e unit_tests passes with all scenarios green
  • nox -e integration_tests passes
  • All nox stages pass
  • Coverage >= 97%
  • Commit created with exact message: fix(typing): remove all type: ignore suppressions from production source
  • Commit pushed to branch fix/remove-type-ignore-suppressions
  • PR successfully merged

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/remove-type-ignore-suppressions` - **Commit Message**: `fix(typing): remove all type: ignore suppressions from production source` - **Milestone**: v3.5.0 - **Parent Epic**: #397 ## Background The codebase contains 457 occurrences of `# type: ignore` comments spread across 41 source files. The project specification and CONTRIBUTING.md explicitly forbid the use of `# type: ignore` or any other mechanism to suppress or disable type-checking errors. This is a direct violation of the code standards. **What was tested:** Static analysis of all Python source files in `src/cleveragents/` for `# type: ignore` comments. **Expected behavior (from spec/CONTRIBUTING.md):** > "The use of `# type: ignore` or any other mechanism to suppress or disable type-checking errors is strictly forbidden." Zero `# type: ignore` comments should exist in production source code. **Actual behavior:** 457 `# type: ignore` comments found across 41 files: ``` $ grep -r "type: ignore" src/ --include="*.py" -l | wc -l 41 $ grep -r "type: ignore" src/ --include="*.py" -n | wc -l 457 ``` **Affected files (41 total):** - `src/cleveragents/a2a/facade.py` (5 occurrences — return-value suppressions) - `src/cleveragents/agents/base.py` (2 — rx library attr-defined) - `src/cleveragents/agents/context_analysis.py` (1 — import-not-found) - `src/cleveragents/agents/graphs/auto_debug.py` (1 — attr-defined) - `src/cleveragents/agents/graphs/context_analysis.py` (4 — import-untyped, attr-defined) - `src/cleveragents/agents/graphs/plan_generation.py` (2 — import-untyped, override) - `src/cleveragents/agents/plan_generation.py` (1 — import-not-found) - `src/cleveragents/application/container.py` (2 — mock import suppression) - `src/cleveragents/application/reactive_registry_adapter.py` (1 — attr-defined) - `src/cleveragents/application/services/_resource_registry_dag.py` (2 — override) - `src/cleveragents/application/services/acms_service.py` (3 — dict-item) - `src/cleveragents/application/services/audit_service.py` (7 — arg-type) - `src/cleveragents/application/services/config_service.py` (1 — assignment) - `src/cleveragents/application/services/decomposition_clustering.py` (1 — arg-type) - `src/cleveragents/application/services/decomposition_service.py` (1 — arg-type) - `src/cleveragents/application/services/permission_service.py` (1 — return-value) - `src/cleveragents/application/services/resource_file_watcher.py` (5 — valid-type, union-attr) - `src/cleveragents/application/services/resource_handler_service.py` (2 — assignment) - `src/cleveragents/application/services/session_service.py` (2 — return-value) - `src/cleveragents/application/services/trace_service.py` (1 — import-untyped) - `src/cleveragents/application/services/validation_pipeline.py` (1 — override) - `src/cleveragents/cli/commands/actor_context.py` (2 — assignment) - `src/cleveragents/cli/commands/plan.py` (3 — arg-type) - `src/cleveragents/cli/commands/project_context.py` (1 — no-any-return) - `src/cleveragents/cli/commands/resource.py` (1 — union-attr) - `src/cleveragents/config/settings.py` (2 — override, arg-type) - `src/cleveragents/domain/models/core/multi_project.py` (1 — prop-decorator) - `src/cleveragents/domain/models/core/project_legacy.py` (1 — arg-type) - `src/cleveragents/infrastructure/database/legacy_migrator.py` (1 — bare) - `src/cleveragents/infrastructure/database/models.py` (18 — misc, for SQLAlchemy Base subclasses) - `src/cleveragents/infrastructure/database/repositories.py` (>200 — assignment, union-attr, arg-type) - `src/cleveragents/infrastructure/sandbox/manager.py` (1 — assignment) - `src/cleveragents/langgraph/bridge.py` (2 — bare, attr-defined) - `src/cleveragents/langgraph/graph.py` (3 — attr-defined) - `src/cleveragents/langgraph/nodes.py` (2 — bare) - `src/cleveragents/langgraph/state.py` (2 — attr-defined) - `src/cleveragents/providers/registry.py` (8 — arg-type, import-untyped) - `src/cleveragents/reactive/application.py` (2 — attr-defined, union-attr) - `src/cleveragents/reactive/route_bridge.py` (2 — attr-defined) - `src/cleveragents/reactive/stream_router.py` (8 — attr-defined, override) - `src/cleveragents/tool/builtins/subplan_tool.py` (1 — list-item) **Categories of violations:** 1. **Third-party library stubs missing** (`import-untyped`, `attr-defined` for rx, langgraph, watchdog, langsmith): Should be resolved by adding proper type stubs or stub files in the `typings/` directory. 2. **SQLAlchemy ORM attribute access** (`assignment`, `union-attr` in `repositories.py` and `models.py`): Should be resolved by using proper SQLAlchemy 2.0 mapped column types. 3. **Override incompatibilities** (`override`): Should be resolved by fixing the method signatures to match the base class. 4. **Return value mismatches** (`return-value`): Should be resolved by fixing the return types or adding proper type narrowing. 5. **Mock import in production code** (`container.py`): Should be resolved by removing mock code from production. **Steps to reproduce:** ```bash grep -r "type: ignore" src/ --include="*.py" -n | wc -l # Returns: 457 ``` ## Subtasks - [ ] Audit all 457 `# type: ignore` occurrences across 41 files and categorise each by root cause - [ ] Add proper type stubs or `typings/` stub files for untyped third-party libraries (rx, langgraph, watchdog, langsmith) - [ ] Migrate `infrastructure/database/models.py` and `repositories.py` to SQLAlchemy 2.0 `Mapped[...]` / `mapped_column` typed ORM patterns to eliminate >200 suppressions - [ ] Fix all `override` violations by correcting method signatures to match base-class contracts - [ ] Fix all `return-value` and `no-any-return` violations with proper type narrowing or corrected return annotations - [ ] Fix all `arg-type` violations by correcting call-site types or updating function signatures - [ ] Fix all `assignment` and `union-attr` violations with proper type guards or narrowed types - [ ] Remove mock imports from production code in `application/container.py` - [ ] Fix remaining miscellaneous suppressions (`bare`, `dict-item`, `list-item`, `prop-decorator`, `valid-type`) - [ ] Verify `nox -e typecheck` passes with zero errors and zero `# type: ignore` comments remaining - [ ] Update or add Behave unit tests to cover any logic changes introduced during the fix - [ ] Verify `nox -e coverage_report` reports coverage ≥ 97% ## Definition of Done - [ ] All subtasks above are checked off - [ ] Zero `# type: ignore` comments exist anywhere in `src/cleveragents/` - [ ] `grep -r "type: ignore" src/ --include="*.py" | wc -l` returns `0` - [ ] `nox -e typecheck` passes with zero Pyright errors - [ ] `nox -e lint` passes with no violations - [ ] `nox -e unit_tests` passes with all scenarios green - [ ] `nox -e integration_tests` passes - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] Commit created with exact message: `fix(typing): remove all type: ignore suppressions from production source` - [ ] Commit pushed to branch `fix/remove-type-ignore-suppressions` - [ ] PR successfully merged --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.5.0 milestone 2026-04-02 23:18:51 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Priority/High (confirmed) — 457 type:ignore violations is a massive code standards breach
  • MoSCoW: MoSCoW/Must Have — CONTRIBUTING.md explicitly states: "The use of # type: ignore or any other mechanism to suppress or disable type-checking errors is strictly forbidden." This is a direct violation of the project's core code standards. With 457 occurrences across 41 files, this represents a systemic compliance failure that must be addressed. Must Have.
  • Milestone: v3.5.0 (confirmed — Autonomy Hardening)
  • Parent Epic: #397

This is a large-scope issue (457 occurrences) that will require significant effort. The bulk of violations (~200+) are in infrastructure/database/repositories.py due to SQLAlchemy ORM patterns. Consider breaking this into sub-issues by category if needed.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Priority/High (confirmed) — 457 type:ignore violations is a massive code standards breach - **MoSCoW**: MoSCoW/Must Have — CONTRIBUTING.md explicitly states: "The use of `# type: ignore` or any other mechanism to suppress or disable type-checking errors is strictly forbidden." This is a direct violation of the project's core code standards. With 457 occurrences across 41 files, this represents a systemic compliance failure that must be addressed. Must Have. - **Milestone**: v3.5.0 (confirmed — Autonomy Hardening) - **Parent Epic**: #397 This is a large-scope issue (457 occurrences) that will require significant effort. The bulk of violations (~200+) are in `infrastructure/database/repositories.py` due to SQLAlchemy ORM patterns. Consider breaking this into sub-issues by category if needed. --- **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
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Depends on
Reference
cleveragents/cleveragents-core#1631
No description provided.