Skip to content

Improve make gen to avoid unnecessary file changes#6920

Open
jerrylin118 wants to merge 1 commit intoflyteorg:masterfrom
jerrylin118:Open-source-Contribution
Open

Improve make gen to avoid unnecessary file changes#6920
jerrylin118 wants to merge 1 commit intoflyteorg:masterfrom
jerrylin118:Open-source-Contribution

Conversation

@jerrylin118
Copy link

@jerrylin118 jerrylin118 commented Feb 18, 2026

Tracking issue

Related to #6845

Why are the changes needed?

make generate was updating files such as go.sum, go.mod, swagger.json, and lockfiles even when no protobuf definitions or generation inputs changed. This resulted in unnecessary CI diffs, noisy PRs, and confusion about what actually changed. These updates ensure generation only modifies files when inputs change and that the process is deterministic and idempotent.

What changes were proposed in this pull request?

  • Gate go mod tidy behind RUN_GO_TIDY
    (boilerplate/flyte/golang_test_targets/go-gen.sh)
    go mod tidy is no longer run by default in the shared generate script.
    It runs only when explicitly enabled (e.g. RUN_GO_TIDY=1 make generate).
    Prevents incidental go.mod / go.sum churn. Tidy remains available via make go-tidy or the env var.

  • Add idempotency check in CI
    (.github/workflows/go_generate.yml)
    After DELTA_CHECK=true make generate, CI runs make generate again and fails if the working tree is dirty.
    Ensures deterministic generation and catches nondeterministic tools or environment differences.

  • Content-aware swagger copy
    (flyteidl/clients/go/assets/embed.go)
    The swagger file is copied only if content differs (cmp -s ... || cp ...).
    Prevents no-op diffs and timestamp-only changes.

  • Pin buf image
    (flyteidl/generate_protos.sh)
    Updated from implicit latest to bufbuild/buf:v1.65.0 for reproducible proto generation.

  • Add path filters to generate CI
    (.github/workflows/checks.yml, .github/workflows/flyteidl-checks.yml)
    Generate checks run only when relevant paths change, reducing unnecessary CI runs and unrelated churn.

How was this patch tested?

  • Ran make generate locally in affected components and confirmed no unexpected diffs when inputs were unchanged.
  • Verified RUN_GO_TIDY=1 make generate still runs go mod tidy.
  • Confirmed CI idempotency step fails if the working tree becomes dirty.
  • Validated path-filter behavior to ensure generate runs only when relevant files change.

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

- Gate go mod tidy behind RUN_GO_TIDY in go-gen.sh
- Add idempotency check in go_generate workflow
- Copy embedded swagger only when content changed
- Pin buf image to v1.65.0 in generate_protos.sh
- Run generate CI only when relevant paths change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments