Repository navigation
fix(streaming): validate NATS stream dimensions - #11293
ReubenBond merged 2 commits into
Conversation
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.
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.
There was a problem hiding this comment.
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
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, andProducerCountto be ≥ 1 inNatsStreamOptionsValidator.ValidateConfiguration(). - Document the minimum value requirements in
NatsOptionsXML 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.
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.
Code coverage
Report-only conclusion: regressed. The current-main baseline is commit 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.
There was a problem hiding this comment.
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)
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.
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.
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.
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.
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.
Keep the guards from merged dotnet#11293 when replaying the original PR's pre-merge extraction cleanup.

Require
NatsOptions.BatchSize,PartitionCount, andProducerCountto be at least 1 during configuration validation. Invalid values raise anOrleansConfigurationExceptionidentifying 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