Skip to content

feat: enforce mypy type checking across all source files#335

Open
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:feat/mypy-type-checking
Open

feat: enforce mypy type checking across all source files#335
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:feat/mypy-type-checking

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Mar 13, 2026

Issue #, if available: #167

Description of changes:

Problem

There is no static analysis run to determine type mismatches to catch "obvious" bugs/errors. Additionally, the SDK has a mypy config and a py.typed marker but mypy is never run — not in CI, not in pre-commit. There are 211 type errors across 21 source files.

mypy appears to be a standard already used by other teams and projects. Ex. strands-agents already enforces mypy.

Solution

  • Add type annotations and add uv run mypy src/ to the CI lint job.
  • Avoid any changes that could affect runtime logic — every change is either a type annotation or a # type: ignore[error-code] suppression.

Significant # type: ignore directives remain for issues that can't be fixed without logic changes (boto3 returns Any, strands type mismatches, TypedDict method limitations). These can be fixed as a follow-up, but carry risks for code that is not covered by integration tests.

Testing

  • ran mypy locally via uv run mypy src/.
  • lint/format CI job ran this against PR.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 99.39024% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@11e2ac5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/bedrock_agentcore/memory/client.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #335   +/-   ##
=======================================
  Coverage        ?   90.85%           
=======================================
  Files           ?       42           
  Lines           ?     4048           
  Branches        ?      624           
=======================================
  Hits            ?     3678           
  Misses          ?      203           
  Partials        ?      167           
Flag Coverage Δ
unittests 90.85% <99.39%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hweinstock Hweinstock force-pushed the feat/mypy-type-checking branch from e1f6ca0 to a132fb9 Compare March 13, 2026 13:38
@Hweinstock Hweinstock marked this pull request as ready for review March 13, 2026 13:51
@Hweinstock Hweinstock requested a review from a team March 13, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants