Repository navigation
Add Go SDK capability manifest and compatibility matrix #71753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
70a81c6
Add Go SDK capability manifest and compatibility matrix
jason810496 a8e1934
Keep Go SDK compatibility claims accurate
jason810496 7fe898b
Keep Go SDK compatibility validation reliable
jason810496 fb27292
Distinguish a missing/renamed schema version constant from a real mis…
jason810496 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| --- | ||
| sdk: go | ||
|
|
||
| min_airflow_version: "3.4" | ||
|
|
||
| # Keep in sync with SupervisorSchemaVersion in pkg/execution/messages.go, which is embedded in | ||
| # bundle metadata. The render hook fails if the two disagree. | ||
| supervisor_schema_version: "2026-10-30" | ||
|
|
||
| # The task runner terminates a task with SucceedTask, RetryTask, or TaskState (failed/removed); it | ||
| # does not yet emit skipped, DeferTask, RescheduleTask, or AwaitInputTask. | ||
| states: | ||
| success: | ||
| supported: true | ||
| since: "3.3" | ||
| failed: | ||
| supported: true | ||
| since: "3.3" | ||
| up_for_retry: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "RetryTask" | ||
| skipped: | ||
| supported: false | ||
| note: "runtime does not emit TaskState skipped yet" | ||
| deferred: | ||
| supported: false | ||
| note: "runtime does not emit DeferTask yet" | ||
| up_for_reschedule: | ||
| supported: false | ||
| note: "runtime does not emit RescheduleTask yet" | ||
| awaiting_input: | ||
| supported: false | ||
| note: "runtime does not emit AwaitInputTask yet" | ||
| removed: | ||
| supported: true | ||
| since: "3.3" | ||
|
|
||
| # Runtime capabilities reflect the task-facing CoordinatorClient surface; native-Dag authoring is | ||
| # not implemented yet, so every native capability is unsupported. | ||
| capabilities: | ||
| mixed-lang-stub-target: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "@task.stub" | ||
| task-logging: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "slog records streamed over the logs socket" | ||
| xcom-read-write: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "PushXCom / GetXCom" | ||
| connection-read: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "GetConnection" | ||
| variable-read-write: | ||
| supported: false | ||
| note: "GetVariable only; no write over the comm socket yet" | ||
| self-contained-bundle: | ||
| supported: true | ||
| since: "3.3" | ||
| note: "AFBNDL01 native binary via airflow-go-pack" | ||
| retry-policy: | ||
| supported: false | ||
| note: "no task-facing retry-policy API yet" | ||
| task-state-store: | ||
| supported: false | ||
| note: "no task-facing state-store API yet" | ||
| asset-state-store: | ||
| supported: false | ||
| note: "no task-facing state-store API yet" | ||
| asset-event-emit: | ||
| supported: false | ||
| note: "runtime does not emit asset events yet" | ||
| asset-event-read: | ||
| supported: false | ||
| note: "no task-facing asset-event API yet" | ||
| native-dag-authoring: | ||
| supported: false | ||
| note: "native Dag authoring not implemented yet" | ||
| task-args: | ||
| supported: false | ||
| dag-params: | ||
| supported: false | ||
| taskflow-dependencies: | ||
| supported: false | ||
| branching: | ||
| supported: false | ||
| dag-test: | ||
| supported: false | ||
| task-group: | ||
| supported: false | ||
| dynamic-task-mapping: | ||
| supported: false | ||
| asset-inlets-outlets: | ||
| supported: false | ||
| asset-scheduling: | ||
| supported: false | ||
| object-store: | ||
| supported: false | ||
| note: "no object-storage API yet" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/usr/bin/env python | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # /// script | ||
| # requires-python = ">=3.10,<3.11" | ||
| # dependencies = ["PyYAML>=6.0", "rich>=13.6.0"] | ||
| # /// | ||
| """Regenerate the Go SDK compatibility table in ``go-sdk/README.md``. | ||
|
|
||
| Renders the Markdown matrix from ``go-sdk/capabilities.yaml`` between the AUTO-GENERATED markers. | ||
| Exits non-zero when the file changed so the contributor re-stages it. The hook also verifies that | ||
| the manifest's supervisor schema version matches the Go runtime constant embedded in bundle metadata. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import re | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).resolve().parent)) | ||
|
|
||
| from common_prek_utils import console, insert_documentation | ||
| from lang_sdk_compat_matrix import ( | ||
| AIRFLOW_ROOT_PATH, | ||
| LANG_SDKS, | ||
| README_MATRIX_FOOTER, | ||
| README_MATRIX_HEADER, | ||
| CapabilitiesDoc, | ||
| load_capabilities, | ||
| render_markdown_table, | ||
| ) | ||
|
|
||
| SDK_ID = "go" | ||
| GO_MESSAGES = AIRFLOW_ROOT_PATH / "go-sdk" / "pkg" / "execution" / "messages.go" | ||
| SCHEMA_VERSION_PATTERN = re.compile( | ||
| r'^\s*(?:const\s+)?SupervisorSchemaVersion(?:\s+[A-Za-z_]\w*(?:\.\w+)*)?\s*=\s*"(?P<version>[^"]+)"' | ||
| ) | ||
|
|
||
|
|
||
| def read_go_schema_version() -> str | None: | ||
| """Read ``SupervisorSchemaVersion`` from the Go runtime source.""" | ||
| for line in GO_MESSAGES.read_text().splitlines(): | ||
| if match := SCHEMA_VERSION_PATTERN.match(line): | ||
| return match.group("version") | ||
| return None | ||
|
|
||
|
|
||
| def check_schema_version(doc: CapabilitiesDoc) -> bool: | ||
| """Whether the manifest agrees with the schema version embedded in Go bundle metadata.""" | ||
| try: | ||
| go_version = read_go_schema_version() | ||
| except OSError as error: | ||
| console.print(f"[red]Could not read {GO_MESSAGES}: {error}[/]") | ||
| return False | ||
| if go_version is None: | ||
| console.print( | ||
| "[red]Could not read SupervisorSchemaVersion from go-sdk/pkg/execution/messages.go: " | ||
| "the constant is missing, or its declaration no longer matches this hook's pattern. " | ||
| "Restore the constant, or update SCHEMA_VERSION_PATTERN if the declaration changed. " | ||
| "Editing go-sdk/capabilities.yaml cannot fix this.[/]" | ||
| ) | ||
| return False | ||
| declared = doc["supervisor_schema_version"] | ||
| if go_version == declared: | ||
| return True | ||
| console.print( | ||
| f"[red]go-sdk/capabilities.yaml declares supervisor_schema_version {declared!r} but " | ||
| f"pkg/execution/messages.go SupervisorSchemaVersion is {go_version!r}. " | ||
| "Update capabilities.yaml to match.[/]" | ||
| ) | ||
| return False | ||
|
|
||
|
|
||
| def main() -> int: | ||
| sdk = next(entry for entry in LANG_SDKS if entry["id"] == SDK_ID) | ||
| doc = load_capabilities(sdk["capabilities_yaml"], expected_sdk=SDK_ID) | ||
| if not check_schema_version(doc): | ||
| return 1 | ||
| changed = insert_documentation( | ||
| sdk["readme"], | ||
| render_markdown_table(doc), | ||
| README_MATRIX_HEADER, | ||
| README_MATRIX_FOOTER, | ||
| extra_information="the Go SDK compatibility matrix", | ||
| ) | ||
| if changed: | ||
| console.print( | ||
| "[yellow]Regenerated the Go SDK compatibility matrix in go-sdk/README.md; re-stage it.[/]" | ||
| ) | ||
| return 1 | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ in ("__main__", "__mp_main__"): | ||
| raise SystemExit(main()) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.