UAT: Prohibited # type: ignore suppression comments found in providers/registry.py — 11 violations in provider factory methods #4087

Open
opened 2026-04-06 10:12:40 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/providers-remove-type-ignore-registry
  • Commit Message: fix(providers): remove prohibited type: ignore suppressions from providers/registry.py
  • Milestone: (none — backlog)
  • Parent Epic: #3365 (Epic: Additional LLM Provider Integrations — Cohere, Groq, Together AI, and Provider Abstraction)

Backlog note: This issue was discovered during autonomous UAT testing
on the LLM Provider Integration feature area. 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: LLM provider registry code against CONTRIBUTING.md type-checking rules

Expected behavior (from CONTRIBUTING.md):

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

All code must pass nox -e typecheck (Pyright) without any type suppression comments.

Actual behavior (from code analysis):

src/cleveragents/providers/registry.py contains 11 prohibited # type: ignore comments in the _create_provider_llm() method:

Line Violation
475 return ChatOpenAI(model=model_id or "gpt-4o", **kwargs) # type: ignore[arg-type]
482 **kwargs, # type: ignore[arg-type] (ChatAnthropic)
490 **kwargs, # type: ignore[arg-type] (ChatGoogleGenerativeAI)
525 **kwargs, # type: ignore[arg-type] (AzureChatOpenAI)
529 from langchain_groq import ChatGroq # type: ignore[import-untyped]
533 **kwargs, # type: ignore[arg-type] (ChatGroq)
537 from langchain_together import ChatTogether # type: ignore[import-untyped]
541 **kwargs, # type: ignore[arg-type] (ChatTogether)
545 from langchain_cohere import ChatCohere # type: ignore[import-untyped]
549 **kwargs, # type: ignore[arg-type] (ChatCohere)
657 ) # type: ignore[arg-type] (in create_ai_provider)

The root cause is that _create_provider_llm accepts **kwargs: Any but passes it to LangChain constructors that have typed signatures. The fix should use properly typed **kwargs or create typed wrapper functions for each provider.

Additionally, src/cleveragents/application/container.py contains 2 more violations:

  • Line 199: from mocks.mock_ai_provider import MockAIProvider # type: ignore
  • Line 201: return MockAIProvider() # type: ignore

Code location:

  • src/cleveragents/providers/registry.py_create_provider_llm() method (lines 471-552) and create_ai_provider() (line 657)
  • src/cleveragents/application/container.pyget_ai_provider() function (lines 199, 201)

Steps to reproduce:

  1. Run grep -n "# type: ignore" src/cleveragents/providers/registry.py
  2. Observe: 11 prohibited type suppression comments

Severity: Medium — violates the project's strict no-type-suppression rule. These suppressions hide real type errors that should be fixed properly.

Subtasks

  • Write failing Behave scenario that checks for absence of # type: ignore in provider files
  • Fix _create_provider_llm to use properly typed kwargs for each provider
  • Add py.typed stubs or type annotations for langchain_groq, langchain_together, langchain_cohere
  • Fix container.py mock provider import to use proper typing
  • Verify nox -e typecheck passes with no suppressions
  • Run nox (all default sessions)

Definition of Done

  • Zero # type: ignore comments in providers/registry.py
  • Zero # type: ignore comments in application/container.py for mock provider
  • nox -e typecheck passes with no suppressions
  • All existing provider tests continue to pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/providers-remove-type-ignore-registry` - **Commit Message**: `fix(providers): remove prohibited type: ignore suppressions from providers/registry.py` - **Milestone**: *(none — backlog)* - **Parent Epic**: #3365 (Epic: Additional LLM Provider Integrations — Cohere, Groq, Together AI, and Provider Abstraction) > **Backlog note:** This issue was discovered during autonomous UAT testing > on the LLM Provider Integration feature area. 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:** LLM provider registry code against CONTRIBUTING.md type-checking rules **Expected behavior (from CONTRIBUTING.md):** > "The use of `# type: ignore` or any other mechanism to disable or bypass type-checking is strictly forbidden." All code must pass `nox -e typecheck` (Pyright) without any type suppression comments. **Actual behavior (from code analysis):** `src/cleveragents/providers/registry.py` contains **11 prohibited `# type: ignore` comments** in the `_create_provider_llm()` method: | Line | Violation | |------|-----------| | 475 | `return ChatOpenAI(model=model_id or "gpt-4o", **kwargs) # type: ignore[arg-type]` | | 482 | `**kwargs, # type: ignore[arg-type]` (ChatAnthropic) | | 490 | `**kwargs, # type: ignore[arg-type]` (ChatGoogleGenerativeAI) | | 525 | `**kwargs, # type: ignore[arg-type]` (AzureChatOpenAI) | | 529 | `from langchain_groq import ChatGroq # type: ignore[import-untyped]` | | 533 | `**kwargs, # type: ignore[arg-type]` (ChatGroq) | | 537 | `from langchain_together import ChatTogether # type: ignore[import-untyped]` | | 541 | `**kwargs, # type: ignore[arg-type]` (ChatTogether) | | 545 | `from langchain_cohere import ChatCohere # type: ignore[import-untyped]` | | 549 | `**kwargs, # type: ignore[arg-type]` (ChatCohere) | | 657 | `) # type: ignore[arg-type]` (in `create_ai_provider`) | The root cause is that `_create_provider_llm` accepts `**kwargs: Any` but passes it to LangChain constructors that have typed signatures. The fix should use properly typed `**kwargs` or create typed wrapper functions for each provider. Additionally, `src/cleveragents/application/container.py` contains 2 more violations: - Line 199: `from mocks.mock_ai_provider import MockAIProvider # type: ignore` - Line 201: `return MockAIProvider() # type: ignore` **Code location:** - `src/cleveragents/providers/registry.py` — `_create_provider_llm()` method (lines 471-552) and `create_ai_provider()` (line 657) - `src/cleveragents/application/container.py` — `get_ai_provider()` function (lines 199, 201) **Steps to reproduce:** 1. Run `grep -n "# type: ignore" src/cleveragents/providers/registry.py` 2. Observe: 11 prohibited type suppression comments **Severity:** Medium — violates the project's strict no-type-suppression rule. These suppressions hide real type errors that should be fixed properly. ## Subtasks - [ ] Write failing Behave scenario that checks for absence of `# type: ignore` in provider files - [ ] Fix `_create_provider_llm` to use properly typed kwargs for each provider - [ ] Add `py.typed` stubs or type annotations for `langchain_groq`, `langchain_together`, `langchain_cohere` - [ ] Fix `container.py` mock provider import to use proper typing - [ ] Verify `nox -e typecheck` passes with no suppressions - [ ] Run `nox` (all default sessions) ## Definition of Done - [ ] Zero `# type: ignore` comments in `providers/registry.py` - [ ] Zero `# type: ignore` comments in `application/container.py` for mock provider - [ ] `nox -e typecheck` passes with no suppressions - [ ] All existing provider tests continue to pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:11:15 +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#4087
No description provided.