Skip to content

[Cherrypick] Fix forward references that do not resolve to types (#41184) - #41243

Merged
jrmccluskey merged 1 commit into
apache:release-2.78from
jrmccluskey:refCherrypick
Nov 12, 2026
Merged

jrmccluskey merged 1 commit into
apache:release-2.78from
jrmccluskey:refCherrypick

Conversation

@jrmccluskey

Copy link
Copy Markdown
Contributor
  • Fix forward references that do not resolve to types

  • yapf

  • Fix extra broken edge cases

  • Apply suggestion from @claudevdm


* Fix forward references that do not resolve to types

* yapf

* Fix extra broken edge cases

* Apply suggestion from @claudevdm

Co-authored-by: claudevdm <33973061+claudevdm@users.noreply.github.com>

---------

Co-authored-by: claudevdm <33973061+claudevdm@users.noreply.github.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR is a clean cherry-pick of #41184 onto the release-2.78 branch to fix a regression where resolved forward references or deferred string annotations that do not convert to valid Beam type hints (such as protobuf EnumTypeWrapper instances or single-argument collections.abc.Generator) raise errors instead of falling back to Any. The implementation in _is_convertible_type_hint and accompanying test suite are thorough and ready to merge.

🔍 General Feedback

  • _is_convertible_type_hint properly validates converted Beam types while preserving resolution for TypeVar, NewType, Literal, Annotated, and Python 3.12 type aliases.
  • Unit and pipeline tests in decorators_test.py and typed_pipeline_test.py thoroughly cover string annotations, from __future__ import annotations, and edge cases.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added python core size/m M: 50-249 lines changed labels Nov 12, 2026
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.82%. Comparing base (3b59922) to head (6079a57).
⚠️ Report is 15 commits behind head on release-2.78.

Files with missing lines Patch % Lines
sdks/python/apache_beam/typehints/decorators.py 90.90% 2 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           release-2.78   #41243       +/-   ##
=================================================
+ Coverage              0   79.82%   +79.82%     
=================================================
  Files                 0      494      +494     
  Lines                 0    83595    +83595     
=================================================
+ Hits                  0    66727    +66727     
- Misses                0    16868    +16868     
Flag Coverage Δ
python 79.82% <90.90%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrmccluskey
jrmccluskey merged commit f3a1631 into apache:release-2.78 Nov 12, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core python size/m M: 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants