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

   - related: #73723, ADR-0015 
(`airflow-core/adr/lang-sdk/0015-per-dag-source-in-bundle-artifact.md`)
   - **Depends on https://github.com/apache/airflow/pull/74341 get merged 
first**: it defines the source layout in `executable-bundle-spec.rst` and reads 
it.
   
   ## Why
   
   A Go bundle embedded only the `func main` file, so a native Dag declared in 
another file or package had no source of its own to show in the Code view.
   
   ## How
   
   - `airflow.Dag` records the file that calls it, and `--airflow-metadata` 
reports it per native Dag:
   
     ```go
     // dags/reports.go
     func Reports() *airflow.DagRef {
         dag := airflow.Dag("reports") // recorded as dags/reports.go
         dag.Task(publish)
         return dag
     }
     ```
   
   - `airflow-go-pack` embeds the entrypoint and each Dag's file once, as paths 
relative to the module root. A Dag declared in a file outside the module maps 
to the entrypoint, with a warning.
   
     ```yaml
     entrypoint_path: "example/bundle/main.go"
     dag_source_paths:
       orders: "example/bundle/main.go"
       reports: "example/bundle/dags/reports.go"
     sources:
       - {path: "example/bundle/main.go", offset: 0, length: 1532, sha256: 
"..."}
       - {path: "example/bundle/dags/reports.go", offset: 1532, length: 811, 
sha256: "..."}
     ```
   
   ## What
   
   - `airflow.Dag` records its caller's file. `Serve --airflow-metadata` lists 
the files under `dag_source_files`; task handlers add nothing.
   - `airflow-go-pack`:
     - writes `entrypoint_path`, `dag_source_paths` and `sources` in place of 
`source`, in a stable order, so identical inputs give a byte-identical bundle;
     - accepts absolute and `-trimpath` build paths;
     - packs a bundle that only has native Dags.
   - `airflow-go-pack inspect --source` prints each embedded file under its 
path.
   - Docs: `go-sdk/README.md`, `go.rst` and the example `Justfile`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code Opus 5.5 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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