Skip to content

Implement tag feature #299

Open
fanyirobin wants to merge 11 commits intomicrosoft:mainfrom
fanyirobin:dev/yifan1/tags
Open

Implement tag feature #299
fanyirobin wants to merge 11 commits intomicrosoft:mainfrom
fanyirobin:dev/yifan1/tags

Conversation

@fanyirobin
Copy link

No description provided.

@fanyirobin
Copy link
Author

@microsoft-github-policy-service agree company="Microsoft"

Copy link

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

Adds end-to-end support for orchestration “tags” in the SQL Server provider, including schema/storage, parameter plumbing, and validation via new unit/integration tests.

Changes:

  • Persist tags in SQL by adding an Instances.Tags column and wiring stored procedures to read/write it.
  • Plumb tag serialization/deserialization into SqlUtils and pass tags into CreateInstance / _CheckpointOrchestration.
  • Add unit + integration test coverage for tags (including backward-compat behavior when tags aren’t set).

Reviewed changes

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

Show a summary per file
File Description
test/DurableTask.SqlServer.Tests/Utils/TestService.cs Adds a helper for starting orchestrations with tags in integration tests.
test/DurableTask.SqlServer.Tests/Unit/SqlUtilsTagTests.cs New unit tests for AddTagsParameter serialization/null handling.
test/DurableTask.SqlServer.Tests/Integration/Orchestrations.cs Adds integration tests validating tags behavior (set, empty, ContinueAsNew, etc.).
test/DurableTask.SqlServer.Tests/Integration/DatabaseManagement.cs Updates expected schema script list to include schema-1.3.0.sql.
test/DurableTask.SqlServer.AzureFunctions.Tests/DurableTask.SqlServer.AzureFunctions.Tests.csproj Changes test target framework to net8.0.
src/DurableTask.SqlServer/SqlUtils.cs Adds tag read/write helpers and populates Tags on returned state/events.
src/DurableTask.SqlServer/SqlOrchestrationService.cs Passes tags into relevant stored procedure calls.
src/DurableTask.SqlServer/Scripts/schema-1.3.0.sql Adds Tags column to the Instances table.
src/DurableTask.SqlServer/Scripts/logic.sql Extends sprocs/selects to accept/store/return tags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cgillum cgillum requested a review from Copilot March 2, 2026 21:03
Copy link

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 8 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

string? json = tags != null && tags.Count > 0
? DTUtils.SerializeToJson(tags)
: null;
parameters.Add("@Tags", SqlDbType.VarChar, 8000).Value = (object?)json ?? DBNull.Value;
Copy link
Member

Choose a reason for hiding this comment

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

Given we have max length of 8000 characters, I think we need to validate the size of the tags payload to make sure it fits so that we don't run into data corruption issues. I suggest we do this at the time of orchestration creation so that we can fail early if the tags payload is too large.

{
ordinal = reader.GetOrdinal("Tags");
}
catch (IndexOutOfRangeException)
Copy link
Member

Choose a reason for hiding this comment

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

We don't catch this exception anywhere else that GetOrdinal is used. Is this necessary?

'Pending',
E.[TraceContext]
E.[TraceContext],
@Tags
Copy link
Member

Choose a reason for hiding this comment

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

I think there's an issue here where any tags explicitly created during sub-orchestration creation will get overwritten by the parent orchestration tags. Normally DTFx will try to merge any tags from the parent orchestration with any explicitly created sub-orchestration tags. However, it doesn't look like your implementation leverages the merged tags. I think what you'll need to do is get the tags from the entries in @NewOrchestrationEvents rather than passing in @Tags to this sproc to ensure we're providing the merged tags.

fanyirobin and others added 11 commits March 2, 2026 16:16
test cleanup

rollback .net version change for tets
address comments

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lServer.AzureFunctions.Tests.csproj


address comments

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
address copilot comment.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
address comment

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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