Skip to content

Conversation

@sophiatev
Copy link
Contributor

This PR introduces the extended sessions feature for entities in .NET isolated. It essentially copies what was done to enable extended sessions for orchestrations in the GrpcOrchestrationRunner into the GrpcEntityRunner, and introduces a new class for shared logic between the two.

Copilot AI review requested due to automatic review settings November 20, 2025 00:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the extended sessions feature to entities in .NET isolated, bringing entities to feature parity with orchestrations. The implementation refactors shared logic between GrpcOrchestrationRunner and GrpcEntityRunner into a new utility class and applies the same extended session caching pattern to entities.

Key Changes:

  • Introduced GrpcInstanceRunnerUtils to share request property parsing and cache initialization logic
  • Added extended sessions support to GrpcEntityRunner with state caching capabilities
  • Updated parameter naming from IncludePastEvents to IncludeState throughout tests for consistency

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/Worker/Grpc/GrpcInstanceRunnerUtils.cs New utility class containing shared logic for parsing request properties and initializing extended sessions cache
src/Worker/Grpc/GrpcEntityRunner.cs Added new overload with extended sessions support and implemented entity state caching logic
src/Worker/Grpc/GrpcOrchestrationRunner.cs Refactored to use shared utility for request property parsing and cache initialization
test/Worker/Grpc.Tests/GrpcEntityRunnerTests.cs New comprehensive test suite covering extended sessions scenarios for entities
test/Worker/Grpc.Tests/GrpcOrchestrationRunnerTests.cs Updated tests to use IncludeState parameter naming and improved variable naming consistency
Comments suppressed due to low confidence (1)

src/Worker/Grpc/GrpcOrchestrationRunner.cs:210

                    extendedSessions.Set<ExtendedSessionState>(

Copilot AI review requested due to automatic review settings December 18, 2025 19:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers - just a few comment suggestions.

}
else
{
extendedSessions?.Remove(request.InstanceId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what situations would we successfully remove something from this cache here?

Copy link
Contributor Author

@sophiatev sophiatev Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to handle the situation where the caller of this method has specifically indicated that the extended session has ended (so the extended sessions cache is non-null, but isExtendedSession is false. We want to honor the termination of the extended session and remove the entity state from the cache here). The other path that could get us here is if extended sessions are simply not enabled, in which case the cache will be null, hence the need for the ?

Copilot AI review requested due to automatic review settings December 18, 2025 23:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

string requestString = Convert.ToBase64String(requestBytes);
string stringResponse = GrpcOrchestrationRunner.LoadAndRun(requestString, new SimpleOrchestrator(), extendedSessions);
Protobuf.OrchestratorResponse response = Protobuf.OrchestratorResponse.Parser.ParseFrom(Convert.FromBase64String(stringResponse));
string requestString = Convert.ToBase64String(requestBytes);
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing: there are two spaces after the equals sign. Should be a single space for consistency with the rest of the codebase.

Suggested change
string requestString = Convert.ToBase64String(requestBytes);
string requestString = Convert.ToBase64String(requestBytes);

Copilot uses AI. Check for mistakes.
entityRequest.Properties.Add(new MapField<string, Value>() {
{ "IncludeState", Value.ForBool(false) }});
byte[] requestBytes = entityRequest.ToByteArray();
string requestString = Convert.ToBase64String(requestBytes);
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing: there are two spaces after the equals sign. Should be a single space for consistency with the rest of the codebase.

Suggested change
string requestString = Convert.ToBase64String(requestBytes);
string requestString = Convert.ToBase64String(requestBytes);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants