Skip to content

fix(codegen): skip zz_*.go files in prototag#6287

Open
kencochrane wants to merge 1 commit into
mainfrom
prototag-skip-zz
Open

fix(codegen): skip zz_*.go files in prototag#6287
kencochrane wants to merge 1 commit into
mainfrom
prototag-skip-zz

Conversation

@kencochrane
Copy link
Copy Markdown
Contributor

@kencochrane kencochrane commented May 14, 2026

Summary

prototag walks every .go file in api/v1alpha1/ and injects protobuf struct tags by copying them from the buf-generated .pb.go files. It currently doesn't filter out files generated by other tools (notably zz_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 codegen runs codegen-proto before codegen-schema-to-go, and the latter regenerates zz_subscription_types.go from scratch — wiping the injection before git diff --exit-code runs. The bug only surfaces if you run codegen-proto in isolation, which produces local diffs that aren't reproducible from a full make 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-proto from a clean main → confirms zz_subscription_types.go is no longer touched.
  • make codegen end-to-end still produces no diff (the schema-to-go step already regenerates this file, so removing prototag's no-op work changes nothing in the final state).

`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>
@kencochrane kencochrane requested a review from a team as a code owner May 14, 2026 13:58
@netlify
Copy link
Copy Markdown

netlify Bot commented May 14, 2026

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 716fff6
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/6a05d516a8cb3b0008c03daa
😎 Deploy Preview https://deploy-preview-6287.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.96%. Comparing base (741ab5a) to head (716fff6).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@krancour krancour added kind/bug Something isn't working as intended; If unsure that something IS a bug, start a discussion instead kind/chore Something that just needs to get done area/devx Affects developer workflows area/ci-process Affects the CI process that runs on PRs and runs following merges to main and release-* branches priority/normal This is the priority for most work labels May 14, 2026
@krancour krancour added this to the v1.11.0 milestone May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci-process Affects the CI process that runs on PRs and runs following merges to main and release-* branches area/devx Affects developer workflows kind/bug Something isn't working as intended; If unsure that something IS a bug, start a discussion instead kind/chore Something that just needs to get done priority/normal This is the priority for most work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants