Skip to content

Fix pre-existing pyright type errors in smartem_agent and smartem_common #215

@vredchenko

Description

@vredchenko

Summary

The new release-smartem-agent.yml workflow introduced pyright type checking for src/smartem_agent and src/smartem_common. This revealed 140 pre-existing type errors that were never caught because the main CI workflow had linting commented out (# TODO restore).

Context

  • PR feat: implement smartem-agent release architecture #213 adds the release workflow with pyright checking
  • The main CI workflow (ci.yml) has type checking disabled:
    # TODO restore
    #  lint:
    #    ...
    #    with:
    #      tox: pre-commit,type-checking
  • Current pyright config in pyproject.toml:
    [tool.pyright]
    typeCheckingMode = "standard"
    reportMissingImports = false

Error Categories

The 140 errors fall into several categories:

  1. reportArgumentType - Arguments with None passed where non-optional types expected
  2. reportOptionalMemberAccess - Accessing attributes on potentially None values
  3. reportAttributeAccessIssue - Unknown attributes (e.g., lxml.etree)
  4. reportReturnType - Return type mismatches
  5. reportAssignmentType - Type mismatches in assignments
  6. reportGeneralTypeIssues - Various other type issues

Files Affected

  • src/smartem_agent/event_processor.py
  • src/smartem_agent/fs_parser.py
  • src/smartem_agent/fs_watcher.py
  • src/smartem_agent/model/store.py
  • src/smartem_agent/orphan_manager.py
  • src/smartem_common/schemas.py
  • And others

Recommended Approach

  1. Phase 1: Add proper type annotations to function signatures
  2. Phase 2: Fix reportOptionalMemberAccess errors with proper null checks
  3. Phase 3: Fix reportArgumentType errors by validating inputs
  4. Phase 4: Address remaining miscellaneous errors

Workaround for PR #213

The release workflow's pyright check needs to be relaxed until this technical debt is addressed. Options:

  • Change typeCheckingMode to "basic" temporarily
  • Add specific error codes to ignore in pyproject.toml
  • Remove pyright from the release workflow lint step temporarily

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode restructuring without changing external behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions