Skip to content

fix(test): guard TestCluster.Primary, which Orleans 10.3.1 makes nullable - #3541

Merged
meshweaver-cloud[bot] merged 1 commit into
mainfrom
fix/orleans-1031-nullable-primary-silo
Sep 7, 2026
Merged

meshweaver-cloud[bot] merged 1 commit into
mainfrom
fix/orleans-1031-nullable-primary-silo

Conversation

@rbuergi

@rbuergi rbuergi commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Unblocks half of #3519 — the weekly dependency sweep, which is red on two independent causes:

cause fixed by
Aspire 13.4.6 -> 13.5.3 drags in JsonPatch.Net 5.0.2 (OSMF maintenance fee) — caught by Dependency licences #3537
Microsoft.Orleans 10.2.2 -> 10.3.1 reds Build solution (once) on 2x CS8602 this PR

What actually changed upstream

Microsoft.Orleans.TestingHost annotates TestCluster.Primary as SiloHandle? from 10.3.1; it is non-nullable at the 10.1.0 we pin today (note the pin skew — the rest of Orleans is already 10.2.2). Both fixtures dereference the local they take from it.

Verified against both package sets, not reasoned about

Orleans 10.3.1 + current code -> 2 Error(s)   <- reproduces CI exactly, same file(line,col)
                                 TwoSiloCacheUpdateFixture.cs(113,28): error CS8602
                                 SharedOrleansFixture.cs(234,24):      error CS8602
Orleans 10.3.1 + this change  -> 0 Warning(s), 0 Error(s)
Orleans 10.2.2 + this change  -> 0 Warning(s), 0 Error(s)   <- main's pins; the no-regression half

Both dependents (MeshWeaver.Testing.Xunit, MeshWeaver.Hosting.Orleans.Test) also build clean at Release -warnaserror. The bump was applied locally only to produce the first two rows and reverted before committing — this PR moves no package version.

The two sites are treated differently on purpose

Each matches the posture already present a few lines below it:

  • SharedOrleansFixture propagates the null (primarySilo?.). Its silo-side registration is best-effort and already ends in if (siloRouting != null), so a cluster shape without a reachable primary should skip that registration, not fail the fixture.
  • TwoSiloCacheUpdateFixture asserts (?? throw). The property's contract is to return a hub, and it already throws when SiloHost is absent — so an absent primary is a broken fixture and has to say so there.

Making both the same would have been wrong in one of the two places.

Notes

Pairs-with: none — test-base internals only; no public type or member leaves src/.

…able

Microsoft.Orleans.TestingHost annotates TestCluster.Primary as SiloHandle?
from 10.3.1 on; it was non-nullable at the 10.1.0 we pin today. Both fixtures
dereference the local they take from it, so the weekly dependency sweep fails
the whole Release build on two CS8602 before a single test runs (#3519).

Verified against both package sets rather than reasoned about:

  Orleans 10.3.1 + current code -> 2 Error(s), the exact CI pair
                                   TwoSiloCacheUpdateFixture.cs(113,28)
                                   SharedOrleansFixture.cs(234,24)
  Orleans 10.3.1 + this change  -> 0 Warning(s), 0 Error(s)
  Orleans 10.2.2 + this change  -> 0 Warning(s), 0 Error(s)  (main's pins)

plus both dependents (MeshWeaver.Testing.Xunit, MeshWeaver.Hosting.Orleans.Test)
clean at Release -warnaserror.

The two sites get different treatment on purpose, each matching the posture
already present a few lines below it: SharedOrleansFixture propagates the null,
because its silo-side registration is best-effort and already guarded by
`if (siloRouting != null)`; TwoSiloCacheUpdateFixture throws, because the
property's contract is to return a hub and it already throws when SiloHost is
absent.

No What's New entry: test-base only, no user-visible surface — the same
treatment as #3531.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 7, 2026 06:19
@meshweaver-cloud
meshweaver-cloud Bot enabled auto-merge September 7, 2026 06:19

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 changes are narrowly scoped to test fixtures, correctly address the nullable TestCluster.Primary contract change, and don’t introduce behavioral risk outside the intended failure/skip postures.

Pull request overview

Updates Orleans test fixtures to handle TestCluster.Primary becoming nullable in Microsoft.Orleans.TestingHost 10.3.1, eliminating CS8602 null-dereference build failures under -warnaserror while preserving each fixture’s intended behavior.

Changes:

  • Guard TwoSiloCacheUpdateFixture.PrimarySiloMeshHub with an explicit InvalidOperationException when Cluster.Primary is absent.
  • Make SharedOrleansFixture’s silo-side routing registration best-effort by propagating null via ?. instead of dereferencing Cluster.Primary.
File summaries
File Description
test/MeshWeaver.Hosting.Orleans.TestBase/TwoSiloCacheUpdateFixture.cs Adds a hard guard (?? throw) for Cluster.Primary to satisfy the property’s “must return a hub” contract and avoid nullable deref.
test/MeshWeaver.Hosting.Orleans.TestBase/SharedOrleansFixture.cs Switches reflection access on Cluster.Primary to null-conditional chaining so the existing best-effort routing registration can be skipped safely.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 1)

492 tests  ±0   492 ✅ ±0   36s ⏱️ -7s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 0)

251 tests  ±0   251 ✅ ±0   2m 26s ⏱️ +9s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 3)

1 034 tests  ±0   1 034 ✅ ±0   1m 6s ⏱️ -10s
    2 suites ±0       0 💤 ±0 
    2 files   ±0       0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 5)

    5 files  ±0      5 suites  ±0   2m 11s ⏱️ -6s
1 473 tests ±0  1 473 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 474 runs  ±0  1 474 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 4)

1 600 tests  ±0   1 406 ✅ ±0   2m 6s ⏱️ +13s
    4 suites ±0     194 💤 ±0 
    4 files   ±0       0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 2)

1 113 tests  ±0   1 113 ✅ ±0   3m 27s ⏱️ -1s
    3 suites ±0       0 💤 ±0 
    3 files   ±0       0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Test Results

   16 files  ±0     16 suites  ±0   11m 54s ⏱️ ±0s
5 963 tests ±0  5 769 ✅ ±0  194 💤 ±0  0 ❌ ±0 
5 964 runs  ±0  5 770 ✅ ±0  194 💤 ±0  0 ❌ ±0 

Results for commit c27225d. ± Comparison against base commit d2a564c.

@meshweaver-cloud
meshweaver-cloud Bot added this pull request to the merge queue Sep 7, 2026
Merged via the queue into main with commit f498150 Sep 7, 2026
30 checks passed
@rbuergi
rbuergi deleted the fix/orleans-1031-nullable-primary-silo branch October 10, 2026 13:10
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