actor.py add command uses forbidden type: ignore[assignment] comment on schema_version extraction #8403

Open
opened 2026-04-13 18:40:26 +00:00 by HAL9000 · 1 comment
Owner

Metadata

Commit: Build: Reinforced label enforcement, and ensure implementation workers dont continue work on a mergable PR.
Branch: main

Background and Context

In src/cleveragents/cli/commands/actor.py, the add() command contains a # type: ignore[assignment] comment on the line that extracts schema_version from the config blob. Per the project's Code Quality Standards, type: ignore comments are FORBIDDEN. The comment suppresses a legitimate type mismatch that should instead be resolved with proper type narrowing.

Code evidence (actor.py, add command body):

# Extract schema_version from the parsed config blob if present.
schema_version: str | None = config_blob.get("schema_version")  # type: ignore[assignment]
if schema_version and not isinstance(schema_version, str):
    schema_version = str(schema_version)

The type: ignore[assignment] is used because dict.get() returns Any and the annotated type is str | None. The correct fix is to use explicit type narrowing (e.g., cast or an isinstance check) rather than suppressing the type error.

Expected Behavior

Per the Code Quality Standards: type: ignore comments are FORBIDDEN. The schema_version extraction should use proper type narrowing without suppressing type errors. For example:

raw_version = config_blob.get("schema_version")
schema_version: str | None = str(raw_version) if raw_version is not None else None

Acceptance Criteria

  • The # type: ignore[assignment] comment is removed from actor.py
  • schema_version extraction uses proper type narrowing (e.g., explicit cast, isinstance, or conditional str() conversion)
  • pyright / mypy type checking passes on actor.py without type: ignore suppressions
  • Existing BDD tests for agents actor add continue to pass

Subtasks

  • Remove # type: ignore[assignment] from the schema_version extraction line in add()
  • Replace with proper type narrowing (e.g., raw = config_blob.get("schema_version"); schema_version = str(raw) if raw is not None else None)
  • Run nox -s typecheck to confirm no new type errors
  • Verify existing agents actor add BDD scenarios pass

Definition of Done

The issue is closed when actor.py contains no type: ignore comments, type checking passes cleanly, and all existing tests pass.


Automated by CleverAgents Bot
Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor

## Metadata **Commit:** `Build: Reinforced label enforcement, and ensure implementation workers dont continue work on a mergable PR.` **Branch:** `main` ## Background and Context In `src/cleveragents/cli/commands/actor.py`, the `add()` command contains a `# type: ignore[assignment]` comment on the line that extracts `schema_version` from the config blob. Per the project's Code Quality Standards, `type: ignore` comments are **FORBIDDEN**. The comment suppresses a legitimate type mismatch that should instead be resolved with proper type narrowing. **Code evidence** (actor.py, `add` command body): ```python # Extract schema_version from the parsed config blob if present. schema_version: str | None = config_blob.get("schema_version") # type: ignore[assignment] if schema_version and not isinstance(schema_version, str): schema_version = str(schema_version) ``` The `type: ignore[assignment]` is used because `dict.get()` returns `Any` and the annotated type is `str | None`. The correct fix is to use explicit type narrowing (e.g., `cast` or an `isinstance` check) rather than suppressing the type error. ## Expected Behavior Per the Code Quality Standards: `type: ignore` comments are FORBIDDEN. The `schema_version` extraction should use proper type narrowing without suppressing type errors. For example: ```python raw_version = config_blob.get("schema_version") schema_version: str | None = str(raw_version) if raw_version is not None else None ``` ## Acceptance Criteria - [ ] The `# type: ignore[assignment]` comment is removed from `actor.py` - [ ] `schema_version` extraction uses proper type narrowing (e.g., explicit `cast`, `isinstance`, or conditional `str()` conversion) - [ ] `pyright` / `mypy` type checking passes on `actor.py` without `type: ignore` suppressions - [ ] Existing BDD tests for `agents actor add` continue to pass ## Subtasks - [ ] Remove `# type: ignore[assignment]` from the `schema_version` extraction line in `add()` - [ ] Replace with proper type narrowing (e.g., `raw = config_blob.get("schema_version"); schema_version = str(raw) if raw is not None else None`) - [ ] Run `nox -s typecheck` to confirm no new type errors - [ ] Verify existing `agents actor add` BDD scenarios pass ## Definition of Done The issue is closed when `actor.py` contains no `type: ignore` comments, type checking passes cleanly, and all existing tests pass. --- **Automated by CleverAgents Bot** Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor
HAL9000 added this to the v3.2.0 milestone 2026-04-13 19:17:55 +00:00
Author
Owner

Verifiedtype: ignore[assignment] is forbidden per project architecture rules. MoSCoW: Must Have for v3.2.0 — architecture compliance is enforced by the guard system. [AUTO-OWNR-1]


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

✅ **Verified** — `type: ignore[assignment]` is forbidden per project architecture rules. **MoSCoW: Must Have** for v3.2.0 — architecture compliance is enforced by the guard system. [AUTO-OWNR-1] --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8403
No description provided.