UAT: ADR-004 / CONTRIBUTING.md Violation — 457 instances of # type: ignore suppress Pyright type checking across the codebase #4059

Closed
opened 2026-04-06 09:45:00 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/adr-004-type-ignore-suppressions
  • Commit Message: fix(types): eliminate type: ignore suppressions by fixing underlying type errors
  • Milestone: (none — see Backlog note below)
  • Parent Epic: #2810

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


Bug Report

What was tested: ADR-004 (Data Validation) and CONTRIBUTING.md compliance regarding type checking suppression

Expected behavior (from CONTRIBUTING.md and ADR-004):
CONTRIBUTING.md explicitly states:

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

ADR-004 states:

"Type checking: Pyright in strict mode verifies that Pydantic model field types are consistent across the codebase."

ADR-005 (Technical Stack) specifies Pyright in strict mode (typeCheckingMode = "strict" in pyrightconfig.json).

Actual behavior:
There are 457 instances of # type: ignore comments across the codebase, suppressing Pyright type errors rather than fixing them. This is explicitly forbidden by CONTRIBUTING.md.

Affected files (representative sample):

  • src/cleveragents/infrastructure/database/models.py — 35+ instances (SQLAlchemy ORM model class definitions)
  • src/cleveragents/infrastructure/database/repositories.py — 50+ instances (ORM attribute access)
  • src/cleveragents/providers/registry.py — 10+ instances (LangChain provider instantiation)
  • src/cleveragents/cli/commands/plan.py — 3 instances
  • src/cleveragents/cli/commands/resource.py — 1 instance
  • src/cleveragents/application/services/config_service.py — 1 instance

Steps to reproduce:

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

Root causes identified:

  1. SQLAlchemy ORM models (models.py): class Foo(Base): # type: ignore[misc] — SQLAlchemy's declarative base is not fully typed; proper fix is to use DeclarativeBase from SQLAlchemy 2.0 with proper type stubs
  2. Repository attribute access (repositories.py): db_project.name # type: ignore — ORM model attributes are untyped; fix requires proper SQLAlchemy 2.0 typed column definitions (Mapped[str])
  3. LangChain provider kwargs (registry.py): # type: ignore[arg-type] — LangChain's type stubs are incomplete; fix requires explicit type casting or updated stubs
  4. Pydantic computed fields (multi_project.py): @computed_field # type: ignore[prop-decorator] — Pydantic V2 computed field decorator typing issue; fix requires Pydantic version update or explicit typing

Impact:

  • Type errors are hidden rather than fixed, creating a false sense of type safety
  • The strict Pyright configuration is effectively bypassed for 457 code paths
  • Bugs that Pyright would catch are silently ignored
  • CONTRIBUTING.md's "No Type Suppression" rule is violated at scale

Subtasks

  • Migrate SQLAlchemy models to SQLAlchemy 2.0 Mapped[T] typed syntax
  • Fix repository attribute access typing (use typed ORM columns)
  • Replace # type: ignore[arg-type] in providers with explicit cast() or type stubs
  • Fix Pydantic computed field typing issues
  • Add CI check: grep -r "type: ignore" src/ | wc -l must be 0 (or below a decreasing threshold)
  • Update CONTRIBUTING.md to clarify that cast() is the approved alternative to # type: ignore
  • Tests (Behave): Add scenarios verifying typed ORM model attribute access
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • Zero # type: ignore comments in src/cleveragents/ (except with explicit documented justification approved by maintainers)
  • nox -e typecheck passes without any suppression
  • CI check prevents new # type: ignore additions
  • All subtasks above are completed and checked off
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly: fix(types): eliminate type: ignore suppressions by fixing underlying type errors
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly: fix/adr-004-type-ignore-suppressions
  • The commit is submitted as a pull request to master, reviewed, and merged
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/adr-004-type-ignore-suppressions` - **Commit Message**: `fix(types): eliminate type: ignore suppressions by fixing underlying type errors` - **Milestone**: *(none — see Backlog note below)* - **Parent Epic**: #2810 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- ## Bug Report **What was tested:** ADR-004 (Data Validation) and CONTRIBUTING.md compliance regarding type checking suppression **Expected behavior (from CONTRIBUTING.md and ADR-004):** CONTRIBUTING.md explicitly states: > "**No Type Suppression**: The use of `# type: ignore` or any other mechanism to suppress or disable type checking is strictly forbidden." ADR-004 states: > "**Type checking**: Pyright in strict mode verifies that Pydantic model field types are consistent across the codebase." ADR-005 (Technical Stack) specifies Pyright in strict mode (`typeCheckingMode = "strict"` in `pyrightconfig.json`). **Actual behavior:** There are **457 instances** of `# type: ignore` comments across the codebase, suppressing Pyright type errors rather than fixing them. This is explicitly forbidden by CONTRIBUTING.md. **Affected files (representative sample):** - `src/cleveragents/infrastructure/database/models.py` — 35+ instances (SQLAlchemy ORM model class definitions) - `src/cleveragents/infrastructure/database/repositories.py` — 50+ instances (ORM attribute access) - `src/cleveragents/providers/registry.py` — 10+ instances (LangChain provider instantiation) - `src/cleveragents/cli/commands/plan.py` — 3 instances - `src/cleveragents/cli/commands/resource.py` — 1 instance - `src/cleveragents/application/services/config_service.py` — 1 instance **Steps to reproduce:** ```bash grep -r "type: ignore" src/cleveragents/ --include="*.py" | wc -l # Returns 457 ``` **Root causes identified:** 1. **SQLAlchemy ORM models** (`models.py`): `class Foo(Base): # type: ignore[misc]` — SQLAlchemy's declarative base is not fully typed; proper fix is to use `DeclarativeBase` from SQLAlchemy 2.0 with proper type stubs 2. **Repository attribute access** (`repositories.py`): `db_project.name # type: ignore` — ORM model attributes are untyped; fix requires proper SQLAlchemy 2.0 typed column definitions (`Mapped[str]`) 3. **LangChain provider kwargs** (`registry.py`): `# type: ignore[arg-type]` — LangChain's type stubs are incomplete; fix requires explicit type casting or updated stubs 4. **Pydantic computed fields** (`multi_project.py`): `@computed_field # type: ignore[prop-decorator]` — Pydantic V2 computed field decorator typing issue; fix requires Pydantic version update or explicit typing **Impact:** - Type errors are hidden rather than fixed, creating a false sense of type safety - The strict Pyright configuration is effectively bypassed for 457 code paths - Bugs that Pyright would catch are silently ignored - CONTRIBUTING.md's "No Type Suppression" rule is violated at scale ## Subtasks - [ ] Migrate SQLAlchemy models to SQLAlchemy 2.0 `Mapped[T]` typed syntax - [ ] Fix repository attribute access typing (use typed ORM columns) - [ ] Replace `# type: ignore[arg-type]` in providers with explicit `cast()` or type stubs - [ ] Fix Pydantic computed field typing issues - [ ] Add CI check: `grep -r "type: ignore" src/ | wc -l` must be 0 (or below a decreasing threshold) - [ ] Update CONTRIBUTING.md to clarify that `cast()` is the approved alternative to `# type: ignore` - [ ] Tests (Behave): Add scenarios verifying typed ORM model attribute access - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] Zero `# type: ignore` comments in `src/cleveragents/` (except with explicit documented justification approved by maintainers) - [ ] `nox -e typecheck` passes without any suppression - [ ] CI check prevents new `# type: ignore` additions - [ ] All subtasks above are completed and checked off - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly: `fix(types): eliminate type: ignore suppressions by fixing underlying type errors` - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly: `fix/adr-004-type-ignore-suppressions` - [ ] The commit is submitted as a **pull request** to `master`, reviewed, and **merged** - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Duplicate of #3845

This issue covers the same problem as #3845: widespread use of # type: ignore suppressions in production code violating the project's strict no-suppression policy. Issue #3845 was filed earlier (2026-04-06T06:55:28Z vs this issue at 2026-04-06T09:45:00Z) and covers the same 448-457 instances across the same files. Closing as a duplicate — please track the fix in #3845.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

**Duplicate of #3845** This issue covers the same problem as #3845: widespread use of `# type: ignore` suppressions in production code violating the project's strict no-suppression policy. Issue #3845 was filed earlier (2026-04-06T06:55:28Z vs this issue at 2026-04-06T09:45:00Z) and covers the same 448-457 instances across the same files. Closing as a duplicate — please track the fix in #3845. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
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#4059
No description provided.