fix(codegen): skip zz_*.go files in prototag#6287
Open
kencochrane wants to merge 1 commit into
Open
Conversation
`prototag` walks every .go file in api/v1alpha1/ and injects protobuf struct tags by copying them from the buf-generated .pb.go siblings. By convention, files prefixed with zz_ are generated by tools other than buf (e.g. quicktype for zz_subscription_types.go) and their content gets regenerated from scratch by subsequent codegen steps -- so any tags `prototag` injects into them are silently clobbered. The breakage was masked in CI because `make codegen` runs codegen-proto before codegen-schema-to-go, so the quicktype regeneration always wipes prototag's injection before `git diff --exit-code` runs. But running codegen-proto in isolation produces local diffs in zz_subscription_types.go that aren't reproducible from a full `make codegen` -- which is confusing and made check-codegen failures harder to debug. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Ken <kencochrane@gmail.com>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6287 +/- ##
=======================================
Coverage 57.96% 57.96%
=======================================
Files 496 496
Lines 41602 41602
=======================================
Hits 24115 24115
Misses 16033 16033
Partials 1454 1454 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
krancour
approved these changes
May 14, 2026
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.
Summary
prototagwalks every.gofile inapi/v1alpha1/and injects protobuf struct tags by copying them from the buf-generated.pb.gofiles. It currently doesn't filter out files generated by other tools (notablyzz_subscription_types.go, which is quicktype output from JSON schemas), so it silently injects protobuf tags into them.This is masked in CI because
make codegenrunscodegen-protobeforecodegen-schema-to-go, and the latter regenerateszz_subscription_types.gofrom scratch — wiping the injection beforegit diff --exit-coderuns. The bug only surfaces if you runcodegen-protoin isolation, which produces local diffs that aren't reproducible from a fullmake codegen. This made #6286's check-codegen failure harder to diagnose.The fix is to also skip files prefixed with
zz_(a common convention for "generated by something other than the current tool").Test plan
make codegen-protofrom a clean main → confirmszz_subscription_types.gois no longer touched.make codegenend-to-end still produces no diff (the schema-to-go step already regenerates this file, so removingprototag's no-op work changes nothing in the final state).