Skip to content

Catch lang-SDK Go example module drift before it reaches main - #70568

Merged
potiuk merged 3 commits into
mainfrom
guard-go-example-mod-tidy
Jul 28, 2026
Merged

Catch lang-SDK Go example module drift before it reaches main#70568
potiuk merged 3 commits into
mainfrom
guard-go-example-mod-tidy

Conversation

@potiuk

@potiuk potiuk commented Jul 27, 2026

Copy link
Copy Markdown
Member

Follow-up to #70561, which cleaned up the drift by hand. This stops the next Go bump from doing it again.

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves the SDK through a replace onto ../../../go-sdk, so it carries its own copy of the SDK's indirect requirements. Nothing re-tidies it when a dependency moves inside /go-sdk, and Dependabot bumps exactly one module per PR — #70226 moved google.golang.org/grpc 1.79.3 → 1.82.1 in /go-sdk only.

What makes it worth guarding is the blast radius: Go refuses to build an inconsistent module, so once such a bump merges, Kubernetes tests / K8S Lang-SDK fails at the "Build Go bundle" step on every pull request until someone notices — not just on the PR that caused it.

Config can't prevent this. Dependabot security updates ignore .github/dependabot.yml entirely (which today has no gomod entry at all), and a second Dependabot PR for the example module would merge at a different time and leave main red in between. The drift has to fail the bump PR itself.

The check is go mod tidy -diff in the example module — exactly the question the failing CI step asks, it never writes to the working tree, and it exits non-zero when the module is untidy. It runs only when either module's go.mod/go.sum changes, which is sufficient: any new requirement in the SDK necessarily lands in go-sdk/go.mod first.

Verified against the real regression. On main as it stands:

$ prek run check-go-example-mod-tidy --files go-sdk/go.mod
ERROR: kubernetes-tests/lang_sdk/go_example is not tidy.
...
Fix it in this PR by running:

    (cd kubernetes-tests/lang_sdk/go_example && go mod tidy)

and the reported diff is byte-for-byte the change #70561 makes. After applying that tidy, the hook exits 0.

This PR's own static checks will be red until #70561 merges

That is the hook working, not a defect — main is currently untidy, so the check it adds correctly fails. The commit was made with SKIP=check-go-example-mod-tidy for the same reason. Once #70561 lands, this goes green with no change here; happy to rebase onto it instead if you'd rather have one green PR.

Not addressed: the existing go-mod-tidy hook in go-sdk/.pre-commit-config.yaml is types: [go], so it does not fire on go.mod/go.sum changes either. That has not bitten us because Dependabot tidies the module it bumps, but it is the same gap one level up.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves
the SDK through a `replace` onto ../../../go-sdk, so it carries its own copy
of the SDK's indirect requirements. Nothing re-tidies it when a dependency
moves inside /go-sdk, and Dependabot bumps exactly one module per PR.

The blast radius is what makes this worth guarding. Go refuses to build an
inconsistent module, so once such a bump merges, "Kubernetes tests / K8S
Lang-SDK" fails at the Build Go bundle step on every pull request until
someone notices and tidies the module by hand — not just on the PR that
caused it.

Dependabot security updates do not consult .github/dependabot.yml, so no
per-directory configuration prevents this, and a second Dependabot PR for the
example module would merge at a different time and leave main red in between.
The drift has to fail the bump PR itself.

The check is `go mod tidy -diff` in the example module: it asks exactly the
question the failing CI step asks, never writes to the working tree, and
exits non-zero when the module is untidy.

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is exactly what I thought about to prevent further drift, thanks.

potiuk added 2 commits July 28, 2026 13:22
Static checks run on a runner whose preinstalled toolchains are deleted to
free disk space before prek starts, so the check could never find `go` there
and failed on every run. Asking prek for the toolchain is how the Go SDK's
own tidy hook already gets one, and it pins the same version everywhere.
@potiuk
potiuk merged commit bce20ff into main Jul 28, 2026
77 checks passed
@potiuk
potiuk deleted the guard-go-example-mod-tidy branch July 28, 2026 13:38
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 28, 2026
…main (apache#70568)

* Catch lang-SDK Go example module drift before it reaches main

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves
the SDK through a `replace` onto ../../../go-sdk, so it carries its own copy
of the SDK's indirect requirements. Nothing re-tidies it when a dependency
moves inside /go-sdk, and Dependabot bumps exactly one module per PR.

The blast radius is what makes this worth guarding. Go refuses to build an
inconsistent module, so once such a bump merges, "Kubernetes tests / K8S
Lang-SDK" fails at the Build Go bundle step on every pull request until
someone notices and tidies the module by hand — not just on the PR that
caused it.

Dependabot security updates do not consult .github/dependabot.yml, so no
per-directory configuration prevents this, and a second Dependabot PR for the
example module would merge at a different time and leave main red in between.
The drift has to fail the bump PR itself.

The check is `go mod tidy -diff` in the example module: it asks exactly the
question the failing CI step asks, never writes to the working tree, and
exits non-zero when the module is untidy.

* Let prek provide the Go toolchain for the tidy check

Static checks run on a runner whose preinstalled toolchains are deleted to
free disk space before prek starts, so the check could never find `go` there
and failed on every run. Asking prek for the toolchain is how the Go SDK's
own tidy hook already gets one, and it pins the same version everywhere.
(cherry picked from commit bce20ff)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 28, 2026
…main (apache#70568)

* Catch lang-SDK Go example module drift before it reaches main

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves
the SDK through a `replace` onto ../../../go-sdk, so it carries its own copy
of the SDK's indirect requirements. Nothing re-tidies it when a dependency
moves inside /go-sdk, and Dependabot bumps exactly one module per PR.

The blast radius is what makes this worth guarding. Go refuses to build an
inconsistent module, so once such a bump merges, "Kubernetes tests / K8S
Lang-SDK" fails at the Build Go bundle step on every pull request until
someone notices and tidies the module by hand — not just on the PR that
caused it.

Dependabot security updates do not consult .github/dependabot.yml, so no
per-directory configuration prevents this, and a second Dependabot PR for the
example module would merge at a different time and leave main red in between.
The drift has to fail the bump PR itself.

The check is `go mod tidy -diff` in the example module: it asks exactly the
question the failing CI step asks, never writes to the working tree, and
exits non-zero when the module is untidy.

* Let prek provide the Go toolchain for the tidy check

Static checks run on a runner whose preinstalled toolchains are deleted to
free disk space before prek starts, so the check could never find `go` there
and failed on every run. Asking prek for the toolchain is how the Go SDK's
own tidy hook already gets one, and it pins the same version everywhere.
(cherry picked from commit bce20ff)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
potiuk added a commit that referenced this pull request Jul 28, 2026
…main (#70568) (#70624)

* Catch lang-SDK Go example module drift before it reaches main

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves
the SDK through a `replace` onto ../../../go-sdk, so it carries its own copy
of the SDK's indirect requirements. Nothing re-tidies it when a dependency
moves inside /go-sdk, and Dependabot bumps exactly one module per PR.

The blast radius is what makes this worth guarding. Go refuses to build an
inconsistent module, so once such a bump merges, "Kubernetes tests / K8S
Lang-SDK" fails at the Build Go bundle step on every pull request until
someone notices and tidies the module by hand — not just on the PR that
caused it.

Dependabot security updates do not consult .github/dependabot.yml, so no
per-directory configuration prevents this, and a second Dependabot PR for the
example module would merge at a different time and leave main red in between.
The drift has to fail the bump PR itself.

The check is `go mod tidy -diff` in the example module: it asks exactly the
question the failing CI step asks, never writes to the working tree, and
exits non-zero when the module is untidy.

* Let prek provide the Go toolchain for the tidy check

Static checks run on a runner whose preinstalled toolchains are deleted to
free disk space before prek starts, so the check could never find `go` there
and failed on every run. Asking prek for the toolchain is how the Go SDK's
own tidy hook already gets one, and it pins the same version everywhere.
(cherry picked from commit bce20ff)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
vatsrahul1001 pushed a commit that referenced this pull request Aug 5, 2026
…main (#70568) (#70624)

* Catch lang-SDK Go example module drift before it reaches main

kubernetes-tests/lang_sdk/go_example is a separate Go module that resolves
the SDK through a `replace` onto ../../../go-sdk, so it carries its own copy
of the SDK's indirect requirements. Nothing re-tidies it when a dependency
moves inside /go-sdk, and Dependabot bumps exactly one module per PR.

The blast radius is what makes this worth guarding. Go refuses to build an
inconsistent module, so once such a bump merges, "Kubernetes tests / K8S
Lang-SDK" fails at the Build Go bundle step on every pull request until
someone notices and tidies the module by hand — not just on the PR that
caused it.

Dependabot security updates do not consult .github/dependabot.yml, so no
per-directory configuration prevents this, and a second Dependabot PR for the
example module would merge at a different time and leave main red in between.
The drift has to fail the bump PR itself.

The check is `go mod tidy -diff` in the example module: it asks exactly the
question the failing CI step asks, never writes to the working tree, and
exits non-zero when the module is untidy.

* Let prek provide the Go toolchain for the tidy check

Static checks run on a runner whose preinstalled toolchains are deleted to
free disk space before prek starts, so the check could never find `go` there
and failed on every run. Asking prek for the toolchain is how the Go SDK's
own tidy hook already gets one, and it pins the same version everywhere.
(cherry picked from commit bce20ff)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants