Skip to content

Commit a571431

Browse files
authored
Merge branch 'main' into copilot/fix-analyzer-syntax-tree-error
2 parents 650cfa6 + a6e207e commit a571431

File tree

5 files changed

+190
-12
lines changed

5 files changed

+190
-12
lines changed

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))

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

src/Abstractions/TaskOptions.cs

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ public TaskOptions(TaskRetryOptions? retry = null, IDictionary<string, string>?
3030
this.Tags = tags;
3131
}
3232

33+
/// <summary>
34+
/// Initializes a new instance of the <see cref="TaskOptions"/> class by copying from another instance.
35+
/// </summary>
36+
/// <param name="options">The task options to copy from.</param>
37+
public TaskOptions(TaskOptions options)
38+
{
39+
Check.NotNull(options);
40+
this.Retry = options.Retry;
41+
this.Tags = options.Tags;
42+
}
43+
3344
/// <summary>
3445
/// Gets the task retry options.
3546
/// </summary>
@@ -96,12 +107,29 @@ public SubOrchestrationOptions(TaskOptions options, string? instanceId = null)
96107
: base(options)
97108
{
98109
this.InstanceId = instanceId;
99-
if (instanceId is null && options is SubOrchestrationOptions derived)
110+
if (options is SubOrchestrationOptions derived)
100111
{
101-
this.InstanceId = derived.InstanceId;
112+
if (instanceId is null)
113+
{
114+
this.InstanceId = derived.InstanceId;
115+
}
116+
117+
this.Version = derived.Version;
102118
}
103119
}
104120

121+
/// <summary>
122+
/// Initializes a new instance of the <see cref="SubOrchestrationOptions"/> class by copying from another instance.
123+
/// </summary>
124+
/// <param name="options">The sub-orchestration options to copy from.</param>
125+
public SubOrchestrationOptions(SubOrchestrationOptions options)
126+
: base(options)
127+
{
128+
Check.NotNull(options);
129+
this.InstanceId = options.InstanceId;
130+
this.Version = options.Version;
131+
}
132+
105133
/// <summary>
106134
/// Gets the orchestration instance ID.
107135
/// </summary>
@@ -116,15 +144,51 @@ public SubOrchestrationOptions(TaskOptions options, string? instanceId = null)
116144
/// <summary>
117145
/// Options for submitting new orchestrations via the client.
118146
/// </summary>
119-
/// <param name="InstanceId">
120-
/// The unique ID of the orchestration instance to schedule. If not specified, a new GUID value is used.
121-
/// </param>
122-
/// <param name="StartAt">
123-
/// The time when the orchestration instance should start executing. If not specified or if a date-time in the past
124-
/// is specified, the orchestration instance will be scheduled immediately.
125-
/// </param>
126-
public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null)
147+
public record StartOrchestrationOptions
127148
{
149+
/// <summary>
150+
/// Initializes a new instance of the <see cref="StartOrchestrationOptions"/> class.
151+
/// </summary>
152+
/// <param name="InstanceId">
153+
/// The unique ID of the orchestration instance to schedule. If not specified, a new GUID value is used.
154+
/// </param>
155+
/// <param name="StartAt">
156+
/// The time when the orchestration instance should start executing. If not specified or if a date-time in the past
157+
/// is specified, the orchestration instance will be scheduled immediately.
158+
/// </param>
159+
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter - using PascalCase to maintain backward compatibility with positional record syntax
160+
public StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null)
161+
#pragma warning restore SA1313
162+
{
163+
this.InstanceId = InstanceId;
164+
this.StartAt = StartAt;
165+
}
166+
167+
/// <summary>
168+
/// Initializes a new instance of the <see cref="StartOrchestrationOptions"/> class by copying from another instance.
169+
/// </summary>
170+
/// <param name="options">The start orchestration options to copy from.</param>
171+
public StartOrchestrationOptions(StartOrchestrationOptions options)
172+
{
173+
Check.NotNull(options);
174+
this.InstanceId = options.InstanceId;
175+
this.StartAt = options.StartAt;
176+
this.Tags = options.Tags;
177+
this.Version = options.Version;
178+
this.DedupeStatuses = options.DedupeStatuses;
179+
}
180+
181+
/// <summary>
182+
/// Gets the unique ID of the orchestration instance to schedule. If not specified, a new GUID value is used.
183+
/// </summary>
184+
public string? InstanceId { get; init; }
185+
186+
/// <summary>
187+
/// Gets the time when the orchestration instance should start executing. If not specified or if a date-time in the past
188+
/// is specified, the orchestration instance will be scheduled immediately.
189+
/// </summary>
190+
public DateTimeOffset? StartAt { get; init; }
191+
128192
/// <summary>
129193
/// Gets the tags to associate with the orchestration instance.
130194
/// </summary>

src/Analyzers/Analyzers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<PropertyGroup>
14-
<VersionPrefix>0.2.0</VersionPrefix>
14+
<VersionPrefix>0.3.0</VersionPrefix>
1515
<VersionSuffix></VersionSuffix>
1616
<PackageDescription>.NET Analyzers for the Durable Task SDK.</PackageDescription>
1717
<NeutralLanguage>en</NeutralLanguage>

test/Abstractions.Tests/TaskOptionsTests.cs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,98 @@ public void WithDedupeStatuses_ConvertsAllEnumValuesToStrings()
148148
result.DedupeStatuses.Should().Contain(status.ToString());
149149
}
150150
}
151+
152+
[Fact]
153+
public void TaskOptions_CopyConstructor_CopiesAllProperties()
154+
{
155+
// Arrange
156+
RetryPolicy policy = new(3, TimeSpan.FromSeconds(1));
157+
TaskRetryOptions retry = new(policy);
158+
Dictionary<string, string> tags = new() { { "key1", "value1" }, { "key2", "value2" } };
159+
TaskOptions original = new(retry, tags);
160+
161+
// Act
162+
TaskOptions copy = new(original);
163+
164+
// Assert
165+
copy.Retry.Should().Be(original.Retry);
166+
copy.Tags.Should().BeSameAs(original.Tags);
167+
}
168+
169+
[Fact]
170+
public void SubOrchestrationOptions_CopyConstructor_CopiesAllProperties()
171+
{
172+
// Arrange
173+
RetryPolicy policy = new(3, TimeSpan.FromSeconds(1));
174+
TaskRetryOptions retry = new(policy);
175+
Dictionary<string, string> tags = new() { { "key1", "value1" }, { "key2", "value2" } };
176+
string instanceId = Guid.NewGuid().ToString();
177+
TaskVersion version = new("1.0");
178+
SubOrchestrationOptions original = new(retry, instanceId)
179+
{
180+
Tags = tags,
181+
Version = version,
182+
};
183+
184+
// Act
185+
SubOrchestrationOptions copy = new(original);
186+
187+
// Assert
188+
copy.Retry.Should().Be(original.Retry);
189+
copy.Tags.Should().BeSameAs(original.Tags);
190+
copy.InstanceId.Should().Be(original.InstanceId);
191+
copy.Version.Should().Be(original.Version);
192+
}
193+
194+
[Fact]
195+
public void SubOrchestrationOptions_CopyFromTaskOptions_CopiesVersionWhenSourceIsSubOrchestration()
196+
{
197+
// Arrange
198+
RetryPolicy policy = new(3, TimeSpan.FromSeconds(1));
199+
TaskRetryOptions retry = new(policy);
200+
Dictionary<string, string> tags = new() { { "key1", "value1" } };
201+
string instanceId = Guid.NewGuid().ToString();
202+
TaskVersion version = new("1.0");
203+
SubOrchestrationOptions original = new(retry, instanceId)
204+
{
205+
Tags = tags,
206+
Version = version,
207+
};
208+
209+
// Act
210+
SubOrchestrationOptions copy = new(original as TaskOptions);
211+
212+
// Assert
213+
copy.Retry.Should().Be(original.Retry);
214+
copy.Tags.Should().BeSameAs(original.Tags);
215+
copy.InstanceId.Should().Be(original.InstanceId);
216+
copy.Version.Should().Be(original.Version);
217+
}
218+
219+
[Fact]
220+
public void StartOrchestrationOptions_CopyConstructor_CopiesAllProperties()
221+
{
222+
// Arrange
223+
string instanceId = Guid.NewGuid().ToString();
224+
DateTimeOffset startAt = DateTimeOffset.UtcNow.AddHours(1);
225+
Dictionary<string, string> tags = new() { { "key1", "value1" }, { "key2", "value2" } };
226+
TaskVersion version = new("1.0");
227+
List<string> dedupeStatuses = new() { "Completed", "Failed" };
228+
StartOrchestrationOptions original = new(instanceId, startAt)
229+
{
230+
Tags = tags,
231+
Version = version,
232+
DedupeStatuses = dedupeStatuses,
233+
};
234+
235+
// Act
236+
StartOrchestrationOptions copy = new(original);
237+
238+
// Assert
239+
copy.InstanceId.Should().Be(original.InstanceId);
240+
copy.StartAt.Should().Be(original.StartAt);
241+
copy.Tags.Should().BeSameAs(original.Tags);
242+
copy.Version.Should().Be(original.Version);
243+
copy.DedupeStatuses.Should().BeSameAs(original.DedupeStatuses);
244+
}
151245
}

0 commit comments

Comments
 (0)