Skip to content

Commit d90383f

Browse files
authored
Merge branch 'main' into copilot/fix-wait-for-external-event
2 parents da251bc + a6e207e commit d90383f

File tree

77 files changed

+3374
-269
lines changed

Some content is hidden

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

77 files changed

+3374
-269
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Azure Functions Smoke Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'feature/**'
8+
paths-ignore: [ '**.md' ]
9+
pull_request:
10+
paths-ignore: [ '**.md' ]
11+
workflow_dispatch:
12+
13+
jobs:
14+
smoke-tests:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: '8.0.x'
25+
26+
- name: Setup .NET from global.json
27+
uses: actions/setup-dotnet@v3
28+
with:
29+
global-json-file: global.json
30+
31+
- name: Restore dependencies
32+
run: dotnet restore test/AzureFunctionsSmokeTests/AzureFunctionsSmokeTests.csproj
33+
34+
- name: Run smoke tests
35+
run: |
36+
cd test/AzureFunctionsSmokeTests
37+
pwsh -File run-smoketests.ps1
38+
39+
- name: Upload smoke test logs on failure
40+
if: failure()
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: smoke-test-logs
44+
path: test/AzureFunctionsSmokeTests/logs/
45+
if-no-files-found: ignore

.github/workflows/close-needs-author-feedback.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## v1.18.2
4+
- Add copy constructors to TaskOptions and sub-classes by halspang ([#587](https://github.com/microsoft/durabletask-dotnet/pull/587))
5+
- Change FunctionNotFound analyzer severity to Info for cross-assembly scenarios by Copilot ([#584](https://github.com/microsoft/durabletask-dotnet/pull/584))
6+
- Add Roslyn analyzer for non-contextual logger usage in orchestrations (DURABLE0010) by Copilot ([#553](https://github.com/microsoft/durabletask-dotnet/pull/553))
7+
- Add specific logging categories for Worker.Grpc and orchestration logs with backward-compatible opt-in by Copilot ([#583](https://github.com/microsoft/durabletask-dotnet/pull/583))
8+
- Fix flaky integration test race condition in dedup status check by Copilot ([#579](https://github.com/microsoft/durabletask-dotnet/pull/579))
9+
- Add analyzer to suggest input parameter binding over GetInput() by Copilot ([#550](https://github.com/microsoft/durabletask-dotnet/pull/550))
10+
- Add strongly-typed external events with DurableEventAttribute by Copilot ([#549](https://github.com/microsoft/durabletask-dotnet/pull/549))
11+
- Fix orchestration analyzer to detect non-function orchestrations correctly by Copilot ([#572](https://github.com/microsoft/durabletask-dotnet/pull/572))
12+
- Fix race condition in WaitForInstanceAsync causing intermittent test failures by Copilot ([#574](https://github.com/microsoft/durabletask-dotnet/pull/574))
13+
- Add HelpLinkUri to Roslyn analyzer diagnostics by Copilot ([#548](https://github.com/microsoft/durabletask-dotnet/pull/548))
14+
- Add DateTimeOffset.Now and DateTimeOffset.UtcNow detection to Roslyn analyzer by Copilot ([#547](https://github.com/microsoft/durabletask-dotnet/pull/547))
15+
- Bump Google.Protobuf from 3.33.1 to 3.33.2 by dependabot[bot] ([#569](https://github.com/microsoft/durabletask-dotnet/pull/569))
16+
- Add integration test coverage for Suspend/Resume operations by Copilot ([#546](https://github.com/microsoft/durabletask-dotnet/pull/546))
17+
- Bump coverlet.collector from 6.0.2 to 6.0.4 by dependabot[bot] ([#527](https://github.com/microsoft/durabletask-dotnet/pull/527))
18+
- Bump FluentAssertions from 6.12.1 to 6.12.2 by dependabot[bot] ([#528](https://github.com/microsoft/durabletask-dotnet/pull/528))
19+
- Add Azure Functions smoke tests with Docker CI automation by Copilot ([#545](https://github.com/microsoft/durabletask-dotnet/pull/545))
20+
- Bump dotnet-sdk from 10.0.100 to 10.0.101 by dependabot[bot] ([#568](https://github.com/microsoft/durabletask-dotnet/pull/568))
21+
- Add scheduled auto-closure for stale "Needs Author Feedback" issues by Copilot ([#566](https://github.com/microsoft/durabletask-dotnet/pull/566))
22+
323
## v1.18.1
424
- Support dedup status when starting orchestration by wangbill ([#542](https://github.com/microsoft/durabletask-dotnet/pull/542))
525
- Add 404 exception handling in blobpayloadstore.downloadasync by Copilot ([#534](https://github.com/microsoft/durabletask-dotnet/pull/534))

Directory.Packages.props

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<PackageVersion Include="Azure.Identity" Version="1.17.1" />
2626
<PackageVersion Include="Azure.Storage.Blobs" Version="12.26.0" />
2727
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="2.51.0" />
28+
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.3.0" />
29+
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.7" />
2830
</ItemGroup>
2931

3032
<!-- DurableTask Packages -->
@@ -40,7 +42,7 @@
4042
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
4143
</ItemGroup>
4244
<ItemGroup>
43-
<PackageVersion Include="Google.Protobuf" Version="3.33.1" />
45+
<PackageVersion Include="Google.Protobuf" Version="3.33.2" />
4446
<PackageVersion Include="Grpc.Core" Version="2.46.6" />
4547
<PackageVersion Include="Grpc.Net.Client" Version="2.67.0" />
4648
<PackageVersion Include="Grpc.Tools" Version="2.76.0" />
@@ -63,12 +65,12 @@
6365
<!-- Testing Frameworks & Analysis Packages -->
6466
<ItemGroup>
6567
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
66-
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
68+
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
6769
<PackageVersion Include="FluentAssertions.Analyzers" Version="0.34.1"/>
6870
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
6971
<PackageVersion Include="Moq" Version="4.20.72" />
7072
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
71-
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
73+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
7274
<PackageVersion Include="xunit" Version="2.9.2" />
7375
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
7476
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>

Microsoft.DurableTask.sln

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InProcessTestHost", "src\In
101101
EndProject
102102
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InProcessTestHost.Tests", "test\InProcessTestHost.Tests\InProcessTestHost.Tests.csproj", "{B894780C-338F-475E-8E84-56AFA8197A06}"
103103
EndProject
104+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventsSample", "samples\EventsSample\EventsSample.csproj", "{34A3EC44-2609-A058-ED30-2F81C3F3A885}"
105+
EndProject
104106
Global
105107
GlobalSection(SolutionConfigurationPlatforms) = preSolution
106108
Debug|Any CPU = Debug|Any CPU
@@ -251,14 +253,6 @@ Global
251253
{D2779F32-A548-44F8-B60A-6AC018966C79}.Debug|Any CPU.Build.0 = Debug|Any CPU
252254
{D2779F32-A548-44F8-B60A-6AC018966C79}.Release|Any CPU.ActiveCfg = Release|Any CPU
253255
{D2779F32-A548-44F8-B60A-6AC018966C79}.Release|Any CPU.Build.0 = Release|Any CPU
254-
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
255-
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
256-
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
257-
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Release|Any CPU.Build.0 = Release|Any CPU
258-
{B894780C-338F-475E-8E84-56AFA8197A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
259-
{B894780C-338F-475E-8E84-56AFA8197A06}.Debug|Any CPU.Build.0 = Debug|Any CPU
260-
{B894780C-338F-475E-8E84-56AFA8197A06}.Release|Any CPU.ActiveCfg = Release|Any CPU
261-
{B894780C-338F-475E-8E84-56AFA8197A06}.Release|Any CPU.Build.0 = Release|Any CPU
262256
{6EB9D002-62C8-D6C1-62A8-14C54CA6DBBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
263257
{6EB9D002-62C8-D6C1-62A8-14C54CA6DBBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
264258
{6EB9D002-62C8-D6C1-62A8-14C54CA6DBBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -271,6 +265,18 @@ Global
271265
{FE1DA748-D6DB-E168-BC42-6DBBCEAF229C}.Debug|Any CPU.Build.0 = Debug|Any CPU
272266
{FE1DA748-D6DB-E168-BC42-6DBBCEAF229C}.Release|Any CPU.ActiveCfg = Release|Any CPU
273267
{FE1DA748-D6DB-E168-BC42-6DBBCEAF229C}.Release|Any CPU.Build.0 = Release|Any CPU
268+
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
269+
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
270+
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
271+
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E}.Release|Any CPU.Build.0 = Release|Any CPU
272+
{B894780C-338F-475E-8E84-56AFA8197A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
273+
{B894780C-338F-475E-8E84-56AFA8197A06}.Debug|Any CPU.Build.0 = Debug|Any CPU
274+
{B894780C-338F-475E-8E84-56AFA8197A06}.Release|Any CPU.ActiveCfg = Release|Any CPU
275+
{B894780C-338F-475E-8E84-56AFA8197A06}.Release|Any CPU.Build.0 = Release|Any CPU
276+
{34A3EC44-2609-A058-ED30-2F81C3F3A885}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
277+
{34A3EC44-2609-A058-ED30-2F81C3F3A885}.Debug|Any CPU.Build.0 = Debug|Any CPU
278+
{34A3EC44-2609-A058-ED30-2F81C3F3A885}.Release|Any CPU.ActiveCfg = Release|Any CPU
279+
{34A3EC44-2609-A058-ED30-2F81C3F3A885}.Release|Any CPU.Build.0 = Release|Any CPU
274280
EndGlobalSection
275281
GlobalSection(SolutionProperties) = preSolution
276282
HideSolutionNode = FALSE
@@ -316,11 +322,12 @@ Global
316322
{A89B766C-987F-4C9F-8937-D0AB9FE640C8} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
317323
{100348B5-4D97-4A3F-B777-AB14F276F8FE} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
318324
{D2779F32-A548-44F8-B60A-6AC018966C79} = {E5637F81-2FB9-4CD7-900D-455363B142A7}
319-
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
320-
{B894780C-338F-475E-8E84-56AFA8197A06} = {E5637F81-2FB9-4CD7-900D-455363B142A7}
321325
{6EB9D002-62C8-D6C1-62A8-14C54CA6DBBC} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
322326
{7C3ECBCE-BEFB-4982-842E-B654BB6B6285} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
323327
{FE1DA748-D6DB-E168-BC42-6DBBCEAF229C} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
328+
{5F1E1662-D2D1-4325-BFE3-6AE23A8A4D7E} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
329+
{B894780C-338F-475E-8E84-56AFA8197A06} = {E5637F81-2FB9-4CD7-900D-455363B142A7}
330+
{34A3EC44-2609-A058-ED30-2F81C3F3A885} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
324331
EndGlobalSection
325332
GlobalSection(ExtensibilityGlobals) = postSolution
326333
SolutionGuid = {AB41CB55-35EA-4986-A522-387AB3402E71}

eng/targets/Release.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<PropertyGroup>
20-
<VersionPrefix>1.18.1</VersionPrefix>
20+
<VersionPrefix>1.18.2</VersionPrefix>
2121
<VersionSuffix></VersionSuffix>
2222
</PropertyGroup>
2323

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "10.0.100",
3+
"version": "10.0.101",
44
"rollForward": "latestFeature"
55
},
66
"msbuild-sdks": {
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.Azure.Functions.Worker;
5+
using Microsoft.Azure.Functions.Worker.Http;
6+
using Microsoft.DurableTask;
7+
using Microsoft.DurableTask.Client;
8+
using Microsoft.Extensions.Logging;
9+
10+
namespace AzureFunctionsApp.Approval;
11+
12+
/// <summary>
13+
/// HTTP-triggered function that starts the <see cref="ApprovalOrchestrator"/> orchestration.
14+
/// </summary>
15+
public static class ApprovalOrchestratorStarter
16+
{
17+
[Function(nameof(StartApprovalOrchestrator))]
18+
public static async Task<HttpResponseData> StartApprovalOrchestrator(
19+
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req,
20+
[DurableClient] DurableTaskClient client,
21+
FunctionContext executionContext)
22+
{
23+
ILogger logger = executionContext.GetLogger(nameof(StartApprovalOrchestrator));
24+
25+
string? requestName = await req.ReadAsStringAsync();
26+
if (string.IsNullOrEmpty(requestName))
27+
{
28+
requestName = "Sample Request";
29+
}
30+
31+
// Use the generated type-safe extension method to start the orchestration
32+
string instanceId = await client.ScheduleNewApprovalOrchestratorInstanceAsync(requestName);
33+
logger.LogInformation("Started approval orchestration with instance ID = {instanceId}", instanceId);
34+
35+
return client.CreateCheckStatusResponse(req, instanceId);
36+
}
37+
38+
[Function(nameof(SendApprovalEvent))]
39+
public static async Task<HttpResponseData> SendApprovalEvent(
40+
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "approval/{instanceId}")] HttpRequestData req,
41+
[DurableClient] DurableTaskClient client,
42+
string instanceId,
43+
FunctionContext executionContext)
44+
{
45+
ILogger logger = executionContext.GetLogger(nameof(SendApprovalEvent));
46+
47+
string? approverName = await req.ReadAsStringAsync();
48+
bool isApproved = req.Url.Query.Contains("approve=true");
49+
50+
// Raise the ApprovalEvent
51+
await client.RaiseEventAsync(instanceId, "ApprovalEvent", new ApprovalEvent(isApproved, approverName));
52+
logger.LogInformation("Sent approval event to instance {instanceId}: approved={isApproved}, approver={approverName}",
53+
instanceId, isApproved, approverName);
54+
55+
var response = req.CreateResponse(System.Net.HttpStatusCode.Accepted);
56+
await response.WriteStringAsync($"Approval event sent to instance {instanceId}");
57+
return response;
58+
}
59+
}
60+
61+
/// <summary>
62+
/// Example event type for approval workflows.
63+
/// The DurableEventAttribute generates a strongly-typed WaitForApprovalEventAsync method.
64+
/// </summary>
65+
[DurableEvent(nameof(ApprovalEvent))]
66+
public sealed record ApprovalEvent(bool Approved, string? Approver);
67+
68+
/// <summary>
69+
/// Orchestrator that demonstrates strongly-typed external events.
70+
/// </summary>
71+
[DurableTask(nameof(ApprovalOrchestrator))]
72+
public class ApprovalOrchestrator : TaskOrchestrator<string, string>
73+
{
74+
public override async Task<string> RunAsync(TaskOrchestrationContext context, string requestName)
75+
{
76+
ILogger logger = context.CreateReplaySafeLogger<ApprovalOrchestrator>();
77+
logger.LogInformation("Approval request received for: {requestName}", requestName);
78+
79+
// Send a notification that approval is required
80+
await context.CallNotifyApprovalRequiredAsync(requestName);
81+
82+
// Wait for approval event using the generated strongly-typed method
83+
// This method is generated by the source generator from the DurableEventAttribute
84+
ApprovalEvent approvalEvent = await context.WaitForApprovalEventAsync();
85+
86+
string result;
87+
if (approvalEvent.Approved)
88+
{
89+
result = $"Request '{requestName}' was approved by {approvalEvent.Approver ?? "unknown"}";
90+
logger.LogInformation("Request approved: {result}", result);
91+
}
92+
else
93+
{
94+
result = $"Request '{requestName}' was rejected by {approvalEvent.Approver ?? "unknown"}";
95+
logger.LogInformation("Request rejected: {result}", result);
96+
}
97+
98+
return result;
99+
}
100+
}
101+
102+
/// <summary>
103+
/// Activity that simulates sending an approval notification.
104+
/// </summary>
105+
[DurableTask(nameof(NotifyApprovalRequired))]
106+
public class NotifyApprovalRequired : TaskActivity<string, string>
107+
{
108+
readonly ILogger logger;
109+
110+
public NotifyApprovalRequired(ILogger<NotifyApprovalRequired> logger)
111+
{
112+
this.logger = logger;
113+
}
114+
115+
public override Task<string> RunAsync(TaskActivityContext context, string requestName)
116+
{
117+
this.logger.LogInformation("Approval required for: {requestName} (Instance: {instanceId})",
118+
requestName, context.InstanceId);
119+
return Task.FromResult("Notification sent");
120+
}
121+
}

samples/AzureFunctionsApp/AzureFunctionsApp.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" OutputItemType="Analyzer" />
1818
<!-- Reference the source generator project directly for local development -->
1919
<ProjectReference Include="..\..\src\Generators\Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
20+
<!-- Reference Abstractions for latest DurableEventAttribute -->
21+
<ProjectReference Include="..\..\src\Abstractions\Abstractions.csproj" />
2022
</ItemGroup>
2123

2224
<ItemGroup>
25+
<PackageReference Include="Google.Protobuf" VersionOverride="3.33.2" />
2326
<None Update="host.json">
2427
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2528
</None>

samples/ConsoleApp/ConsoleApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<!-- Using p2p references so we can show latest changes in samples. -->
2121
<ProjectReference Include="$(SrcRoot)Client/Grpc/Client.Grpc.csproj" />
2222
<ProjectReference Include="$(SrcRoot)Worker/Grpc/Worker.Grpc.csproj" />
23+
<ProjectReference Include="$(SrcRoot)Analyzers/Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2324
</ItemGroup>
2425

2526
</Project>

0 commit comments

Comments
 (0)