Skip to content

perf(tests): decouple generator and serialization test graphs - #11646

Merged
ReubenBond merged 6 commits into
dotnet:mainfrom
ReubenBond:rb-lean-shared-test-dependencies
Nov 2, 2026
Merged

ReubenBond merged 6 commits into
dotnet:mainfrom
ReubenBond:rb-lean-shared-test-dependencies

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Generator and serialization tests inherit Azure providers, test grains, F# grain builds, and versioned-grain deployment preparation through a reference to the runtime-test executable. Their build paths should instead follow the helpers and metadata fixtures they actually consume.

TestUtilities owns only the shared suite/provider/area/category attributes. Generator tests, serialization tests, clustering test-kit tests, and TestExtensions consume this small, non-packable library through ordinary project references. It has no Orleans serialization or code-generation dependency.

Serialization tests and event-sourced test grains each own a local XML codec/surrogate. Both copies retain the XML text format, member ID, and deep-copy behavior. The grain copy retains its original namespace and assembly ownership; the serialization-test copy lives in that suite's namespace.

Give the generator and serialization suites independent local copies of their AOT contract/payload fixtures, and give the native smoke project local copies of its DI and grain-reference fixtures. These replace cross-project source inclusions while preserving the fixture implementations, assertions, native scenarios, and diagnostic gates. The local context/factory copies use the landed GeneratedContext, GeneratedContextType<T>, and AddGeneratedContext APIs and retain the new context contracts.

The landed ExtractReferenceAssemblyData_PreservesFSharpRecordsAndUnionCases regression gets a small, source-owning FSharpCodeGenModels library containing genuine Orleans-attributed generic record and union declarations. Its assertions still cover the generic shapes, record member ID, nested union-case identity, and empty diagnostics. Existing F# runtime models, grains, and their broader coverage retain their original ownership. The fixture depends only on serialization abstractions and the existing FSharp.Core package. Standard raw-fixture ProduceReferenceAssembly=false settings are retained; consumers use ordinary project references without ReferencePath overrides.

Remove DefaultCluster.Tests' unused reference to the generator-test executable and make its formerly transitive Xunit import explicit. Its runtime-codegen grains and cluster fixtures retain their existing ownership.

Focused suite Original inherited project closure Lean project closure
CodeGenerator.Tests 34 14
Serialization.UnitTests 38 18

These are unique-project closures across declared frameworks. The focused graphs retain a small explicit F# metadata fixture while shedding the runtime-test and versioned-grain deployment graph. Elapsed-time speedups are unclaimed.

Full generator and serialization suites pass on net8 and net10, including the landed F# metadata regression and all XML cases. Existing test coverage remains present; the landed API rename changes three invalid-context theory argument identities, and current main adds generator cases. Trait contracts and XML chat tests pass on both frameworks. DI, grain-reference, context, and factory native smoke scenarios publish and execute through the repository's diagnostic gates.

Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 30, 2026 02:48

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.

🟢 Approval recommended

No active review issues are reported for the test dependency cleanup.

No open issues 🎉

What changed in this PR

This PR reduces the build dependencies of the generator and serialization test suites by source-linking shared helpers instead of referencing the runtime-test executable. The XML helper retains its existing ownership and behavior in TestGrainInterfaces.

Changes:

  • Source-link test traits into both focused suites and the XML codec into serialization tests.
  • Extract the XML codec and surrogate into a standalone, shared source file.
  • Remove DefaultCluster.Tests’ unused generator-test reference and add an explicit Xunit import.
File Description
test/​Orleans.Serialization.UnitTests/​Orleans.Serialization.UnitTests.csproj Links shared traits and XML helpers; removes the runtime-test reference.
test/​Orleans.DefaultCluster.Tests/​Orleans.DefaultCluster.Tests.csproj Removes the unused generator-test reference.
test/​Orleans.DefaultCluster.Tests/​GrainActivateDeactivateTests.cs Adds an explicit Xunit import.
test/​Orleans.CodeGenerator.Tests/​Orleans.CodeGenerator.Tests.csproj Links shared traits; removes the runtime-test reference.
test/​Grains/​TestGrainInterfaces/​EventSourcing/​XDocumentSerialization.cs Houses the extracted XML codec and surrogate without behavioral changes.
test/​Grains/​TestGrainInterfaces/​EventSourcing/​IChatGrain.cs Removes the extracted helper definitions and their unused imports.

Review effort: Balanced

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 84.19% (121,425 / 144,230) 84.13% (121,341 / 144,230) +0.0582 pp
Branches 74.54% (36,826 / 49,405) 74.46% (36,788 / 49,405) +0.0769 pp

Report-only conclusion: improved.

The current-main baseline is commit a5d50300bc and uses the same reviewed coverage matrix.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

@ReubenBond
ReubenBond force-pushed the rb-lean-shared-test-dependencies branch from 6d6c991 to cff434f Compare October 31, 2026 05:47
Copilot AI balanced review requested due to automatic review settings October 31, 2026 05:47

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.

🟢 Approval recommended

No active review issues are recorded for the refactor separating shared test helpers and metadata fixtures from runtime-test infrastructure.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 31, 2026 14:08

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.

🟢 Approval recommended

The test-dependency refactor has no active review issues blocking approval.

No open issues 🎉

Review effort: Balanced

Source-link canonical test traits and the shared XML codec instead of inheriting the Runtime.Tests deployment graph. Keep the XML helper in its original grain-interface assembly and retain its wire shape and deep-copy behavior.

Remove DefaultCluster.Tests' unused generator-test executable reference and make its Xunit import explicit so the focused suites remain leaf assemblies.
Replace cross-project trait and XML source inclusions with TestUtilities project references. Compile each helper once while keeping generator and serialization loops independent of runtime-test deployment.
Give the landed generic record and union metadata regression a two-type FSharp fixture which owns its sources and references only serialization abstractions. Preserve its member IDs, nested union-case assertions, and diagnostics while leaving runtime FSharp models unchanged.

Refresh shared test helper ownership guidance after moving traits and XML serialization into TestUtilities.
Give serialization tests and event-sourced grains their own small XML helper implementations. Keep TestUtilities limited to shared test traits without serialization or code-generation dependencies.

Replace cross-project AOT fixture source inclusions with independent local copies, preserving every payload, assertion, native scenario, and diagnostic gate.
Reconcile the independent AOT contract copies with the landed GeneratedContext family, preserving context metadata, nested import cases, native gates, and local fixture ownership.
@ReubenBond
ReubenBond force-pushed the rb-lean-shared-test-dependencies branch from bf29381 to a96293e Compare November 1, 2026 22:04
Copilot AI balanced review requested due to automatic review settings November 1, 2026 22:04

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.

🟡 Changes recommended

The test suite fails with FileNotFoundException after an isolated clean build because the F# theory still loads assemblies from projects absent from the new generator-test dependency graph.

1 open issue

Review effort: Balanced

Use the owned raw FSharp model fixture and in-memory generated CSharp service images instead of reading unreachable runtime-test output directories. Preserve full/reference service rejection cases and the original multicase struct union shape.

Grant the fixed service producer friend access to internal FSharp union-case types, matching the existing generated-service boundary. Both full suites pass after isolated rebuilds with the old model/service DLLs absent.
Copilot AI balanced review requested due to automatic review settings November 1, 2026 22:17

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.

🟢 Approval recommended

No active review issues block approval of the test-dependency decoupling changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@ReubenBond
ReubenBond merged commit 9a0c764 into dotnet:main Nov 2, 2026
95 checks passed
@ReubenBond
ReubenBond deleted the rb-lean-shared-test-dependencies branch November 2, 2026 04:55
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.

2 participants