GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(api_core): preserve parentheses and colon in path_template expansion by parthea · Pull Request #18215 · googleapis/google-cloud-python

Conversation

@parthea

@parthea parthea commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #18213
Fixes #18207

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] and robin-jerome reacted with eyes emoji
All reactions
  • 👀 2 reactions
@parthea
fix(api_core): preserve parentheses in path_template expansion
70b9fba
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Aug 25, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 adds unit tests to packages/google-api-core/tests/unit/test_path_template.py to verify that parentheses in resource paths (such as (default)) are correctly handled. There are no review comments, and I have no feedback to provide.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@parthea

parthea commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

The failure in https://github.com/googleapis/google-cloud-python/actions/runs/32864510116/job/97856853390?pr=18215 matches the bug report #18213

    def test_expand_success(tmpl, args, kwargs, expected_result):
        result = path_template.expand(tmpl, *args, **kwargs)
>       assert result == expected_result
E       AssertionError: assert '/v1/projects...%28default%29' == '/v1/projects...ses/(default)'
E         
E         - /v1/projects/my-project/databases/(default)
E         ?                                   ^       ^
E         + /v1/projects/my-project/databases/%28default%29
E         ?                                   ^^^       ^^^
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

parthea added 2 commits August 25, 2026 15:28
@parthea
fix: preserve parentheses in path_template expansion
79f0e48
@parthea
add test case
51a0621
@parthea parthea changed the title [WIP] fix(api_core): preserve parentheses in path_template expansion [WIP] fix(api_core): preserve parentheses and colon in path_template expansion Aug 25, 2026
@parthea
fix(api_core): preserve colon in path_template expansion
09ecc68
@parthea
parthea marked this pull request as ready for review August 25, 2026 15:48
@parthea
parthea requested a review from a team as a code owner August 25, 2026 15:48
@parthea parthea changed the title [WIP] fix(api_core): preserve parentheses and colon in path_template expansion fix(api_core): preserve parentheses and colon in path_template expansion Aug 25, 2026
This was referenced Aug 25, 2026
firestore: Client fails with 'Invalid database id %28default%29' from every GCP compute context, but works externally and via plain REST #18213
Closed
api-core 2.35.0 breaks Firestore "(default)" database id — every call fails with "400 Invalid database id %28default%29" #18207
Closed
@parthea parthea assigned daniel-sanche Aug 25, 2026
@daniel-sanche

daniel-sanche commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

According to go/client-libraries:rest-special-uri-chars, Values for all variable parts should be percent-encoded except for [-_.~/0-9a-zA-Z] characters.

So that spec says this should be percent-encoded, but I'll have to look into why this is a problem for firestore

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daniel-sanche
daniel-sanche requested changes Aug 25, 2026
View reviewed changes
Comment thread packages/google-api-core/google/api_core/path_template.py
val = str(named_vars[name])
_extract_and_validate_wildcards(val, template, name)
return urllib.parse.quote(val, safe="/")
return urllib.parse.quote(val, safe="/():")

@daniel-sanche daniel-sanche Aug 25, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actually, I think we need to move the path encding into transcode. It looks like firestore is using this method for the grpc path, so pre-encoding can cause issues here

The transcode docstring links to this proto as the spec, which says:

when such a variable is expanded into a URL path on the client
side, all characters except [-_.~0-9a-zA-Z] are percent-encoded. The
server side does the reverse decoding."

So we should be able to keep the old encoding logic, but move its location. (And then we'll have to do some tests against the firestore rest client to make sure the server-side decoding works as expected)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@parthea parthea Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ack. I'll close this PR since the fix is related to #17753. Please open a new one with your suggested fix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@parthea parthea closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@daniel-sanche daniel-sanche daniel-sanche requested changes
+1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@daniel-sanche daniel-sanche

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

firestore: Client fails with 'Invalid database id %28default%29' from every GCP compute context, but works externally and via plain REST api-core 2.35.0 breaks Firestore "(default)" database id — every call fails with "400 Invalid database id %28default%29"

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@parthea @daniel-sanche
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.