Skip to content

fix(streaming): validate NATS stream dimensions - #11293

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-streaming-validate-nats-dimensions
Sep 17, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-streaming-validate-nats-dimensions

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Require NatsOptions.BatchSize, PartitionCount, and ProducerCount to be at least 1 during configuration validation. Invalid values raise an OrleansConfigurationException identifying the option and named provider, so applications receive an actionable error before provider startup.

Document the minima and cover zero, negative, and positive values through the existing silo and client validator registrations.

Extracted from #10798 because these options apply to every NATS stream provider configuration. The validation originated in a65bdcf, authored by Reuben Bond.

Microsoft Reviewers: Open in CodeFlow

Require positive batch size, partition count, and producer count during named provider validation. Cover zero, negative, and positive dimensions through silo and client registrations.

Extracted from dotnet#10798. Original validation authored by Reuben Bond <[email protected]> in a65bdcf (feat(streaming): integrate NATS with Aspire), retained at ee12e8b.
Copilot AI lite review requested due to automatic review settings September 17, 2026 02:41
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292.

Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.

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.

Copilot review overview

🟢 Approval recommended

The validation logic and tests align with the stated goal, and the only finding is a minor cleanup (unused using) which does not affect correctness.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Adds configuration-time validation for key NATS stream sizing options so misconfiguration is caught early (before provider startup) with actionable OrleansConfigurationException messages, and extends the existing test suite to cover these cases.

Changes:

  • Enforce BatchSize, PartitionCount, and ProducerCount to be ≥ 1 in NatsStreamOptionsValidator.ValidateConfiguration().
  • Document the minimum value requirements in NatsOptions XML docs.
  • Add unit tests covering invalid (0/negative) and valid (positive) values for both silo and client registrations.
File Description
test/​Extensions/​Orleans.Streaming.NATS.Tests/​NatsOptionsTests.cs Adds validation coverage for invalid/valid stream dimension options via DI-registered validators (client & silo).
src/​Orleans.Streaming.NATS/​NatsOptions.cs Documents and enforces minimum values for BatchSize, PartitionCount, and ProducerCount during configuration validation.

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

ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292.

Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 82.09% (112,237 / 136,721) 82.12% (112,272 / 136,709) -0.0328 pp
Branches 71.24% (32,272 / 45,301) 71.32% (32,306 / 45,295) -0.0845 pp

Report-only conclusion: regressed.

The current-main baseline is commit 2e40fa8a3b 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

Use the Orleans and Orleans.Hosting global imports already supplied by the Orleans build targets.
Copilot AI review requested due to automatic review settings September 17, 2026 03:32

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.

Copilot review overview

🟢 Approval recommended

The validation rules are straightforward, the error messages are specific, and the added tests cover both negative/zero and valid cases across silo and client registration paths.

Review effort: Lite
Findings: None

Resolved since last review (1)

@ReubenBond
ReubenBond merged commit 0273b7c into dotnet:main Sep 17, 2026
73 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-streaming-validate-nats-dimensions branch September 17, 2026 14:00
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292.

Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292.

Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Move independent NATS producer selection and dimension validation to dotnet#11287 and dotnet#11293. Move standalone redaction, credential, and journaling regression coverage to dotnet#11288, dotnet#11289, dotnet#11291, and dotnet#11292; move the independent DynamoDB README recipes to dotnet#11292.

Retain Token redaction, credential binding and endpoint behavior, journaling activation, and NATS credential-safe logging as prerequisites until dotnet#11288, dotnet#11290, dotnet#11292, dotnet#11289, and dotnet#11291 are merged by humans. The original PR remains focused on Aspire configuration, resource ownership, and integration coverage.
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Sep 17, 2026
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants