Skip to content

.NET: Preserve table state after declarative EditTable Add - #7324

Merged
peibekwe merged 1 commit into
microsoft:mainfrom
KXHXK:fix/7323-edit-table-add-preserves-table
Jul 27, 2026
Merged

.NET: Preserve table state after declarative EditTable Add#7324
peibekwe merged 1 commit into
microsoft:mainfrom
KXHXK:fix/7323-edit-table-add-preserves-table

Conversation

@KXHXK

@KXHXK KXHXK commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

Declarative EditTable and EditTableV2 currently replace their items variable with the newly added record after an Add operation. A second Add then fails because the variable is no longer a table. This change keeps the mutated table bound to the variable so repeated additions work as expected.

AI assistance was used for codebase analysis and test scaffolding. The final implementation, diff, and validation results were reviewed by KXH.

Description & Review Guide

  • What are the major changes? Assign the mutated TableValue after Add in both executors; update existing Add assertions; add regression tests that execute two consecutive additions and verify row order.
  • What is the impact of these changes? Declarative workflows can add multiple records to the same table without losing the table binding. Update and delete behavior is unchanged.
  • What do you want reviewers to focus on? The post-Add assignment semantics in both executor versions and whether the updated assertions capture the intended state contract. Validation: 841 tests passed on net10.0, 841 tests passed on net472, the declarative project built across all target frameworks with 0 warnings/errors, and dotnet format --verify-no-changes passed.

Related Issue

Fixes #7323

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add [BREAKING] to the title prefix, before or after any language prefix) - a workflow keeps the label and title prefix in sync automatically.

Copilot AI review requested due to automatic review settings July 26, 2026 11:04
@KXHXK
KXHXK temporarily deployed to github-app-auth July 26, 2026 11:04 — with GitHub Actions Inactive
@KXHXK
KXHXK temporarily deployed to github-app-auth July 26, 2026 11:04 — with GitHub Actions Inactive
@KXHXK
KXHXK temporarily deployed to github-app-auth July 26, 2026 11:04 — with GitHub Actions Inactive
@agent-framework-automation agent-framework-automation Bot added .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Jul 26, 2026
@KXHXK
KXHXK temporarily deployed to github-app-auth July 26, 2026 11:04 — with GitHub Actions Inactive
@KXHXK
KXHXK marked this pull request as ready for review July 26, 2026 11:04
@KXHXK
KXHXK temporarily deployed to github-app-auth July 26, 2026 11:04 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a bug in the .NET declarative workflow EditTable/EditTableV2 executors where Add overwrote the bound items variable with the newly-added RecordValue, causing subsequent Add operations to fail because the variable was no longer a table.

Changes:

  • Update EditTableExecutor and EditTableV2Executor to re-assign the mutated TableValue back to the itemsVariable after AppendAsync.
  • Update existing unit tests to assert that the variable remains a table after Add.
  • Add regression tests for consecutive Add operations that verify the final table contents and row order.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/EditTableExecutor.cs Preserve table binding by assigning tableValue (not the new record) back to the items variable after Add.
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/EditTableV2Executor.cs Same table-preserving assignment semantics for the V2 executor after Add.
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableExecutorTest.cs Update assertions to expect a table result and add a consecutive-add regression test.
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableV2ExecutorTest.cs Update assertions to expect a table result and add a consecutive-add regression test validating order.

@KXHXK

KXHXK commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Signed-off-by: KXH <shepherdlaurie238@gmail.com>
@KXHXK
KXHXK force-pushed the fix/7323-edit-table-add-preserves-table branch from 3eb842c to 40aa32c Compare July 27, 2026 15:09
@KXHXK
KXHXK temporarily deployed to github-app-auth July 27, 2026 15:09 — with GitHub Actions Inactive
@peibekwe
peibekwe added this pull request to the merge queue Jul 27, 2026
Merged via the queue into microsoft:main with commit 0b0dcaa Jul 27, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Declarative EditTable/EditTableV2 Add replaces the items variable with the added record, so a second Add always fails

4 participants