Skip to content

feat(sidekick/surfer): support surface-level cascading hiding via gcloud.yaml#5752

Merged
jameslynnwu merged 4 commits intogoogleapis:mainfrom
jameslynnwu:mark-surface-hidden-gcloud-20260430
May 7, 2026
Merged

feat(sidekick/surfer): support surface-level cascading hiding via gcloud.yaml#5752
jameslynnwu merged 4 commits intogoogleapis:mainfrom
jameslynnwu:mark-surface-hidden-gcloud-20260430

Conversation

@jameslynnwu
Copy link
Copy Markdown
Contributor

@jameslynnwu jameslynnwu commented May 1, 2026

If a surface is configured as hidden in gcloud.yaml, we statically mark its root group, subgroups, and commands as hidden during tree construction.

This is a simple surface-level cascading model to unblock basic command hiding. In the future, we plan to introduce fine-grained command-group and individual command-level hiding. This will require transitioning sidekick to a dynamic visibility model (such as a bottom-up AST traversal pass at the end of surface building) to resolve group visibility based on its children.

  • Propagates RootIsHidden from API config to groups, subgroups, and commands during build.
  • Uses exact FQN service-level scoping to correctly resolve visibility for multi-API packages (e.g. keeping GA policy-bindings public under a shared root).
  • Updates templates to conditionally output Calliope's @base.Hidden decorator for hidden groups and subgroups.
  • Exposes Hidden config in Librarian's SurferAPI schema.

Fixes #5510

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 refactors the handling of hidden commands by moving the "hidden" property from individual commands to the command group level. It updates the CommandGroup struct, the group builder logic, and the surface writer to apply the @base.Hidden decorator to generated Python classes. Additionally, it removes the redundant Hidden field from individual command definitions and updates the corresponding tests and test data. I have no feedback to provide.

@jameslynnwu jameslynnwu force-pushed the mark-surface-hidden-gcloud-20260430 branch from 278cbfb to 226efff Compare May 1, 2026 19:48
@jameslynnwu jameslynnwu marked this pull request as ready for review May 1, 2026 20:30
@jameslynnwu jameslynnwu requested review from a team as code owners May 1, 2026 20:30
Comment thread internal/librarian/surfer/generate.go Outdated
Comment thread internal/librarian/surfer/generate.go Outdated
Comment thread internal/sidekick/surfer/command.go
Comment thread internal/sidekick/surfer/command_builder.go
@jameslynnwu jameslynnwu marked this pull request as draft May 5, 2026 05:47
@sarahheacock sarahheacock added the surfer Issues related to the surfer project (https://github.com/googleapis/librarian/issues/2375) label May 5, 2026
@jameslynnwu jameslynnwu force-pushed the mark-surface-hidden-gcloud-20260430 branch 6 times, most recently from bc65dbd to cf1452a Compare May 6, 2026 05:00
@jameslynnwu jameslynnwu changed the title feat(internal/sidekick/gcloud): support marking surface as hidden via gcloud.yaml feat(sidekick/surfer): support surface-level cascading hiding via gcloud.yaml May 6, 2026
@jameslynnwu jameslynnwu force-pushed the mark-surface-hidden-gcloud-20260430 branch 5 times, most recently from 650316e to 7f393d5 Compare May 7, 2026 02:00
@jameslynnwu jameslynnwu marked this pull request as ready for review May 7, 2026 02:04
@jameslynnwu jameslynnwu force-pushed the mark-surface-hidden-gcloud-20260430 branch 2 times, most recently from ff4bfcd to 9b30275 Compare May 7, 2026 02:30
@jameslynnwu jameslynnwu requested a review from sarahheacock May 7, 2026 02:37
Comment thread internal/sidekick/surfer/provider/config.go Outdated
Comment thread internal/sidekick/surfer/provider/config.go
Comment thread internal/sidekick/surfer/group_builder.go
Comment thread internal/surfer/testdata/multi_service/input/gcloud.yaml
…oud.yaml

If a surface is configured as hidden in gcloud.yaml, we statically mark its root group, subgroups, and commands as hidden during tree construction.

This is a simple surface-level cascading model to unblock basic command hiding. In the future, we plan to introduce fine-grained command-group and individual command-level hiding. This will require transitioning sidekick to a dynamic visibility model (such as a bottom-up AST traversal pass at the end of surface building) to resolve group visibility based on its children.

- Propagates RootIsHidden from API config in gcloud.yaml to groups, subgroups, and commands during build.
- Implements FindAPIConfigByService in config.go to support exact FQN service-level overrides matching.
- Uses exact service-level scoping in group_builder.go and method-level scoping in command_builder.go to correctly resolve visibility for multi-API packages (e.g. keeping GA policy-bindings public under a shared root in iam).
- Updates templates to conditionally output Calliope's @base.Hidden decorator for hidden groups and subgroups in python.

Fixes googleapis#5510
…verification

Renames the historical and misleading `hidden_command` mock test case to `hidden_surface` throughout the surfer codebase and expectations, clarifying that `root_is_hidden` explicitly tests surface-level CLI hiding.

Additionally:
- Renames hidden_command.proto to hidden_surface.proto and updates FQN service and package definitions.
- Configures multi_service test overrides to hide SecondService while keeping FirstService public.
- Regenerates surfer golden expected outputs to assert nested API subgroup hiding natively (GA policy-bindings under iam and firsts under multi_service remain public, while nested subgroups like seconds and resources are correctly flagged hidden).
@jameslynnwu jameslynnwu force-pushed the mark-surface-hidden-gcloud-20260430 branch from fb19761 to bbbface Compare May 7, 2026 15:38
Comment thread internal/sidekick/surfer/provider/config.go
Comment thread internal/sidekick/surfer/group_builder.go
@jameslynnwu jameslynnwu enabled auto-merge (squash) May 7, 2026 16:31
@jameslynnwu jameslynnwu merged commit 59f325c into googleapis:main May 7, 2026
23 checks passed
@jameslynnwu jameslynnwu deleted the mark-surface-hidden-gcloud-20260430 branch May 7, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

surfer Issues related to the surfer project (https://github.com/googleapis/librarian/issues/2375)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

surfer: enable hidden commands through gcloud config

2 participants