Skip to content

feat: add a new feature enablement mechanism#1689

Merged
shollyman merged 11 commits intogoogleapis:mainfrom
shollyman:experimental-enablement
Jan 30, 2026
Merged

feat: add a new feature enablement mechanism#1689
shollyman merged 11 commits intogoogleapis:mainfrom
shollyman:experimental-enablement

Conversation

@shollyman
Copy link
Copy Markdown
Contributor

@shollyman shollyman commented Jan 26, 2026

This PR adds a new feature enablement mechanism to the Go GAPIC
generator. The intent is to pass behavior enablement via protoc flags,
with support for the old explicit allowlists until we can transition
feature controls to downstream invocation callsites (e.g. bazel rules, librariangen).

This PR also migrates three existing internal features to use the new
feature mechanism: MTLS support, wrapper type support in list RPCs,
and ordered header generation.

This PR adds a new feature enablement mechanism to the Go GAPIC
generator.  The intent is to pass behavior enablement via protoc flags,
with support for the old explicit allowlists until we can transition
the usage.
@shollyman shollyman added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 26, 2026
@shollyman shollyman removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 27, 2026
@shollyman shollyman marked this pull request as ready for review January 27, 2026 22:43
@shollyman shollyman requested a review from a team January 27, 2026 22:43
Copy link
Copy Markdown
Member

@quartzmo quartzmo left a comment

Choose a reason for hiding this comment

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

This is a great improvement. I love the more concise conditionals in the production generation code:

if g.cfg.FeatureEnabled(...) {

Comment thread internal/gengapic/feature.go
Comment thread internal/gengapic/feature.go Outdated
Comment thread internal/gengapic/feature.go
Comment thread internal/gengapic/feature.go
Comment thread internal/gengapic/feature.go
Comment thread internal/gengapic/generator.go Outdated
Comment thread internal/gengapic/options.go Outdated
Comment thread internal/gengapic/options.go Outdated
Comment thread internal/gengapic/options.go Outdated
@shollyman
Copy link
Copy Markdown
Contributor Author

This is a great improvement. I love the more concise conditionals in the production generation code:

if g.cfg.FeatureEnabled(...) {

The level at which the check is expressed is something I've been struggling with as well. Should we hoist the check function up to the generator or leave it on the config? e.g. if g.FeatureEnabled(...) { instead of dotting into the cfg field.

@shollyman
Copy link
Copy Markdown
Contributor Author

The level at which the check is expressed is something I've been struggling with as well. Should we hoist the check function up to the generator or leave it on the config? e.g. if g.FeatureEnabled(...) { instead of dotting into the cfg field.

I went ahead and moved the check function up to the generator, so its even simpler.

if g.featureEnabled(FooFeature) { // do the thing }

@shollyman shollyman requested a review from quartzmo January 28, 2026 22:56
Comment thread internal/gengapic/feature.go Outdated
Copy link
Copy Markdown
Member

@hongalex hongalex left a comment

Choose a reason for hiding this comment

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

LGTM but want approval from @quartzmo so won't include the approval

@shollyman shollyman merged commit 1f6129a into googleapis:main Jan 30, 2026
8 checks passed
@shollyman shollyman deleted the experimental-enablement branch January 30, 2026 17:20
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.

4 participants