Skip to content

refactor: use Mapping[str, str] for read-only base_sources parameter #858

@Aureliolo

Description

@Aureliolo

Summary

The SemanticAnalyzer protocol and all implementations accept base_sources: dict[str, str] but never mutate it. Using Mapping[str, str] would express the read-only contract at the type level.

Finding source

Pre-PR review agents (type-design-analyzer) flagged this during #611 review.

Scope

  • Change base_sources parameter type from dict[str, str] to Mapping[str, str] in:
    • SemanticAnalyzer protocol
    • AstSemanticAnalyzer.analyze
    • LlmSemanticAnalyzer.analyze
    • CompositeSemanticAnalyzer.analyze
    • All four check functions in semantic_checks.py
  • Add from collections.abc import Mapping imports

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:smallLess than 1 day of worktype:refactorCode restructuring, cleanupv0.5Minor version v0.5

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions