Skip to content

fix(compute): gate shared operation types behind per-service features - #6312

Open
raushan728 wants to merge 1 commit into
googleapis:mainfrom
raushan728:issues/6220
Open

fix(compute): gate shared operation types behind per-service features#6312
raushan728 wants to merge 1 commit into
googleapis:mainfrom
raushan728:issues/6220

Conversation

@raushan728

Copy link
Copy Markdown
Contributor

model.rs already feature-gates Operation, operation::Status, and the two OperationMetadata types behind per-service features, but errors.rs and operation.rs referenced them unconditionally, breaking --no-default-features builds. Applying the same gate to both files keeps them consistent with what model.rs actually exports.

Fixes #6220

model.rs already feature-gates `Operation`, `operation::Status`, and the
two `OperationMetadata` types behind per-service features, but `errors.rs`
and `operation.rs` referenced them unconditionally, breaking
`--no-default-features` builds. Applying the same gate to both files
keeps them consistent with what `model.rs` actually exports.

Fixes googleapis#6220
@raushan728
raushan728 requested a review from a team as a code owner August 9, 2026 10:03
@product-auto-label product-auto-label Bot added the api: compute Issues related to the Compute Engine API. label Aug 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a build test for google-cloud-compute-v1 with --no-default-features and introduces conditional compilation attributes to errors.rs and operation.rs in the generated compute crate. The feedback highlights that directly modifying files in src/generated violates the repository style guide, and these changes should instead be implemented through the generator or its configuration.

Comment thread src/generated/cloud/compute/v1/src/errors.rs
Comment thread src/generated/cloud/compute/v1/src/operation.rs
Comment on lines +15 to +20
#![cfg(any(
feature = "accelerator-types",
feature = "addresses",
feature = "advice",
feature = "autoscalers",
feature = "backend-buckets",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This list would need to change every time the generator creates a new feature that enables LROs. That happens automatically, several times a year. We don't want to have to manually edit these files each time.

Ideally, we change the code generator to emit a hidden feature that represents "we need the operation types" and the generator enables that feature when any feature that needs it is enabled. Then this code can be changed once.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this makes sense long term. I looked into the generator and it already tracks which types are used for long-running
operations, so adding a hidden feature that other features can depend
on looks doable without too much trouble, and it would help the other crates with the same pattern too.

since that change lives in the generator repo, would it be okay to merge this as the immediate fix for the critical build breakage, while open an issue there for the hidden-feature. once that's implemented, I'll follow up here to switch the fix over.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this makes sense long term. I looked into the generator and it already tracks which types are used for long-running operations, so adding a hidden feature that other features can depend on looks doable without too much trouble, and it would help the other crates with the same pattern too.

Thanks.

since that change lives in the generator repo, would it be okay to merge this as the immediate fix for the critical build breakage,

Hmm... I see this was labeled "critical", but I don't understand why. @dbolduc

while open an issue there for the hidden-feature. once that's implemented, I'll follow up here to switch the fix over.

Frankly I would rather not put this fix in. It creates a maintenance headache, and the workaround for anybody affected by the bug is to enable any feature (say zone-operations) that fixes the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: compute Issues related to the Compute Engine API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compute does not build with --no-default-features

2 participants