Skip to content

fix(internal/surfer): identify singletons and preserve command leaf nodes#5018

Merged
sarahheacock merged 5 commits intomainfrom
surfer-group-name-fixes
Apr 3, 2026
Merged

fix(internal/surfer): identify singletons and preserve command leaf nodes#5018
sarahheacock merged 5 commits intomainfrom
surfer-group-name-fixes

Conversation

@sarahheacock
Copy link
Copy Markdown
Contributor

@sarahheacock sarahheacock commented Apr 2, 2026

  • Identify singleton resources using a variable name heuristic and omit them from the command group hierarchy (not supported in declarative framework).
  • Ensure that flattened segments (such as locations or zones) are not skipped over when they contain commands.
  • Change root command group name to be snake case

Fixes #4980

… leaf nodes

* Identify singleton resources using a variable name heuristic and omit them from the command group hierarchy (not supported in declarative framework).
* Ensure that flattened segments (such as locations or zones) are not skipped over when they contain commands.

Fixes #4980
@sarahheacock sarahheacock changed the title Surfer group name fixes fix(internal/surfer/gcloud): identify singletons and preserve command leaf nodes Apr 2, 2026
@sarahheacock
Copy link
Copy Markdown
Contributor Author

Best to review by commit.

  • The first commit fixes the command hiearchy.
  • The second commit is a one line change in command_group_builder and bunch of golden test changes

Copy link
Copy Markdown
Contributor

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

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 enhances the gcloud provider's resource and service name resolution logic. Key changes include the introduction of IsSingletonFromSegments to identify singleton resources and ResolveRootPackage to extract service names from package paths. The PR also refactors path parsing in tests and updates golden files to reflect improved naming conventions for generated Python classes. Review feedback identified a bug in the singleton detection logic regarding version prefixes and a documentation typo in the new service info helper.

@sarahheacock
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

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

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 introduces logic to handle singleton resources and improves the resolution of root package names for command groups. Key changes include adding a heuristic to identify singleton resources based on path patterns, updating the command tree builder to prevent skipping flattened segments when they are leaf nodes, and refactoring path parsing in tests to use realistic resource patterns. Additionally, the golden file test utility was simplified, and several autogenerated test files were updated to reflect improved naming conventions. I have no feedback to provide.

@sarahheacock sarahheacock marked this pull request as ready for review April 2, 2026 17:42
@sarahheacock sarahheacock requested a review from a team as a code owner April 2, 2026 17:42
@sarahheacock sarahheacock changed the title fix(internal/surfer/gcloud): identify singletons and preserve command leaf nodes fix(internal/surfer): identify singletons and preserve command leaf nodes Apr 2, 2026
@sarahheacock sarahheacock enabled auto-merge (squash) April 2, 2026 17:43
Copy link
Copy Markdown

@ianthehat ianthehat left a comment

Choose a reason for hiding this comment

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

Looks fine.
I think we should probably add most of this functionality to the api package in the long run.

@sarahheacock sarahheacock merged commit 6fb12a4 into main Apr 3, 2026
32 of 33 checks passed
@sarahheacock sarahheacock deleted the surfer-group-name-fixes branch April 3, 2026 14:38
@sarahheacock
Copy link
Copy Markdown
Contributor Author

Looks fine. I think we should probably add most of this functionality to the api package in the long run.

💯

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.

surfer: fix folder structure for resource_standard golden

2 participants