Skip to content

chore(api_core): move request-id auto-population logic to gapic_v1 public helpers#17738

Open
hebaalazzeh wants to merge 3 commits into
mainfrom
feat/gapic-centralization-api-core-request-id
Open

chore(api_core): move request-id auto-population logic to gapic_v1 public helpers#17738
hebaalazzeh wants to merge 3 commits into
mainfrom
feat/gapic-centralization-api-core-request-id

Conversation

@hebaalazzeh

@hebaalazzeh hebaalazzeh commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Introduces request module containing setup_request_id helper. Exposes the module as public in gapic_v1.

The unit tests in test_method_helpers.py are now identical to the generator's original test template test_service.py.j2 (with the exception of our added None request test case).

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new helper module method_helpers containing a setup_request_id function to populate a UUID4 field in requests if not already set, supporting dicts, protobuf, and proto-plus messages. It also adds a session-scoped pytest fixture to isolate unit tests from workstation mTLS environments, updates a nox session configuration, and relaxes a timing assertion in test_bidi.py. As there are no review comments, no additional feedback is provided.

@hebaalazzeh
hebaalazzeh marked this pull request as ready for review July 16, 2026 15:20
@hebaalazzeh
hebaalazzeh requested a review from a team as a code owner July 16, 2026 15:20
@hebaalazzeh hebaalazzeh self-assigned this Jul 16, 2026
@hebaalazzeh
hebaalazzeh requested a review from parthea July 16, 2026 15:20
@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-centralization-api-core-request-id branch from a0bff77 to 613b392 Compare July 16, 2026 16:18
@hebaalazzeh

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new helper module method_helpers containing the setup_request_id function, which populates a UUID4 field in request objects or dictionaries if not already set, along with corresponding unit tests. The review feedback suggests adding a None check at the beginning of setup_request_id and using a default value in getattr to prevent potential AttributeErrors, as well as adding a test case to verify graceful handling of None requests.

Comment thread packages/google-api-core/google/api_core/gapic_v1/method_helpers.py Outdated
Comment thread packages/google-api-core/tests/unit/gapic/test_method_helpers.py Outdated
@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-centralization-api-core-request-id branch 3 times, most recently from e02ee4b to db040bb Compare July 16, 2026 16:28
Comment thread packages/google-api-core/google/api_core/gapic_v1/method_helpers.py Outdated
Comment thread packages/google-api-core/google/api_core/gapic_v1/request.py
@hebaalazzeh hebaalazzeh changed the title feat: move request-id auto-population logic to gapic_v1 public helpers chore(api_core): move request-id auto-population logic to gapic_v1 public helpers Jul 16, 2026
Comment thread packages/google-api-core/tests/unit/gapic/test_request.py Outdated
Comment thread packages/google-api-core/google/api_core/gapic_v1/request.py
…lic helpers

Introduces method_helpers module containing setup_request_id helper. Exposes the module as public in gapic_v1.
@hebaalazzeh
hebaalazzeh force-pushed the feat/gapic-centralization-api-core-request-id branch 2 times, most recently from 8e31d83 to 20adea6 Compare July 16, 2026 23:42
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.

2 participants