Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
22560dc
fix(Core,Spanner): resolve PHP 8.1 deprecation warnings
cy-yun Jul 21, 2026
1a41e94
test(spanner): add IF NOT EXISTS to PostgreSQL DDL statements
cy-yun Jul 21, 2026
e53ebe5
fix(spanner): prevent leaked emulator transactions
cy-yun Jul 21, 2026
9d572ec
test(spanner): BackupTest reliability and optimization
cy-yun Jul 21, 2026
a6759ec
test(spanner): consolidate test database provisioning
cy-yun Jul 21, 2026
7f8dbc4
chore: enable Spanner system tests in CI
cy-yun Jul 21, 2026
cd9613c
fix(spanner): pluck call options like timeoutMillis and lockHint
cy-yun Jul 21, 2026
2838cc6
fix(spanner): fix PgReadTest index creation on shared database
cy-yun Jul 21, 2026
726a60a
test(gax): fix flaky SerializerTest due to randomized map order in pr…
cy-yun Jul 21, 2026
7d4b223
fix(docs): add build-image job (#9371)
bshaffer Jul 21, 2026
8f7633e
feat: Add getServiceScopes method to GapicClientTrait (#9372)
cy-yun Jul 21, 2026
10ec3d2
chore(deps): update actions/setup-python action to v7 (#9363)
renovate-bot Jul 21, 2026
58acf32
chore: rename build-image config (#9374)
bshaffer Jul 21, 2026
094f4a1
fix(docs): add build-prefix for backend jobs (#9375)
bshaffer Jul 21, 2026
eee3376
chore: downgrade docs protobuf version (#9380)
bshaffer Jul 22, 2026
45fab2e
test(spanner): Add DDL statements to test setup traits
cy-yun Jul 22, 2026
30d2a64
test: consolidate updateDdlBatch operations
cy-yun Jul 22, 2026
35c12a3
test(spanner): Fix test suite regressions from DDL consolidation
cy-yun Jul 22, 2026
ccd9e90
test(spanner): Handle DEADLINE_EXCEEDED in BackupTest
cy-yun Jul 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.14'
- run: pip install --no-deps --require-hashes -r .kokoro/docs/docker/requirements.txt
- run: pip install --require-hashes -r .kokoro/docs/docker/requirements.txt
- name: Setup PHP
uses: shivammathur/setup-php@verbose
with:
Expand Down
10 changes: 10 additions & 0 deletions .kokoro/build-image/build-image.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- protobuffer -*-
# proto-file: google3/devtools/kokoro/config/proto/build.proto
# proto-message: BuildConfig

# Path to Dockerfile, PREFIXED with the SCM name from the Job Config
dockerfile_path: "build-dir/.kokoro/docs/docker/Dockerfile"

container_artifact {
destination: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-php-docs:latest"
}
10 changes: 2 additions & 8 deletions .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ action {
}
}

# Path to Dockerfile relative to the SCM root
dockerfile_path: ".kokoro/docs/docker/Dockerfile"

container_artifact {
destination: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-php-docs:latest"
}

env_vars: {
key: "STAGING_BUCKET"
value: "docs-staging-v2"
Expand All @@ -26,4 +19,5 @@ before_action {
keyname: "docuploader_service_account"
}
}
}
}

7 changes: 6 additions & 1 deletion .kokoro/docs/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& rm /tmp/get-pip.py \
&& python3.11 -m pip

# Define the prefix argument, default to backend build environment.
# Override this locally by using the following:
# docker build --build-arg PATH_PREFIX="." .
ARG PATH_PREFIX="git/build-dir/.kokoro/docs/docker"

# Install docsuploader
COPY requirements.txt .
COPY ${PATH_PREFIX}/requirements.txt .
RUN python3.11 -m pip install --require-hashes -r requirements.txt
20 changes: 11 additions & 9 deletions .kokoro/docs/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,17 @@ proto-plus==1.28.1 \
# via
# -r requirements.in
# google-api-core
protobuf==7.35.1 \
--hash=sha256:11d6b0ec246892d85215b0a13ca6e0233cf5284b68f0ac02646427f4ff88a799 \
--hash=sha256:230a75ddfc2de4806e56696ce9640c1cdfdb6543b7cfce98d42a4c0a0e7bdb87 \
--hash=sha256:24f857477359a85c0c235261b8ba905fd51b2562f4a64ca1df5473f29850cbf6 \
--hash=sha256:353652e4efd0bca5b5fc2656abf8307ef351f0cf938c9eba09f0e09c20a25c30 \
--hash=sha256:4bc97768d8fe4ad6743c8a19403e314511ed9f6d13205b687e52421c023ac1b9 \
--hash=sha256:74758715c53d7158fb76caf4f0cfdacc5329a4b1bb994f865d6cf302d413a1c4 \
--hash=sha256:b73f9489a4b8b1c9cb1f8ed951c736392592edb24b9d6819f36d2e10b171d5b4 \
--hash=sha256:ce115a26fe0c39a2c29973d914d327e516a6455464489fe3cd1e51a1b354f81a
protobuf==6.33.6 \
--hash=sha256:0cd27b587afca21b7cfa59a74dcbd48a50f0a6400cfb59391340ad729d91d326 \
--hash=sha256:77179e006c476e69bf8e8ce866640091ec42e1beb80b213c3900006ecfba6901 \
--hash=sha256:7d29d9b65f8afef196f8334e80d6bc1d5d4adedb449971fefd3723824e6e77d3 \
--hash=sha256:9720e6961b251bde64edfdab7d500725a2af5280f3f4c87e57c0208376aa8c3a \
--hash=sha256:a6768d25248312c297558af96a9f9c929e8c4cee0659cb07e780731095f38135 \
--hash=sha256:bd56799fb262994b2c2faa1799693c95cc2e22c62f56fb43af311cae45d26f0e \
--hash=sha256:c96c37eec15086b79762ed265d59ab204dabc53056e3443e702d2681f4b39ce3 \
--hash=sha256:e2afbae9b8e1825e3529f88d514754e094278bb95eadc0e199751cdd9a2e82a2 \
--hash=sha256:e9db7e292e0ab79dd108d7f1a94fe31601ce1ee3f7b79e0692043423020b0593 \
--hash=sha256:f443a394af5ed23672bc6c486be138628fbe5c651ccbc536873d7da23d1868cf
# via
# gcp-docuploader
# google-api-core
Expand Down
24 changes: 15 additions & 9 deletions Core/src/LongRunning/LongRunningClientConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public function __construct(
*/
public function get(array $args): array
{
$operationResponse = $this->gapicClient->resumeOperation($args['name']);
if (isset($args['method'])) {
$operationResponse = $this->gapicClient->resumeOperation($args['name'], $args['method']);
} else {
$operationResponse = $this->gapicClient->resumeOperation($args['name']);
}
Comment on lines +48 to +52

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.

these can all be simplied

Suggested change
if (isset($args['method'])) {
$operationResponse = $this->gapicClient->resumeOperation($args['name'], $args['method']);
} else {
$operationResponse = $this->gapicClient->resumeOperation($args['name']);
}
$operationResponse = $this->gapicClient->resumeOperation($args['name'], $args['method'] ?? null);


return $this->operationResponseToArray($operationResponse);
}
Expand All @@ -56,10 +60,11 @@ public function get(array $args): array
*/
public function cancel(array $args): array
{
$operationResponse = $this->gapicClient->resumeOperation(
$args['name'],
$args['method'] ?? null
);
if (isset($args['method'])) {
$operationResponse = $this->gapicClient->resumeOperation($args['name'], $args['method']);
} else {
$operationResponse = $this->gapicClient->resumeOperation($args['name']);
}
$operationResponse->cancel();

return $this->operationResponseToArray($operationResponse);
Expand All @@ -71,10 +76,11 @@ public function cancel(array $args): array
*/
public function delete(array $args): array
{
$operationResponse = $this->gapicClient->resumeOperation(
$args['name'],
$args['method'] ?? null
);
if (isset($args['method'])) {
$operationResponse = $this->gapicClient->resumeOperation($args['name'], $args['method']);
} else {
$operationResponse = $this->gapicClient->resumeOperation($args['name']);
}
$operationResponse->cancel();

return $this->operationResponseToArray($operationResponse);
Expand Down
10 changes: 10 additions & 0 deletions Gax/src/GapicClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ public function prependMiddleware(callable $middlewareCallable): void
$this->prependMiddlewareCallables[] = $middlewareCallable;
}

/**
* Get the default scopes required by the service.
*
* @return array
*/
public static function getServiceScopes(): array
{
return self::$serviceScopes;
}

/**
* Initiates an orderly shutdown in which preexisting calls continue but new
* calls are immediately cancelled.
Expand Down
8 changes: 8 additions & 0 deletions Gax/tests/Unit/GapicClientTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,14 @@ private function createTransport(

$this->assertTrue($gapic->hasEmulator);
}

public function testGetServiceScopes()
{
$this->assertEquals(
['default-scope-1', 'default-scope-2'],
DefaultScopeAndAudienceGapicClient::getServiceScopes()
);
}
}

class StubGapicClient
Expand Down
10 changes: 8 additions & 2 deletions Gax/tests/Unit/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ private function verifySerializeAndDeserialize($message, $arrayStructure)

// Check that $message when encoded and decoded is unchanged
$deserializedMessage = $serializer->decodeMessage(new $klass(), $serializedMessage);
$this->assertEquals($message, $deserializedMessage);
$this->assertEquals(
$serializer->encodeMessage($message),
$serializer->encodeMessage($deserializedMessage)
);

// Check that $arrayStructure when decoded is equal to $message
$deserializedStructure = $serializer->decodeMessage(new $klass(), $arrayStructure);
$this->assertEquals($message, $deserializedStructure);
$this->assertEquals(
$serializer->encodeMessage($message),
$serializer->encodeMessage($deserializedStructure)
);

// Check that $arrayStructure when decoded and encoded is unchanged
$reserializedStructure = $serializer->encodeMessage($deserializedStructure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function getOperationsClient()
*/
public function resumeOperation($operationName, $methodName = null)
{
$options = $this->descriptors[$methodName]['longRunning'] ?? [];
$options = isset($methodName) ? ($this->descriptors[$methodName]['longRunning'] ?? []) : [];

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.

Hmm, I do not see a functional difference between these two lines which were changed. I think this needs to be reverted.

It's also a generated file so it shouldn't be part of this PR anyway, but would need to be a change in the GAPIC generator

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.

Looks like this is related to the changes in googleapis/gapic-generator-php#842 (review). I've left a comment there too - I think this is a hallucination

$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
return $operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function getOperationsClient()
*/
public function resumeOperation($operationName, $methodName = null)
{
$options = $this->descriptors[$methodName]['longRunning'] ?? [];
$options = isset($methodName) ? ($this->descriptors[$methodName]['longRunning'] ?? []) : [];

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.

Same here, I think this change should be reverted

$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
return $operation;
Expand Down
18 changes: 16 additions & 2 deletions Spanner/src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,17 @@ public function runTransaction(callable $operation, array $options = []): mixed
$this->isRunningTransaction = true;
try {
$res = call_user_func($operation, $transaction);
} catch (\Throwable $e) {
$active = $transaction->state() === Transaction::STATE_ACTIVE;
$singleUse = $transaction->type() === Transaction::TYPE_SINGLE_USE;
if ($active && !$singleUse) {
try {
$transaction->rollback($options);
} catch (\Throwable $rollbackException) {
// ignore rollback failure and bubble up the original exception
}
}

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.

this is great!

throw $e;
} finally {
$this->isRunningTransaction = false;
}
Expand Down Expand Up @@ -1676,12 +1687,13 @@ public function execute($sql, array $options = []): Result

$session = $options['session'] ?? $this->session;
$executeOptions = $this->pluckArray(['parameters', 'types'], $options);
$callOptions = $this->pluckArray(['requestOptions', 'timeoutMillis'], $options);
return $this->operation->execute($session, $sql, $executeOptions + [
'transaction' => $txnOptions,
'transactionContext' => $txnContext,
'directedReadOptions' => $directedReadOptions,
'route-to-leader' => $txnContext === Database::CONTEXT_READWRITE
]);
] + $callOptions);
}

/**
Expand Down Expand Up @@ -2061,9 +2073,11 @@ public function read($table, KeySet $keySet, array $columns, array $options = []
'transaction' => $txnOptions,
];

$callOptions = $this->pluckArray(['requestOptions', 'timeoutMillis'], $options);

return $this->operation->read($this->session, $table, $keySet, $columns, $readOptions + [
'route-to-leader' => $txnContext === Database::CONTEXT_READ
]);
] + $callOptions);
}

/**
Expand Down
10 changes: 7 additions & 3 deletions Spanner/src/TransactionalReadTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,11 @@ public function execute(string $sql, array $options = []): Result
$executeSqlOptions['requestOptions']['transactionTag'] = $this->tag;
}

$callOptions = $this->pluckArray(['requestOptions', 'timeoutMillis'], $options);

$result = $this->operation->execute($this->session, $sql, $executeSqlOptions + [
'route-to-leader' => $this->context === Database::CONTEXT_READWRITE
]);
] + $callOptions);

if (empty($this->id()) && $result->transaction()) {
$this->setId($result->transaction()->id());
Expand Down Expand Up @@ -341,7 +343,7 @@ public function read(string $table, KeySet $keySet, array $columns, array $optio
$this->checkReadContext();

$readOptions = $this->pluckArray(
['index', 'limit', 'partitionToken', 'requestOptions', 'directedReadOptions'],
['index', 'limit', 'partitionToken', 'requestOptions', 'directedReadOptions', 'orderBy', 'lockHint'],
$options,
);
$options['transactionType'] = $this->context;
Expand All @@ -362,9 +364,11 @@ public function read(string $table, KeySet $keySet, array $columns, array $optio
$readOptions,
$this->directedReadOptions ?? []
);
$callOptions = $this->pluckArray(['timeoutMillis'], $options);

$result = $this->operation->read($this->session, $table, $keySet, $columns, $readOptions + [
'route-to-leader' => $this->context === Database::CONTEXT_READWRITE
]);
] + $callOptions);

if (empty($this->id()) && $result->transaction()) {
$this->setId($result->transaction()->id());
Expand Down
4 changes: 2 additions & 2 deletions Spanner/src/ValueMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ private function structParam(StructValue|array|null $value, StructType $type): a
}
} elseif ($value instanceof StructValue) {
foreach ($value->values() as $idx => $val) {
$name = $val['name'];
$name = (string) ($val['name'] ?? '');
$valValue = $val['value'];

if (!isset($values[$name])) {
Expand All @@ -580,7 +580,7 @@ private function structParam(StructValue|array|null $value, StructType $type): a
$fields = [];
$names = [];
foreach ($typeFields as $typeIndex => $paramType) {
$fieldName = $paramType['name'];
$fieldName = (string) ($paramType['name'] ?? '');

// Count the number of times the field name has been encountered thus far.
// This lets us pick the correct index for duplicate fields.
Expand Down
Loading
Loading