Go SDK: ADRs for bundle packing and coordinator-protocol runtime#67153
Open
jason810496 wants to merge 5 commits into
Open
Go SDK: ADRs for bundle packing and coordinator-protocol runtime#67153jason810496 wants to merge 5 commits into
jason810496 wants to merge 5 commits into
Conversation
This was referenced May 19, 2026
Member
Author
|
The CI failure should be fixed after the dependent PRs get merged and rebase. |
jason810496
commented
May 19, 2026
| 2. **Extend `bundlev1server.Serve` with `--dump-bundle-spec`.** The | ||
| flag prints a JSON document of the form: | ||
|
|
||
| ```json |
Member
Author
There was a problem hiding this comment.
We could define the JSON schema of the airflow-metadata.yaml format either in this PR or the next one.
It was added in 478edab#diff-82337e6c6586f2c271a1457ae2f45acf563aa7b75ce82a78f163cf78690c91b4
| 3. **Bundle authors register the packer in their own `go.mod`:** | ||
|
|
||
| ``` | ||
| tool github.com/apache/airflow/go-sdk/cmd/airflow-go-pack |
Member
Author
There was a problem hiding this comment.
The release management issue is tracked in #66938
| ### Footer layout | ||
|
|
||
| A bundle file is laid out as: | ||
|
|
Member
Author
There was a problem hiding this comment.
The user-facing doc regarding the executable bundle spec was added in 478edab#diff-0f63500bac12820edd728da72331356b8546a8d571ed949df07a96e1085b835d
| +---------------------------------+ <- EOF | ||
| ``` | ||
|
|
||
| `AFBNDL01` is `0x41 0x46 0x42 0x4E 0x44 0x4C 0x30 0x31`. The two |
Member
Author
There was a problem hiding this comment.
The AFBNDL01 magic represents Airflow BuNDLe version 01, we could change it to anything anyway.
…ocumentation and codebase
…etadata and source
a8f9a29 to
d65167d
Compare
1 task
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Final shape of the Go SDK after these ADRs land
Bundle artefact: one self-contained executable
A Go SDK bundle is a single native executable file. It runs directly;
no archive, no extraction, no per-bundle cache directory.
A footer is appended after the OS-defined end of the binary, carrying
the DAG source bytes and the
airflow-metadata.yamlmanifest, with a32-byte trailer at EOF (
AFBNDL01magic, little-endiansource_len/metadata_len/footer_ver). The scanner identifiesbundles by reading the last 32 bytes of every regular file in
bundles_folderand matching the magic — filename and extension areirrelevant.
The manifest schema drops the
executablefield (the binary is thefile) and redefines
sourceas a display filename for the UI sourceview, since the bytes now live in the footer.
Bundle binary: dual-mode
ServeUser code stays one line:
Servedecides at runtime which protocol to speak based on the CLIarguments and process environment it was invoked with:
--bundle-metadata--dump-bundle-spec--comm=<host:port> --logs=<host:port>AIRFLOW_BUNDLE_MAGIC_COOKIEenv varto Python's
ExecutableCoordinator. The first inbound frame(
DagFileParseRequestorStartupDetails) selects theDAG-parsing one-shot path or the multi-round task-execution path.
Logs go out as JSON-line records over the logs socket.
Existing Edge Worker deployments keep working without rebuilds.
The two paths share the same
bundlev1.BundleProviderimplementation,the same lazy
RegisterDagsrecorder cache, and the samepkg/worker.Workertask lookup and parameter injection. Only thesdk.Clientbackend differs (Execution API URL vs. comm socket), andthe swap happens below the SDK surface — author task code is identical
between the two modes.
Authoring workflow:
go tool airflow-go-packThe packer ships as a standalone binary at
go-sdk/cmd/airflow-go-pack,delivered via the Go 1.24
tooldirective. Authors add one line totheir own
go.mod:and pack with one command:
By default the packer locates the
mainpackage in the currentdirectory, runs
go buildinternally, execs the freshly built binarywith
--dump-bundle-specto populate the manifest, then appends thesource bytes, manifest, and trailer to the binary. Output is
<bundleName>(or<bundleName>.exeon Windows) and is byte-deterministicfor byte-identical inputs.
Escape hatches:
-- <go build flags>for passthrough,--executable <path>to skip the internal build,--source <path>tooverride source detection,
--output <path>for a custom output path.Introspection contract:
--dump-bundle-specEvery bundle binary supports a stable JSON introspection flag:
{ "format_version": "1.0", "sdk": {"language": "go", "version": "<sdk version>"}, "dags": {"<dag_id>": {"tasks": ["<task_id>", "..."]}} }RegisterDagsremains the single authoritative source of dag/taskidentity — the packer execs the binary to read it, no AST scanning
or hand-written manifests. Third-party tooling (IDE plugins,
alternative packers, CI plugins) can rely on the same contract without
taking a Go dependency on the SDK.
Cross-language scope
The footer format and the
--dump-bundle-speccontract arelanguage-agnostic. Future native-SDK languages (Rust, C++, Zig) emit
the same artefact shape and implement the same packer mechanism in
their own toolchain — the consumer-side scanner reads the result
identically regardless of source language.
What's in this PR
Four ADRs under
go-sdk/adr/:register: nine candidate packer mechanisms (standalone CLI,
all-in-one CLI, self-pack, introspection-based, AST scan,
go generate,-toolexec,tooldirective, build-system recipe).Documents the rejected options so future SDKs facing the same
question do not have to re-derive them.
tooldirective for the bundlepacker. Selects the implementation: Option H (
tooldirective)for delivery, paired with Option A (standalone
airflow-go-pack)and Option D (standardised
--dump-bundle-specintrospection).msgpack-over-IPC coordinator-protocol path alongside the existing
go-plugin/Edge-Worker path. Same
Serveentry point, modeselected from invocation.
ZIP container assumed by ADRs 0001 / 0002 with a footer appended
to the executable. The packer mechanism from ADR 0002 is
unchanged; only the artefact it writes changes.
ADR 0001 and ADR 0002 cross-reference ADR 0004 in their Status
sections to flag the superseded portions, so readers landing on the
older ADRs first are pointed at the current artefact shape.
Was generative AI tooling used to co-author this PR?