Skip to content

fix(generator): preserve nonexclusive gcloud update groups - #5343

Merged
thomhurst merged 1 commit into
mainfrom
maintenance/gcloud-nonexclusive-update-groups-20260922
Sep 22, 2026
Merged

thomhurst merged 1 commit into
mainfrom
maintenance/gcloud-nonexclusive-update-groups-20260922

Conversation

@thomhurst

@thomhurst thomhurst commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

A valid gcloud managed-kafka clusters update --cpu=3 --mtls-ca-pools=... is rejected because its flattened SYNOPSIS makes independent update settings appear mutually exclusive. SDK 585 FLAGS instead documents an "at least one" group with a nested "at most one" choice for clearing versus replacing CA pools.

Preserve the complete matching documented nonexclusive group even when the SYNOPSIS parser classified it as a choice. This retains both independent settings and nested exclusions without command-specific rules.

The captured SDK regression fails before the fix and passes after it. Its nine combinations cover CPU/CA-pool updates, individual settings, empty input, and conflicting CA-pool flags. All 19 focused Google generated-validator tests and formatting pass. Full CI passes all 3,380 generator tests. Claude, Codex, CodeRabbit, and CodeFactor are clear. All CodeQL checks pass; no outstanding findings remain.

Related: #5339. Generation run 35682446460 was cancelled and verified complete before publishing known defective output. Fresh latest-main regeneration follows this source fix; the Google acceptance issues remain open until the replacement passes actual integration CI.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T03:24:19.455802Z 37da4bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3079b318-9f9e-4b88-9a1d-b2ce1b98c636

📥 Commits

Reviewing files that changed from the base of the PR and between c2ccb29 and 37da4bf.

📒 Files selected for processing (3)
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-managed-kafka-clusters-update.txt
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The scraper now preserves documented nonexclusive choices within choice groups. A new gcloud Kafka fixture and regression test validate combinations of CPU, memory, and mTLS CA pool flags.

Changes

Gcloud choice preservation

Layer / File(s) Summary
Preserve documented choices
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs
PreserveDocumentedChoices now checks documented choices for groups marked as choices.
Validate Kafka alternatives
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-managed-kafka-clusters-update.txt, tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs
Adds the gcloud 585.0.0 Kafka update help fixture. Tests accept nonexclusive combinations and reject conflicting mTLS CA pool selections.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: ⚪ Minimal · up to 37da4

The scraper preserves valid combinations of Kafka update settings while retaining mutually exclusive CA-pool flags. The focused validation and formatting checks pass, leaving no concrete merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the generator fix and the preservation of nonexclusive gcloud update groups, which matches the main change.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit found a choice in the CLI,
And kept the nested rules nearby.
CPU and memory joined the queue,
One CA pool stayed true.
Conflicting flags were turned away.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions 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.

Claude Review

This PR fixes GcloudCliScraper.PreserveDocumentedChoices so a documented nonexclusive "at least one" FLAGS group (with a nested mutually-exclusive sub-choice) is preserved even when the gcloud SYNOPSIS parser flattens it into a single fully-exclusive choice, fixing false rejection of independent managed-kafka clusters update flags like --cpu combined with --mtls-ca-pools. I traced the removed group.IsChoice ? null : ... guard through the merge logic and confirmed the replacement match is safely scoped (exact PropertyNames set equality against the single already-matched documented constraint), verified the new captured-SDK fixture and generated-validation test exercise real compiled option types against the correct at-least-one/at-most-one semantics, and confirmed no production generated options file was hand-edited, consistent with repo policy of deferring regeneration to a separate PR."}

Review evidence

tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs: Traced PreserveDocumentedChoices end-to-end: removing the group.IsChoice ? null : ... guard lets a documented nonexclusive AtLeastOne candidate (FLAGS section) fully replace a SYNOPSIS-derived group even when the SYNOPSIS parser mis-flattened it into a mutually-exclusive choice. Verified the match still requires exact PropertyNames set equality against documented, which is itself scoped to the single previously-matched constraint (via ReconcileRequiredSynopsisChoices), so the loosened guard cannot spuriously reclassify unrelated exclusive groups elsewhere.

tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Generators/GcloudNestedSynopsisValidationTests.cs: New Kafka test compiles a real generated options type and runs Validator.TryValidateObject, not just a hand-checked model tree. Walked all 9 asserted combinations against expected at-least-one/nested-at-most-one semantics (Cpu+MtlsCaPools valid, empty invalid, ClearMtlsCaPools+MtlsCaPools together invalid) and all match the documented FLAGS constraint correctly.

tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/585.0.0/gcloud-managed-kafka-clusters-update.txt: New captured SDK 585 fixture; SYNOPSIS flattens 9 independent settings plus --clear-mtls-ca-pools into one bracketed alternative vs. --mtls-ca-pools, while REQUIRED FLAGS documents the true nested at-least-one/at-most-one shape the fix is designed to preserve.

No actionable findings.

Optional follow-up notes

No production generated file (e.g. GcloudManagedKafkaClustersUpdateOptions.Generated.cs) is regenerated in this PR — it currently has no options at all for this command, from an older captured SDK version. This is consistent with AGENTS.md's split of generator fixes from regeneration PRs and the PR body's stated plan for a follow-up regeneration; just confirming it's intentional, not an oversight.

This is the second narrowly-scoped patch in a row to the same SYNOPSIS-vs-FLAGS reconciliation logic in GcloudCliScraper (previous: #5342 'preserve documented gcloud branch optionality', immediately prior commit on main). As more gcloud quirks surface, consider consolidating PreserveDocumentedChoices/RestoreFlattenedDocumentedChoices into a single documented algorithm (e.g. a small state machine or documented invariant list) rather than continuing to add one-off guard removals/conditions, since each new edge case increases the risk of subtly interacting with earlier ones and makes the intent harder to verify by inspection alone.

No prior human/bot review findings exist yet to verify as addressed (Codex review was still 'Running' at capture time); nothing outstanding to reconcile.

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