Skip to content

Go SDK: reject a task function whose last result type is not error - #74077

Merged
henry3260 merged 1 commit into
apache:mainfrom
FrankYang0529:airflow-go-sdk-exact-error-result
Oct 3, 2026
Merged

henry3260 merged 1 commit into
apache:mainfrom
FrankYang0529:airflow-go-sdk-exact-error-result

Conversation

@FrankYang0529

Copy link
Copy Markdown
Member

This PR is related to Reject invalid registrations at registration time, which #73549 addressed. That item lists a wrong return shape among the signature errors that should fail at registration. Registration still accepted one kind of signature that makes every run of the task fail.

Why

A task function can declare its last result as a concrete type that implements error like func(airflow.Context) (int, *MyErr). Registration accepts the function. When the task runs, the Go SDK reads the last result into an error value. A nil *MyErr then becomes a non-nil error. So the task fails on every run, even when the function returns nil.

How

Change internal/bundle to require the last result of a task function to have the type error itself.


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Signed-off-by: PoAn Yang <payang@apache.org>
@FrankYang0529
FrankYang0529 marked this pull request as ready for review October 3, 2026 00:06

@henry3260 henry3260 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.

Nice!

@henry3260
henry3260 merged commit 7a8ce83 into apache:main Oct 3, 2026
174 checks passed
@FrankYang0529
FrankYang0529 deleted the airflow-go-sdk-exact-error-result branch October 3, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants