Skip to content

fix(bigtable): always include app_profile_id in metadata params#16089

Open
elinorli wants to merge 1 commit intogoogleapis:mainfrom
elinorli:rls
Open

fix(bigtable): always include app_profile_id in metadata params#16089
elinorli wants to merge 1 commit intogoogleapis:mainfrom
elinorli:rls

Conversation

@elinorli
Copy link
Copy Markdown
Contributor

@elinorli elinorli commented May 5, 2026

Unconditionally include app_profile_id in x-goog-request-params routing headers across all 17 BigtableMetadata decorator methods, even when it is empty because an empty app profile is treated as the default app profile.

Also, add a new unit test file to verify the metadata formatting behavior for both empty and non-empty app_profile_id values.

@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label May 5, 2026
Copy link
Copy Markdown

@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 modifies the BigtableMetadata decorator to ensure that app_profile_id is always included in the routing parameters, even when the ID is an empty string. This change is applied across 17 different RPC methods. Additionally, a new unit test file, bigtable_metadata_decorator_test.cc, has been introduced to verify this behavior. The review feedback correctly identifies that the logic for adding this parameter is duplicated many times and should be factored out into a helper function to comply with the repository's style guide regarding code duplication.

Comment on lines +79 to +80
params.push_back(absl::StrCat("app_profile_id=",
internal::UrlEncode(request.app_profile_id())));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic to add app_profile_id to the params vector is duplicated 17 times across this file. According to the repository style guide (lines 13-14), duplicated code appearing 3 or more times should be factored out into a helper function to improve maintainability and ensure consistency across all RPC methods.

References
  1. Prefers to factor out duplicated code if it appears 3 or more times in non-test files. (link)

@elinorli elinorli marked this pull request as ready for review May 6, 2026 16:53
@elinorli elinorli requested a review from a team as a code owner May 6, 2026 16:53
…meters

Unconditionally include app_profile_id in x-goog-request-params
routing headers across all 17 BigtableMetadata decorator methods, even
when it is empty because an empty app profile is treated as the default app
profile.

Also, add a new unit test file to verify the metadata formatting behavior
for both empty and non-empty app_profile_id values. Add metadata decorator test file to CMake unit tests list.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.70%. Comparing base (3852865) to head (edc5bed).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16089   +/-   ##
=======================================
  Coverage   92.70%   92.70%           
=======================================
  Files        2353     2354    +1     
  Lines      218352   218393   +41     
=======================================
+ Hits       202425   202468   +43     
+ Misses      15927    15925    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@mutianf mutianf left a comment

Choose a reason for hiding this comment

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

Undo approve. bigtable_metadata_decorator is a autogenerated file

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

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants