Skip to content

Commit e32492b

Browse files
authored
Merge branch 'master' into unique-request-id
2 parents a06f5f1 + 487887e commit e32492b

81 files changed

Lines changed: 4298 additions & 434 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
cooldown:
8+
default-days: 14
9+
10+
- package-ecosystem: github-actions
11+
directory: "/"
12+
schedule:
13+
interval: weekly
14+
cooldown:
15+
default-days: 14

.github/workflows/run-test-suite.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
timeout-minutes: ${{ inputs.test-timeout }}
5151
env:
5252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
TEMPORAL_HEADLESS: true
5354
strategy:
5455
fail-fast: ${{ inputs.fail-fast }}
5556
matrix:
@@ -107,6 +108,7 @@ jobs:
107108
run: ${{ inputs.test-command }}
108109
env:
109110
XDEBUG_MODE: off
111+
TEMPORAL_TRANSCRIPT_DUMP_ON_FAIL: "1"
110112

111113
- name: Check for failures
112114
if: steps.validate.outcome == 'failure'

.run/Acceptance.run.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Acceptance" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
3+
<CommandLine>
4+
<envs>
5+
<env name="TEMPORAL_TRANSCRIPT_DUMP_ON_FAIL" value="1" />
6+
</envs>
7+
</CommandLine>
38
<TestRunner bootstrap_file="$PROJECT_DIR$/tests/bootstrap.php" configuration_file="$PROJECT_DIR$/phpunit.xml.dist" directory="$PROJECT_DIR$/tests/Acceptance" scope="XML" options="--testsuite=Acceptance --log-junit=runtime/phpunit-acceptance-junit.xml" />
49
<method v="2" />
510
</configuration>
6-
</component>
11+
</component>

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"spiral/roadrunner-kv": "^4.3.1",
4141
"spiral/roadrunner-worker": "^3.6.2",
4242
"symfony/filesystem": "^5.4.45 || ^6.4.13 || ^7.0 || ^8.0",
43-
"symfony/http-client": "^5.4.49 || ^6.4.17 || ^7.0 || ^8.0",
43+
"symfony/http-client": "^5.4.53 || ^6.4.17 || ^7.0 || ^8.0",
4444
"symfony/polyfill-php83": "^1.31.0",
4545
"symfony/process": "^5.4.51 || ^6.4.15 || ^7.0 || ^8.0"
4646
},
@@ -104,7 +104,11 @@
104104
"test:arch": "phpunit --testsuite=Arch --color=always --testdox",
105105
"test:accept": "tests/runner.php vendor/bin/phpunit --testsuite=Acceptance --color=always --testdox",
106106
"test:accept-slow": "tests/runner.php vendor/bin/phpunit --testsuite=\"Acceptance-Slow\" --color=always --testdox",
107-
"test:accept-fast": "tests/runner.php vendor/bin/phpunit --testsuite=\"Acceptance-Fast\" --color=always --testdox"
107+
"test:accept-fast": "tests/runner.php vendor/bin/phpunit --testsuite=\"Acceptance-Fast\" --color=always --testdox",
108+
"transcripts:last": "php tests/Acceptance/transcript-merge.php",
109+
"transcripts:list": "php tests/Acceptance/transcript-merge.php --list",
110+
"transcripts:merge": "php tests/Acceptance/transcript-merge.php",
111+
"transcripts:clean": "rm -rf runtime/tests/transcripts/*"
108112
},
109113
"config": {
110114
"sort-packages": true,

phpunit.xml.dist

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,47 @@
2323
<testsuite name="Acceptance-Fast">
2424
<directory suffix="Test.php">tests/Acceptance/Extra</directory>
2525
<directory suffix="Test.php">tests/Acceptance/Harness</directory>
26-
<exclude>tests/Acceptance/Harness/Update/SelfTest.php</exclude>
2726
<exclude>tests/Acceptance/Harness/Query/TimeoutDueToNoActiveWorkersTest.php</exclude>
28-
<exclude>tests/Acceptance/Extra/Activity/ActivityPausedTest.php</exclude>
29-
<exclude>tests/Acceptance/Extra/Versioning/DeploymentTest.php</exclude>
3027
<exclude>tests/Acceptance/Harness/EagerWorkflow/SuccessfulStartTest.php</exclude>
31-
<exclude>tests/Acceptance/Harness/Activity/CancelTryCancelTest.php</exclude>
3228
<exclude>tests/Acceptance/Extra/Stability/ResetWorkerTest.php</exclude>
33-
<exclude>tests/Acceptance/Harness/Activity/RetryOnErrorTest.php</exclude>
3429
<exclude>tests/Acceptance/Harness/Update/WorkerRestartTest.php</exclude>
30+
<exclude>tests/Acceptance/Harness/Activity/CancelTryCancelTest.php</exclude>
31+
<exclude>tests/Acceptance/Harness/Activity/RetryOnErrorTest.php</exclude>
32+
<exclude>tests/Acceptance/Extra/Versioning/DeploymentTest.php</exclude>
3533
<exclude>tests/Acceptance/Harness/Schedule/BasicTest.php</exclude>
3634
<exclude>tests/Acceptance/Harness/Update/AsyncAcceptTest.php</exclude>
37-
<exclude>tests/Acceptance/Extra/Workflow/BuiltInPrefixedHandlersTest.php</exclude>
3835
<exclude>tests/Acceptance/Harness/Schedule/TriggerTest.php</exclude>
3936
<exclude>tests/Acceptance/Extra/Workflow/InitMethodTest.php</exclude>
4037
<exclude>tests/Acceptance/Harness/Signal/PreventCloseTest.php</exclude>
4138
<exclude>tests/Acceptance/Extra/Update/UntypedStubTest.php</exclude>
4239
<exclude>tests/Acceptance/Extra/Update/TimeoutTest.php</exclude>
43-
<exclude>tests/Acceptance/Extra/Workflow/DateTimeZoneWorkflowTest.php</exclude>
4440
<exclude>tests/Acceptance/Extra/Schedule/ScheduleUpdateTest.php</exclude>
4541
<exclude>tests/Acceptance/Harness/ChildWorkflow/CancelAbandonTest.php</exclude>
42+
<exclude>tests/Acceptance/Extra/Workflow/DateTimeZoneWorkflowTest.php</exclude>
43+
<exclude>tests/Acceptance/Extra/Workflow/SideEffectTest.php</exclude>
44+
<exclude>tests/Acceptance/Extra/Workflow/WorkflowInfoTest.php</exclude>
4645
<exclude>tests/Acceptance/Harness/ContinueAsNew/ContinueAsSameTest.php</exclude>
4746
</testsuite>
4847
<testsuite name="Acceptance-Slow">
49-
<file>tests/Acceptance/Harness/Update/SelfTest.php</file>
5048
<file>tests/Acceptance/Harness/Query/TimeoutDueToNoActiveWorkersTest.php</file>
51-
<file>tests/Acceptance/Extra/Activity/ActivityPausedTest.php</file>
52-
<file>tests/Acceptance/Extra/Versioning/DeploymentTest.php</file>
5349
<file>tests/Acceptance/Harness/EagerWorkflow/SuccessfulStartTest.php</file>
54-
<file>tests/Acceptance/Harness/Activity/CancelTryCancelTest.php</file>
5550
<file>tests/Acceptance/Extra/Stability/ResetWorkerTest.php</file>
56-
<file>tests/Acceptance/Harness/Activity/RetryOnErrorTest.php</file>
5751
<file>tests/Acceptance/Harness/Update/WorkerRestartTest.php</file>
52+
<file>tests/Acceptance/Harness/Activity/CancelTryCancelTest.php</file>
53+
<file>tests/Acceptance/Harness/Activity/RetryOnErrorTest.php</file>
54+
<file>tests/Acceptance/Extra/Versioning/DeploymentTest.php</file>
5855
<file>tests/Acceptance/Harness/Schedule/BasicTest.php</file>
5956
<file>tests/Acceptance/Harness/Update/AsyncAcceptTest.php</file>
60-
<file>tests/Acceptance/Extra/Workflow/BuiltInPrefixedHandlersTest.php</file>
6157
<file>tests/Acceptance/Harness/Schedule/TriggerTest.php</file>
6258
<file>tests/Acceptance/Extra/Workflow/InitMethodTest.php</file>
6359
<file>tests/Acceptance/Harness/Signal/PreventCloseTest.php</file>
6460
<file>tests/Acceptance/Extra/Update/UntypedStubTest.php</file>
6561
<file>tests/Acceptance/Extra/Update/TimeoutTest.php</file>
66-
<file>tests/Acceptance/Extra/Workflow/DateTimeZoneWorkflowTest.php</file>
6762
<file>tests/Acceptance/Extra/Schedule/ScheduleUpdateTest.php</file>
6863
<file>tests/Acceptance/Harness/ChildWorkflow/CancelAbandonTest.php</file>
64+
<file>tests/Acceptance/Extra/Workflow/DateTimeZoneWorkflowTest.php</file>
65+
<file>tests/Acceptance/Extra/Workflow/SideEffectTest.php</file>
66+
<file>tests/Acceptance/Extra/Workflow/WorkflowInfoTest.php</file>
6967
<file>tests/Acceptance/Harness/ContinueAsNew/ContinueAsSameTest.php</file>
7068
</testsuite>
7169
<testsuite name="Acceptance">

psalm-baseline.xml

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.16.0@7cf3e8b988edd75e0766963b0b9e671b220f5785">
2+
<files psalm-version="6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac">
33
<file src="src/Activity/ActivityInterface.php">
44
<DeprecatedClass>
55
<code><![CDATA[NamedArgumentConstructor]]></code>
@@ -1407,6 +1407,14 @@
14071407
</PossiblyUndefinedStringArrayOffset>
14081408
</file>
14091409
<file src="testing/src/Environment.php">
1410+
<DeprecatedClass>
1411+
<code><![CDATA[new Downloader(new Filesystem(), HttpClient::create([
1412+
'headers' => [
1413+
'authorization' => \is_string($token) ? 'token ' . $token : null,
1414+
],
1415+
]))]]></code>
1416+
<code><![CDATA[private]]></code>
1417+
</DeprecatedClass>
14101418
<PossiblyNullReference>
14111419
<code><![CDATA[stop]]></code>
14121420
<code><![CDATA[stop]]></code>
@@ -1422,6 +1430,82 @@
14221430
<code><![CDATA[ChannelCredentials]]></code>
14231431
</UndefinedClass>
14241432
</file>
1433+
<file src="testing/src/Transcript/TranscriptActivityInterceptor.php">
1434+
<PossiblyNullReference>
1435+
<code><![CDATA[getID]]></code>
1436+
</PossiblyNullReference>
1437+
</file>
1438+
<file src="testing/src/Transcript/TranscriptPaths.php">
1439+
<InvalidOperand>
1440+
<code><![CDATA[\microtime(true) * 1000]]></code>
1441+
</InvalidOperand>
1442+
<RiskyTruthyFalsyComparison>
1443+
<code><![CDATA[\getmypid()]]></code>
1444+
</RiskyTruthyFalsyComparison>
1445+
</file>
1446+
<file src="testing/src/Transcript/TranscriptReader.php">
1447+
<RedundantFunctionCall>
1448+
<code><![CDATA[\array_values]]></code>
1449+
</RedundantFunctionCall>
1450+
</file>
1451+
<file src="testing/src/Transcript/TranscriptRun.php">
1452+
<RedundantFunctionCall>
1453+
<code><![CDATA[\array_values]]></code>
1454+
</RedundantFunctionCall>
1455+
</file>
1456+
<file src="testing/src/Transcript/TranscriptStore.php">
1457+
<ArgumentTypeCoercion>
1458+
<code><![CDATA[TranscriptPaths::writerFile($directory, $processLabel)]]></code>
1459+
</ArgumentTypeCoercion>
1460+
<RiskyTruthyFalsyComparison>
1461+
<code><![CDATA[\getmypid()]]></code>
1462+
</RiskyTruthyFalsyComparison>
1463+
</file>
1464+
<file src="testing/src/Transcript/TranscriptWorkflowInterceptor.php">
1465+
<MissingClosureReturnType>
1466+
<code><![CDATA[fn() => $next($input)]]></code>
1467+
<code><![CDATA[fn() => $next($input)]]></code>
1468+
</MissingClosureReturnType>
1469+
</file>
1470+
<file src="testing/src/Transcript/TranscriptWriter.php">
1471+
<InvalidPropertyAssignmentValue>
1472+
<code><![CDATA[$this->fileDescriptor]]></code>
1473+
<code><![CDATA[$this->fileDescriptor]]></code>
1474+
</InvalidPropertyAssignmentValue>
1475+
<PossiblyInvalidCast>
1476+
<code><![CDATA[$errorRecord['file'] ?? '']]></code>
1477+
<code><![CDATA[$errorRecord['message'] ?? '']]></code>
1478+
</PossiblyInvalidCast>
1479+
<PossiblyNullArgument>
1480+
<code><![CDATA[$this->fileDescriptor]]></code>
1481+
</PossiblyNullArgument>
1482+
<RiskyCast>
1483+
<code><![CDATA[$errorRecord['line'] ?? 0]]></code>
1484+
<code><![CDATA[$errorRecord['type'] ?? 0]]></code>
1485+
</RiskyCast>
1486+
<RiskyTruthyFalsyComparison>
1487+
<code><![CDATA[\getmypid()]]></code>
1488+
</RiskyTruthyFalsyComparison>
1489+
</file>
1490+
<file src="testing/src/Transcript/WireFrameDecoder.php">
1491+
<PossiblyNullArgument>
1492+
<code><![CDATA[$message->getHeader()]]></code>
1493+
<code><![CDATA[$message->getPayloads()]]></code>
1494+
</PossiblyNullArgument>
1495+
<TooManyTemplateParams>
1496+
<code><![CDATA[$fields]]></code>
1497+
<code><![CDATA[$meta]]></code>
1498+
</TooManyTemplateParams>
1499+
</file>
1500+
<file src="testing/src/Transcript/WorkflowHistoryDumper.php">
1501+
<InvalidOperand>
1502+
<code><![CDATA[$eventTime->getSeconds() + \round($eventTime->getNanos() / 1_000_000_000, 6)]]></code>
1503+
<code><![CDATA[($sec - $startSec) * 1000]]></code>
1504+
</InvalidOperand>
1505+
<PossiblyInvalidOperand>
1506+
<code><![CDATA[$eventTime->getSeconds()]]></code>
1507+
</PossiblyInvalidOperand>
1508+
</file>
14251509
<file src="testing/src/WorkerMock.php">
14261510
<DeprecatedMethod>
14271511
<code><![CDATA[registerActivityImplementations]]></code>

runtime/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*
2+
!.gitignore

src/Client/Workflow/WorkflowExecutionDescription.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Temporal\Client\Workflow;
66

7+
use Temporal\Workflow\PendingActivityInfo;
78
use Temporal\Workflow\WorkflowExecutionConfig;
89
use Temporal\Workflow\WorkflowExecutionInfo;
910

@@ -15,10 +16,13 @@
1516
final class WorkflowExecutionDescription
1617
{
1718
/**
19+
* @param list<PendingActivityInfo> $pendingActivities
20+
*
1821
* @internal
1922
*/
2023
public function __construct(
2124
public readonly WorkflowExecutionConfig $config,
2225
public readonly WorkflowExecutionInfo $info,
26+
public readonly array $pendingActivities = [],
2327
) {}
2428
}

src/Internal/Client/WorkflowStarter.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function (UpdateWithStartInput $input): UpdateWithStartOutput {
158158
->setWaitPolicy(
159159
(new \Temporal\Api\Update\V1\WaitPolicy())
160160
->setLifecycleStage($input->updateInput->waitPolicy->lifecycleStage->value),
161-
);
161+
)
162+
->setFirstExecutionRunId($input->updateInput->firstExecutionRunId);
162163

163164
// Configure Meta
164165
$meta = new \Temporal\Api\Update\V1\Meta();
@@ -268,8 +269,8 @@ function (UpdateWithStartInput $input): UpdateWithStartOutput {
268269
Header::empty(),
269270
$update->waitPolicy,
270271
$update->updateId ?? Uuid::v4(),
271-
'',
272-
null, // todo?
272+
$update->firstExecutionRunId ?? '',
273+
$update->resultType,
273274
),
274275
),
275276
);

src/Internal/Client/WorkflowStub.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Temporal\DataConverter\DataConverterInterface;
4242
use Temporal\DataConverter\EncodedValues;
4343
use Temporal\DataConverter\ValuesInterface;
44+
use Temporal\Exception\Client\CanceledException;
4445
use Temporal\Exception\Client\ServiceClientException;
4546
use Temporal\Exception\Client\TimeoutException;
4647
use Temporal\Exception\Client\WorkflowException;
@@ -69,6 +70,7 @@
6970
use Temporal\Interceptor\WorkflowClientCallsInterceptor;
7071
use Temporal\Internal\Interceptor\HeaderCarrier;
7172
use Temporal\Internal\Interceptor\Pipeline;
73+
use Temporal\Internal\Mapper\PendingActivityInfoMapper;
7274
use Temporal\Internal\Mapper\WorkflowExecutionConfigMapper;
7375
use Temporal\Internal\Mapper\WorkflowExecutionInfoMapper;
7476
use Temporal\Workflow\WorkflowExecution;
@@ -305,7 +307,7 @@ static function (
305307
}
306308

307309
throw WorkflowServiceException::withoutMessage($input->workflowExecution, $input->workflowType, $e);
308-
} catch (TimeoutException $e) {
310+
} catch (TimeoutException|CanceledException $e) {
309311
throw WorkflowUpdateRPCTimeoutOrCanceledException::fromTimeoutOrCanceledException($e);
310312
} catch (\Throwable $e) {
311313
throw new WorkflowServiceException(null, $input->workflowExecution, $input->workflowType, $e);
@@ -460,12 +462,20 @@ function (DescribeInput $input): WorkflowExecutionDescription {
460462

461463
$response = $this->serviceClient->DescribeWorkflowExecution($request);
462464

465+
$activityMapper = new PendingActivityInfoMapper($this->converter);
466+
$pendingActivities = [];
467+
/** @psalm-suppress TooManyTemplateParams */
468+
foreach ($response->getPendingActivities() as $pendingActivity) {
469+
$pendingActivities[] = $activityMapper->fromMessage($pendingActivity);
470+
}
471+
463472
/** @psalm-suppress PossiblyNullArgument */
464473
return new WorkflowExecutionDescription(
465474
config: (new WorkflowExecutionConfigMapper($this->converter))
466475
->fromMessage($response->getExecutionConfig()),
467476
info: (new WorkflowExecutionInfoMapper($this->converter))
468477
->fromMessage($response->getWorkflowExecutionInfo()),
478+
pendingActivities: $pendingActivities,
469479
);
470480
},
471481
/** @see WorkflowClientCallsInterceptor::describe() */

0 commit comments

Comments
 (0)