Skip to content

Add Hosting and Abstractions projects with initial dependencies and configuration#5

Merged
snovak7 merged 1 commit intomainfrom
4-add-runtime-server-hosting-defaults
Aug 11, 2025
Merged

Add Hosting and Abstractions projects with initial dependencies and configuration#5
snovak7 merged 1 commit intomainfrom
4-add-runtime-server-hosting-defaults

Conversation

@snovak7
Copy link
Copy Markdown
Contributor

@snovak7 snovak7 commented Aug 11, 2025

Closes #4

Summary by Sourcery

Introduce new Hosting and Abstractions projects with initial dependencies and configuration, including Orleans integration for runtime hosting and shared constants, and update the solution and build configurations accordingly

New Features:

  • Add Hosting project with HostApplicationBuilderExtensions to configure Orleans-based runtime server with event sourcing defaults, hosting defaults, and activity propagation
  • Add Abstractions project containing Constants for runtime server naming and ActivitySource

Enhancements:

  • Integrate new Hosting and Abstractions projects into the solution, editor and global configs, and build/package props

Chores:

  • Add initial csproj files, package lock files, PublicAPI definitions, and assembly metadata for both projects

Summary by CodeRabbit

  • New Features

    • Added hosting extensions to quickly bootstrap an Orleans-based runtime server with default event-sourcing providers, activity propagation, and configuration-driven hosting (including Kubernetes).
    • Introduced abstractions for tracing/activity source.
    • Added new Abstractions and Hosting modules.
  • Chores

    • Disabled specific code analysis warnings globally (StyleCop SA1135) and ReSharper namespace highlighting for C#.
    • Adjusted build configuration for public API files and removed an unused dependency.
    • Added package lock files for reproducible builds and updated the solution to include new modules.

@snovak7 snovak7 self-assigned this Aug 11, 2025
@snovak7 snovak7 linked an issue Aug 11, 2025 that may be closed by this pull request
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Aug 11, 2025

Reviewer's Guide

This pull request introduces two new projects—Abstractions and Hosting—into the solution, updates global configuration to include them, and implements initial Orleans-based hosting extension methods along with a constants class for runtime instrumentation.

Class diagram for new HostApplicationBuilderExtensions in Hosting project

classDiagram
    class HostApplicationBuilderExtensions {
        +HostApplicationBuilder UseRuntimeServer(HostApplicationBuilder builder)
        -HostApplicationBuilder AddEventSourcingDefaults(HostApplicationBuilder builder)
        -HostApplicationBuilder AddHostingDefaults(HostApplicationBuilder builder)
        -HostApplicationBuilder AddActivityPropagation(HostApplicationBuilder builder)
    }
    class HostApplicationBuilder
    HostApplicationBuilderExtensions --|> HostApplicationBuilder: extends via extension methods
Loading

Class diagram for new Constants class in Abstractions project

classDiagram
    class Constants {
    }
    class Runtime {
    }
    class Server {
        +const string Name
        +static readonly ActivitySource Source
    }
    Constants o-- Runtime
    Runtime o-- Server
    Server ..> ActivitySource: uses
Loading

File-Level Changes

Change Details Files
Add Abstractions project scaffold with constants and assembly metadata
  • Introduce Constants class with Runtime.Server nested types and ActivitySource
  • Add CLS and COM visibility assembly attributes
  • Create project file, public API text, and lock file
src/Abstractions/Constants.cs
src/Abstractions/Properties/AssemblyInfo.cs
src/Abstractions/Escendit.Extensions.Hosting.Abstractions.csproj
src/Abstractions/PublicAPI.Shipped.txt
src/Abstractions/packages.lock.json
Add Hosting project scaffold and Orleans extension methods
  • Implement HostApplicationBuilderExtensions with methods: UseRuntimeServer, AddEventSourcingDefaults, AddHostingDefaults, AddActivityPropagation
  • Add CLS compliance assembly attribute
  • Create project file, public API text, and lock file
src/Hosting/HostApplicationBuilderExtensions.Orleans.cs
src/Hosting/Properties/AssemblyInfo.cs
src/Hosting/Escendit.Extensions.Hosting.csproj
src/Hosting/PublicAPI.Shipped.txt
src/Hosting/packages.lock.json
Update solution and global build configuration for new projects
  • Merge and update editorconfig and globalconfig
  • Adjust Directory.Build.props and Directory.Packages.props
  • Add new projects to Solution.slnx
.editorconfig
.globalconfig
Directory.Build.props
Directory.Packages.props
Solution.slnx

Assessment against linked issues

Issue Objective Addressed Explanation
#4 Provide extensions for bootstrapping Orleans Server as a Runtime Server.
#4 Add default configuration and dependencies for hosting a runtime server.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 11, 2025

Walkthrough

Introduces two new projects (Abstractions and Hosting), adds an Orleans bootstrapping extension UseRuntimeServer, provides runtime tracing constants, and updates solution and configuration files (.editorconfig, .globalconfig, Directory.*.props, package locks). Also adjusts package settings and public API analyzer item definitions.

Changes

Cohort / File(s) Summary
Repository configuration
/.editorconfig, /.globalconfig, /Directory.Build.props, /Directory.Packages.props, /Solution.slnx
Adds ReSharper namespace highlighting suppression for C#; disables StyleCop SA1135; switches AdditionalFiles from Update→Include; removes Microsoft.SourceLink.GitHub version entry; adds two src projects to the solution.
Abstractions project (new)
/src/Abstractions/Escendit.Extensions.Hosting.Abstractions.csproj, /src/Abstractions/Constants.cs, /src/Abstractions/Properties/AssemblyInfo.cs, /src/Abstractions/PublicAPI.Shipped.txt, /src/Abstractions/packages.lock.json
Creates SDK project; introduces runtime/server constants with ActivitySource; sets CLSCompliant and ComVisible to false; adds PublicAPI baseline and package lock.
Hosting project (new)
/src/Hosting/Escendit.Extensions.Hosting.csproj, /src/Hosting/HostApplicationBuilderExtensions.Orleans.cs, /src/Hosting/Properties/AssemblyInfo.cs, /src/Hosting/PublicAPI.Shipped.txt, /src/Hosting/packages.lock.json
Creates SDK project with Orleans and related dependencies; adds UseRuntimeServer extension configuring event sourcing, hosting (incl. Kubernetes), and activity propagation; sets CLSCompliant to false; adds PublicAPI baseline and package lock.

Sequence Diagram(s)

sequenceDiagram
    actor App
    participant Builder as HostApplicationBuilder
    participant Ext as HostApplicationBuilderExtensions
    participant Orleans as Orleans SiloBuilder
    participant Config as IConfiguration

    App->>Ext: UseRuntimeServer(builder)
    Ext->>Builder: AddEventSourcingDefaults()
    Builder->>Orleans: UseOrleans(...AddLog/StateStorageConsistency)
    Ext->>Builder: AddHostingDefaults()
    Builder->>Config: Read "Escendit:Runtime:Server:Hosting"
    alt Hosting == "Kubernetes"
        Builder->>Orleans: UseKubernetesHosting()
    end
    Ext->>Builder: AddActivityPropagation()
    Builder->>Orleans: AddActivityPropagation()
    Ext-->>App: HostApplicationBuilder
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Add runtime server hosting defaults via extensions [#4]

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Disable SA1135 StyleCop diagnostic (.globalconfig, line 2) Linting rule change not required to implement runtime server hosting defaults.
Change AdditionalFiles Update→Include for PublicAPI files (Directory.Build.props, lines ~30–40) Build item behavior change unrelated to adding Orleans hosting extensions.
Remove Microsoft.SourceLink.GitHub version (Directory.Packages.props, line ~15) Package management change not tied to the runtime server extension.
Suppress ReSharper namespace highlighting (.editorconfig, line 1) IDE-specific setting unrelated to the feature implementation.

Possibly related PRs

Poem

I nibble code like clover green,
New hosts arise—Orleans unseen.
With grains of config, locks aligned,
A runtime warren, well-defined.
When Kubernetes calls, I hop—
Trace carrots glow, we never stop. 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 4-add-runtime-server-hosting-defaults

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the area/dev-tooling Development Tooling label Aug 11, 2025
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @snovak7 - I've reviewed your changes - here's some feedback:

  • Consolidate the multiple UseOrleans calls into a single pipeline to avoid reconfiguring the silo builder multiple times.
  • In AddHostingDefaults, change the switch to return and apply the updated siloBuilder instead of assigning to discard so UseKubernetesHosting actually takes effect.
  • Consider flattening or reorganizing the nested static classes in Constants to improve readability and avoid suppressing CA1034.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consolidate the multiple UseOrleans calls into a single pipeline to avoid reconfiguring the silo builder multiple times.
- In AddHostingDefaults, change the switch to return and apply the updated siloBuilder instead of assigning to discard so UseKubernetesHosting actually takes effect.
- Consider flattening or reorganizing the nested static classes in Constants to improve readability and avoid suppressing CA1034.

## Individual Comments

### Comment 1
<location> `src/Abstractions/Properties/AssemblyInfo.cs:6` </location>
<code_context>
+
+using System.Runtime.InteropServices;
+
+[assembly: CLSCompliant(false)]
+[assembly: ComVisible(false)]
</code_context>

<issue_to_address>
Consider documenting the rationale for disabling CLS compliance and COM visibility.

If this is a public API, please clarify why these attributes are set, as it may affect library consumers and future maintenance.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/Abstractions/Properties/AssemblyInfo.cs
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (7)
src/Hosting/Properties/AssemblyInfo.cs (1)

1-4: Add ComVisible(false) and explicit usings for consistency and resilience

For parity with Abstractions and to avoid accidental COM exposure, add ComVisible(false). Also consider adding explicit using System; (and System.Runtime.InteropServices) to avoid relying on ImplicitUsings.

Apply:

+using System;
+using System.Runtime.InteropServices;
 
 [assembly: CLSCompliant(false)]
+[assembly: ComVisible(false)]
src/Abstractions/Properties/AssemblyInfo.cs (1)

4-7: Add explicit using System; to ensure CLSCompliant resolves even if ImplicitUsings change

If ImplicitUsings are disabled later, CLSCompliant won’t resolve. Add using System; explicitly.

 using System.Runtime.InteropServices;
+using System;
 
 [assembly: CLSCompliant(false)]
 [assembly: ComVisible(false)]
src/Abstractions/Constants.cs (1)

28-33: Optional: consider an alternative to nested public types to avoid CA1034 suppression

If API design allows, flatten the type hierarchy (e.g., Escendit.Extensions.Hosting.Abstractions.RuntimeServerConstants) to avoid disabling CA1034. Otherwise, the current approach is acceptable.

src/Hosting/HostApplicationBuilderExtensions.Orleans.cs (3)

58-66: Make hosting mode check case-insensitive and avoid discard of the switch result

Ensure "kubernetes" works regardless of casing, and call the method directly for clarity.

-                var hostingMode = builder
-                    .Configuration
-                    .GetValue<string>("Hosting");
-
-                _ = hostingMode switch
-                {
-                    "Kubernetes" => siloBuilder.UseKubernetesHosting(),
-                    _ => siloBuilder,
-                };
+                var hostingMode = builder.Configuration.GetValue<string>("Hosting");
+                if (string.Equals(hostingMode, "Kubernetes", StringComparison.OrdinalIgnoreCase))
+                {
+                    siloBuilder.UseKubernetesHosting();
+                }

Note: add using System; if not already available via ImplicitUsings.


71-76: Consistency: add ArgumentNullException.ThrowIfNull(builder) like other helpers

Maintain consistent guard clauses across helpers.

 private static HostApplicationBuilder AddActivityPropagation(this HostApplicationBuilder builder)
 {
-    return builder
+    ArgumentNullException.ThrowIfNull(builder);
+    return builder
         .UseOrleans(siloBuilder => siloBuilder
             .AddActivityPropagation());
 }

51-54: Scope binding for ClusterOptions to a section to avoid over-binding

Binding the entire root config may bind unintended keys. Consider scoping to a section (e.g., "Orleans:ClusterOptions").

-    .Configure<ClusterOptions>(configureOptions => builder
-        .Configuration
-        .Bind(configureOptions));
+    .Configure<ClusterOptions>(
+        builder.Configuration.GetSection("Orleans:ClusterOptions").Bind);
src/Abstractions/Escendit.Extensions.Hosting.Abstractions.csproj (1)

1-1: Consider adding minimal project configuration for clarity.

This project file is extremely minimal. For an Abstractions project, consider adding basic configuration to make the purpose clearer and ensure consistency:

-<Project Sdk="Microsoft.NET.Sdk" />
+<Project Sdk="Microsoft.NET.Sdk">
+  <!-- This project inherits common configuration from Directory.Build.props -->
+  <!-- Contains abstractions and shared constants for hosting extensions -->
+</Project>

While the current approach works (inheriting everything from Directory.Build.props), adding a comment clarifies the intentional minimal nature and documents the project's purpose.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d00987 and b76cde2.

📒 Files selected for processing (15)
  • .editorconfig (1 hunks)
  • .globalconfig (1 hunks)
  • Directory.Build.props (1 hunks)
  • Directory.Packages.props (0 hunks)
  • Solution.slnx (1 hunks)
  • src/Abstractions/Constants.cs (1 hunks)
  • src/Abstractions/Escendit.Extensions.Hosting.Abstractions.csproj (1 hunks)
  • src/Abstractions/Properties/AssemblyInfo.cs (1 hunks)
  • src/Abstractions/PublicAPI.Shipped.txt (1 hunks)
  • src/Abstractions/packages.lock.json (1 hunks)
  • src/Hosting/Escendit.Extensions.Hosting.csproj (1 hunks)
  • src/Hosting/HostApplicationBuilderExtensions.Orleans.cs (1 hunks)
  • src/Hosting/Properties/AssemblyInfo.cs (1 hunks)
  • src/Hosting/PublicAPI.Shipped.txt (1 hunks)
  • src/Hosting/packages.lock.json (1 hunks)
💤 Files with no reviewable changes (1)
  • Directory.Packages.props
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/Abstractions/Properties/AssemblyInfo.cs (1)
src/Abstractions/Constants.cs (1)
  • Runtime (18-35)
🔇 Additional comments (9)
.editorconfig (1)

25-25: LGTM: ReSharper namespace highlighting disabled for C#

This aligns with the global SA1135 disable and avoids noisy namespace ordering warnings across the new projects.

.globalconfig (1)

6-8: LGTM: SA1135 disabled globally

Matches the repo’s direction to relax namespace ordering checks; keeps build noise down without affecting runtime behavior.

src/Hosting/PublicAPI.Shipped.txt (1)

1-1: Ignore Unshipped API file suggestion for Hosting
There are no new public types or extension methods in the src/Hosting folder, so no PublicAPI.Unshipped.txt entry is needed.

Likely an incorrect or invalid review comment.

src/Abstractions/Constants.cs (1)

4-10: Fix compile error: using directives must precede file-scoped namespace

using System.Diagnostics; appears after a file-scoped namespace; that’s invalid C#. Move the using above the namespace (or convert to a block-scoped namespace).

Apply:

-namespace Escendit.Extensions.Hosting.Abstractions;
-
-#pragma warning disable CA1034
-
-using System.Diagnostics;
+using System.Diagnostics;
+
+namespace Escendit.Extensions.Hosting.Abstractions;
+
+#pragma warning disable CA1034

Likely an incorrect or invalid review comment.

src/Hosting/Escendit.Extensions.Hosting.csproj (1)

1-12: LGTM! Well-structured Orleans hosting project.

The package selection excellently supports the PR objective of providing Orleans server hosting defaults:

  • Microsoft.Orleans.Server provides core Orleans server functionality
  • Microsoft.Orleans.EventSourcing enables event sourcing capabilities
  • Microsoft.Orleans.Hosting.Kubernetes supports Kubernetes deployments
  • Microsoft.Extensions.Http.Resilience and Microsoft.Extensions.ServiceDiscovery add modern service communication patterns

The ProjectReference to the Abstractions project is correctly configured, and omitting version numbers is appropriate given the central package management configuration.

Directory.Build.props (1)

64-65: LGTM! Correct change for new projects with Public API tracking.

Changing from Update to Include is appropriate when adding new projects that will have their own PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt files. The Update attribute modifies existing items, while Include adds new items to the build, which is what's needed for the new Abstractions and Hosting projects.

Solution.slnx (1)

2-8: LGTM! Proper solution structure for the new projects.

The solution file correctly adds both new projects under the /src/ folder with appropriate organization. The folder structure is clean and the project paths are correctly specified.

src/Hosting/packages.lock.json (1)

1-1074: LGTM! Comprehensive package lock file ensures reproducible builds.

This lock file properly captures all dependencies for the Hosting project with:

  • Consistent Orleans 9.2.1 versions across all Orleans packages
  • Appropriate Microsoft.Extensions package versions
  • Content hashes for security and integrity verification
  • Proper inclusion of the Abstractions project as a Project reference

The extensive dependency tree is expected for Orleans-based projects due to the framework's comprehensive feature set.

src/Abstractions/packages.lock.json (1)

1-58: LGTM! Minimal and appropriate lock file for an Abstractions project.

This lock file correctly contains only development-time dependencies:

  • Code analysis tools (SonarAnalyzer, Roslynator, Meziantou.Analyzer)
  • Escendit tooling packages for branding and analysis
  • PublicAPI analyzers for API surface tracking

The minimal dependency footprint is appropriate for an Abstractions project that should primarily contain interfaces, constants, and shared contracts without runtime dependencies.

Comment thread src/Abstractions/PublicAPI.Shipped.txt
Comment thread src/Hosting/HostApplicationBuilderExtensions.Orleans.cs
Comment thread src/Hosting/HostApplicationBuilderExtensions.Orleans.cs
@snovak7 snovak7 merged commit a903cf2 into main Aug 11, 2025
4 checks passed
@snovak7 snovak7 deleted the 4-add-runtime-server-hosting-defaults branch August 11, 2025 19:03
This was referenced Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/dev-tooling Development Tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Runtime Server Hosting Defaults

1 participant