henry3260 opened a new pull request, #73084:
URL: https://github.com/apache/airflow/pull/73084

   ## Why
   
   The language SDK specification (`contributing-docs/30_new_language_sdk.rst`) 
requires every SDK to support the `variable-read-write` capability: a task must 
be able to read, write, and delete Airflow Variables. The Go SDK could only 
read them. The supervisor already handles `PutVariable` and `DeleteVariable` 
for Python tasks, and the matching message structs were already generated in 
`genmodels`, but Go tasks had no API to send them. This is the Go counterpart 
of the Java change in #72676.
   
   ## What
   
   - `go-sdk/sdk/sdk.go`: add `SetVariable(ctx, key, value, description string) 
error` and `DeleteVariable(ctx, key string) error` to `VariableClient`, so they 
are also available through `sdk.Client`.
   - `go-sdk/pkg/execution/client.go`: implement both methods on 
`CoordinatorClient` by sending `PutVariable` / `DeleteVariable` to the 
supervisor. An empty description is sent as `null`, matching Python's 
`Variable.set` default. The `description` key is always present on the wire, 
because the supervisor requires it.
   - `go-sdk/pkg/execution/client_test.go`: unit tests for the frames sent, 
with and without a description, and for supervisor errors being returned to the 
caller.
   - `go-sdk/example/bundle/variablewrite/`, `go-sdk/example/bundle/main.go`, 
`go-sdk/dags/go_examples.py`: a new `variable_write_dag` example whose Go task 
writes a Variable, then writes and deletes a scratch Variable.
   - `airflow-e2e-tests/.../go_sdk_tests/test_go_sdk_variable_write.py` and 
`clients.py`: an E2E test that checks, through the REST API, the written value 
and description and that the deleted Variable returns 404.
   - `go-sdk/cmd/airflow-go-pack/pack_integration_test.go`: add the new Dag to 
the expected bundle manifest.
   - `airflow-core/docs/authoring-and-scheduling/language-sdks/go.rst`: 
document the new methods.
   
   Adding methods to `VariableClient` means user-defined fakes that implement 
this interface must add the two methods. The example mocks in this repo are 
updated.
   
   The Go SDK has no `capabilities.yaml` yet, so there is no capability matrix 
to update in this PR.
   
   Validation: `go vet` and `go test` pass for `sdk`, `pkg`, `example`, 
`bundle`, and `cmd/airflow-go-pack`, and prek hooks pass. The new E2E test has 
not been run locally yet (no local PROD image); I am relying on CI for it, 
which is why this PR is a draft.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01LQGjLmbn3Hn2tLToHtbCnf


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to