Skip to content

fix(generator): preserve gcloud resource arguments before regeneration - #5113

Merged
thomhurst merged 2 commits into
mainfrom
issue-5112-gcloud-resource-source
Sep 14, 2026
Merged

thomhurst merged 2 commits into
mainfrom
issue-5112-gcloud-resource-source

Conversation

@thomhurst

@thomhurst thomhurst commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Nested gcloud resource operands and selectors disappear from generated typed options because the scraper only recognizes flat positional declarations. This source prerequisite extracts the complete correction from #4956 so source can land before fresh latest-main generation.

Resource groups share the argument-group parser and shared SYNOPSIS result. Operand order, repetition, requiredness, configured selectors, fully qualified names, synopsis metadata, required alternatives, and coverage validation remain intact. Wrapped synopsis lines join their command, while inconsistent declarations and ambiguous top-level colon alternatives fail explicitly. Explicitly nested alternatives remain supported, and GCLOUD_WIDE_FLAG is excluded from operand metadata.

Real KMS and metastore fixtures and shared parser/traversal tests validate constructor and service generation, selectors, group descriptions, colon semantics, and coverage. #4956 retains all twelve Google runtime contracts; parent #4850 stays open for fresh full gcloud generation, generated options/services/API/provenance review, and integration validation. No generated integration file changes here.

Validation:

Closes #5112

Refs #4850

Land the reviewed resource parsing prerequisite before latest-main regeneration. Refs #5112, #4850.
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bc3baded-811f-45e6-b812-bd1559b3ae53

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc510b and 8ea531d.

📒 Files selected for processing (11)
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/kms-keyrings-delete.txt
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/metastore-services-migrations-delete.txt
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Fixtures/Gcloud/metastore-services-migrations-describe.txt
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/Cli/GcloudGroupDescriptionTests.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/Cli/GcloudResourceArgumentTests.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/UsageSynopsisParserTests.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Models/CliArgumentGroup.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/PublicAPI.Unshipped.txt
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs
  • tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/UsageSynopsisParser.cs

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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-14T15:41:43.794430Z 8ea531d New commits
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR preserves gcloud resource operands and selectors when regenerating typed command options.

  • Parses positional-resource sections through the shared argument-group model.
  • Uses SYNOPSIS metadata to retain operand order, requiredness, repetition, and alternatives.
  • Excludes the inherited GCLOUD_WIDE_FLAG placeholder from operand metadata.
  • Adds coverage validation and representative KMS and metastore fixtures.
  • The change since the previous review safely extracts optional nested-operand parsing into a helper.

Confidence Score: 5/5

The PR appears safe to merge with no outstanding actionable findings.

The current implementation consistently merges declared gcloud resource operands with synopsis metadata, validates that grouped arguments are emitted, and the post-review helper extraction does not change parser behavior.

Important Files Changed

Filename Overview
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/GcloudCliScraper.cs Integrates shared synopsis parsing with nested gcloud resource declarations and validates preserved operands and selectors.
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/UsageSynopsisParser.cs Adds colon-group and wrapped-synopsis handling while preserving explicitly nested alternatives; the latest helper extraction is behavior-neutral.
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs Extends grouped-argument coverage validation to positional operands.
tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/Cli/GcloudResourceArgumentTests.cs Covers resource operands, selectors, ordering, repetition, requiredness, generation, and coverage failures.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[gcloud help text] --> B[Extract SYNOPSIS]
    A --> C[Parse FLAGS and POSITIONAL ARGUMENTS]
    B --> D[Parse operand order and requiredness]
    C --> E[Build argument groups]
    E --> F[Separate positional operands and named selectors]
    D --> G[Merge synopsis metadata with declarations]
    F --> G
    G --> H[Validate every grouped argument is emitted]
    H --> I[Generate typed options and services]
Loading

Reviews (2): Last reviewed commit: "refactor(generator): separate optional n..." | Re-trigger Greptile

@thomhurst

Copy link
Copy Markdown
Owner Author

Addressed CodeFactor's new complexity finding in 8ea531d. The report flags TryParseNestedOperandGroup (complexity 16). Its optional nested-operand loop now lives in TryParseOptionalNestedOperands, separating wrapper/colon validation from token-to-operand conversion without changing parsing rules, positions, option associations, requiredness, or diagnostics.

All 894 scraper tests pass, including nested option association, option terminators, colon groups, and captured gcloud resource fixtures. Release generator solution build has zero warnings/errors; scoped severity-info formatting/verification and git diff --check pass. Existing tests cover this behavior-preserving refactor; no test or analyzer was disabled. No generated integration files changed.

CodeFactor and the subsequent CI/review cycle must confirm the new head before merge. Parent #4850 remains open for current-main gcloud regeneration and integration validation.

@thomhurst
thomhurst merged commit cf22373 into main Sep 14, 2026
9 checks passed
@thomhurst
thomhurst deleted the issue-5112-gcloud-resource-source branch September 14, 2026 15:56
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.

Generator: land gcloud resource argument source before regeneration

1 participant