Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .autover/changes/1bf02dc5-534e-4f49-a4d9-cf07daf4fde7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.Core",
"Type": "Minor",
"ChangelogMessages": [
"Graduate ILambdaContext.Serializer from experimental to stable. The AWSLAMBDA001 experimental diagnostic is removed; the managed runtime now populates the serializer in both the executable and class-library programming models."
]
}
]
}
11 changes: 11 additions & 0 deletions .autover/changes/89f7d5f8-2c64-446f-b146-1dfdac656c86.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.TestUtilities",
"Type": "Minor",
"ChangelogMessages": [
"Graduate TestLambdaContext.Serializer from experimental to stable, mirroring the graduation of ILambdaContext.Serializer. The AWSLAMBDA001 experimental diagnostic is removed."
]
}
]
}
8 changes: 0 additions & 8 deletions Libraries/src/Amazon.Lambda.Core/ILambdaContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Amazon.Lambda.Core
{
using System;
using System.Diagnostics.CodeAnalysis;

/// <summary>
/// Object that allows you to access useful information available within
Expand Down Expand Up @@ -107,13 +106,6 @@ public interface ILambdaContext
/// Can be null when the function did not register a serializer (e.g., raw-stream
/// handlers).
/// </summary>
/// <remarks>
/// <para><b>Preview API.</b> Class-library mode requires an updated managed
/// Lambda runtime to populate this property; until that ships, the value will
/// be null when running in class-library mode. The <see cref="ExperimentalAttribute"/>
/// is applied to surface this caveat at the call site.</para>
/// </remarks>
[Experimental("AWSLAMBDA001")]
ILambdaSerializer Serializer { get { return null; } }
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);AWSLAMBDA001</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors>IL2026,IL2067,IL2075,IL3050</WarningsAsErrors>
<!-- DurableExecution intentionally consumes the preview ILambdaContext.Serializer
API. The whole package is in development (0.x), so suppressing project-wide
is appropriate; downstream users still see AWSLAMBDA001 in their own code. -->
<NoWarn>$(NoWarn);AWSLAMBDA001</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;

Expand Down Expand Up @@ -87,11 +86,6 @@ public class TestLambdaContext : ILambdaContext
/// to mirror the serializer that the Lambda runtime support library would attach
/// in production.
/// </summary>
/// <remarks>
/// <b>Preview API.</b> Mirrors the experimental <c>ILambdaContext.Serializer</c>
/// surface so test code opts in via the same <c>AWSLAMBDA001</c> diagnostic.
/// </remarks>
[Experimental("AWSLAMBDA001")]
public ILambdaSerializer Serializer { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#pragma warning disable AWSLAMBDA001 // ILambdaContext.Serializer is preview; this is the test that proves it works.
using System.IO;
using Amazon.Lambda.Core;
using Amazon.Lambda.TestUtilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public class CallbackOperationTests
private static string IdAt(int position) => OperationIdGenerator.HashOperationId(position.ToString());

private static TestLambdaContext CreateLambdaContext() =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private static (DurableContext context, RecordingBatcher recorder, TerminationManager tm, ExecutionState state)
CreateContext(InitialExecutionState? initialState = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ private static (DurableContext context, RecordingBatcher recorder, TerminationMa
state.LoadFromCheckpoint(initialState);
var tm = new TerminationManager();
var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var recorder = new RecordingBatcher();
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext, recorder.Batcher);
return (context, recorder, tm, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ public class DurableContextTests
private static string IdAt(int position) => OperationIdGenerator.HashOperationId(position.ToString());

private static TestLambdaContext CreateLambdaContext() =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private static DurableContext CreateContext(
InitialExecutionState? initialState = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public class DurableFunctionTests
private static string IdAt(int position) => OperationIdGenerator.HashOperationId(position.ToString());

private static TestLambdaContext CreateLambdaContext() =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private readonly IAmazonLambda _mockClient = new MockLambdaClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ private static (DurableContext context, RecordingBatcher recorder, TerminationMa
state.LoadFromCheckpoint(initialState);
var tm = new TerminationManager();
var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var recorder = new RecordingBatcher();
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext, recorder.Batcher);
return (context, recorder, tm, state);
Expand Down Expand Up @@ -475,9 +473,7 @@ public async Task EndToEnd_StepInvokeStep_FirstInvocation_SuspendsOnInvoke()
var state = new ExecutionState();
state.LoadFromCheckpoint(null);
var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var batcher = new RecordingBatcher();
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext, batcher.Batcher);

Expand Down Expand Up @@ -527,9 +523,7 @@ public async Task EndToEnd_StepInvokeStep_SecondInvocation_ResumesAndCompletes()
});

var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext);
var finalizeRan = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ private static (DurableContext context, RecordingBatcher recorder, TerminationMa
state.LoadFromCheckpoint(initialState);
var tm = new TerminationManager();
var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var recorder = new RecordingBatcher();
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext, recorder.Batcher);
return (context, recorder, tm, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ private static (DurableContext context, RecordingBatcher recorder, TerminationMa
state.LoadFromCheckpoint(initialState);
var tm = new TerminationManager();
var idGen = new OperationIdGenerator();
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
var lambdaContext = new TestLambdaContext { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001
var recorder = new RecordingBatcher();
var context = new DurableContext(state, tm, new WorkflowCancellation(tm), idGen, "arn:test", lambdaContext, recorder.Batcher);
return (context, recorder, tm, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ private static string ChildIdAt(string parentOpId, int position) =>
OperationIdGenerator.HashOperationId($"{parentOpId}-{position}");

private static TestLambdaContext CreateLambdaContext() =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private static (DurableContext context, RecordingBatcher recorder, TerminationManager tm, ExecutionState state)
CreateContext(InitialExecutionState? initialState = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ public class WaitForConditionOperationTests
private static string IdAt(int position) => OperationIdGenerator.HashOperationId(position.ToString());

private static TestLambdaContext CreateLambdaContext(ILambdaSerializer? serializer = null) =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = serializer ?? new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private static (DurableContext context, RecordingBatcher recorder, TerminationManager tm, ExecutionState state)
CreateContext(InitialExecutionState? initialState = null, ILambdaSerializer? serializer = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ namespace Amazon.Lambda.DurableExecution.Tests;
public class WorkflowCancellationTests
{
private static TestLambdaContext CreateLambdaContext() =>
#pragma warning disable AWSLAMBDA001 // TestLambdaContext.Serializer is experimental.
new() { Serializer = new DefaultLambdaJsonSerializer() };
#pragma warning restore AWSLAMBDA001

private sealed record Harness(
DurableContext Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma warning disable AWSLAMBDA001 // ILambdaContext.Serializer is preview; this is the test that proves it works.
using Amazon.Lambda.Core;
using Amazon.Lambda.RuntimeSupport.Bootstrap;
using Amazon.Lambda.RuntimeSupport.Helpers;
Expand Down
Loading