Skip to content

docs: modernize grain programming guidance - #10334

Merged
ReubenBond merged 3 commits into
dotnet:mainfrom
ReubenBond:reubenbond-modernize-grain-programming-docs
Aug 6, 2026
Merged

ReubenBond merged 3 commits into
dotnet:mainfrom
ReubenBond:reubenbond-modernize-grain-programming-docs

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 2, 2026

Copy link
Copy Markdown
Member

Modernizes the grain programming documentation around Orleans 10 APIs and behavior. It covers contracts, activation and lifecycle, identity and calls, scheduling, timers and reminders, observers, placement and migration, filters, extensions, and grain services while removing legacy version narratives and correcting current defaults and experimental diagnostics.

Microsoft Reviewers: Open in CodeFlow

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1f2dcc52-4f1d-4a86-b7c4-68d9abdb53bf
Copilot AI review requested due to automatic review settings August 2, 2026 21:26

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.

Pull request overview

This PR refreshes the Orleans grain programming documentation to align with Orleans 10 APIs and current runtime behavior, consolidating guidance and removing legacy/version-pivot narratives across the grains documentation set.

Changes:

  • Updates core grains conceptual docs (contracts, references/identity, scheduling, lifecycle, placement/migration) to Orleans 10 semantics and APIs.
  • Modernizes feature-specific guidance (timers/reminders, cancellation, one-way calls, observers, call filters, extensions, grain services) with current APIs and best-effort vs durable boundaries.
  • Simplifies and tightens code-generation/source-generation documentation around build-time generation and serializer annotations.
Show a summary per file
File Description
docs/site/src/content/docs/grains/timers-and-reminders.md Refocuses periodic work guidance around Orleans 10 grain timers vs durable reminders.
docs/site/src/content/docs/grains/stateless-worker-grains.md Modernizes stateless worker overview and scaling behavior guidance.
docs/site/src/content/docs/grains/request-scheduling.md Rewrites scheduling/interleaving/reentrancy guidance with Orleans 10 terms and APIs.
docs/site/src/content/docs/grains/request-context.md Updates RequestContext usage, propagation model, and security cautions.
docs/site/src/content/docs/grains/oneway.md Clarifies one-way call semantics and appropriate use cases.
docs/site/src/content/docs/grains/observers.md Updates observer guidance, lifecycle, and ObserverManager usage for Orleans 10.
docs/site/src/content/docs/grains/interceptors.md Reframes grain call filters around current context APIs and pipeline behavior.
docs/site/src/content/docs/grains/index.md Rewrites “develop grains” entry point around Orleans 10 contracts, activation, and reliability.
docs/site/src/content/docs/grains/grainservices.md Updates grain service concepts and example patterns for Orleans 10.
docs/site/src/content/docs/grains/grain-references.md Modernizes grain reference concepts, resolution rules, and casting guidance.
docs/site/src/content/docs/grains/grain-placement.md Updates placement/migration defaults and Orleans 10 experimental movement features.
docs/site/src/content/docs/grains/grain-placement-filtering.md Modernizes placement filtering docs and examples for Orleans 10 experimental APIs.
docs/site/src/content/docs/grains/grain-lifecycle.md Rewrites lifecycle and migration participation guidance for Orleans 10.
docs/site/src/content/docs/grains/grain-identity.md Updates identity/GrainId guidance and key selection patterns for Orleans 10.
docs/site/src/content/docs/grains/grain-extensions.md Refocuses extensions guidance on Orleans 10 patterns and cautions.
docs/site/src/content/docs/grains/external-tasks-and-grains.md Updates external work guidance (Task.Run/ConfigureAwait) for Orleans 10 scheduling model.
docs/site/src/content/docs/grains/code-generation.md Reframes docs around Orleans 10 build-time source generation and serializer annotations.
docs/site/src/content/docs/grains/cancellation-tokens.md Modernizes cancellation semantics and config guidance for Orleans 10.

Copilot's findings

  • Files reviewed: 18/18 changed files
  • Comments generated: 1

Comment thread docs/site/src/content/docs/grains/grain-placement-filtering.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1f2dcc52-4f1d-4a86-b7c4-68d9abdb53bf
Copilot AI review requested due to automatic review settings August 3, 2026 17:23

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's findings

Suppressed comments (6)

docs/site/src/content/docs/grains/grain-placement-filtering.md:58

  • This attribute example uses a collection expression (["rack", "zone"]) as an attribute argument, which is not valid in C# attribute syntax. Use an array creation expression instead so the sample compiles.
[PreferredMatchSiloMetadataPlacementFilter(
    ["rack", "zone"],
    minCandidates: 2)]

docs/site/src/content/docs/grains/grain-placement-filtering.md:77

  • This attribute example uses a collection expression (["tier"]) as an attribute argument, which is not valid in C# attribute syntax. Use an array creation expression instead so the sample compiles.
[RequiredMatchSiloMetadataPlacementFilter(
    ["tier"],
    order: 0)]

docs/site/src/content/docs/grains/grain-placement-filtering.md:81

  • This attribute example uses a collection expression (["rack", "zone"]) as an attribute argument, which is not valid in C# attribute syntax. Use an array creation expression instead so the sample compiles.
[PreferredMatchSiloMetadataPlacementFilter(
    ["rack", "zone"],
    minCandidates: 2,
    order: 10)]

docs/site/src/content/docs/grains/grain-references.md:48

  • The marker-interface example uses public interface ... : ICounterGrain;, which is not valid C#. Interfaces require a body, even when empty, so readers copying this snippet will get a compile error.
public interface IUpCounterGrain : ICounterGrain;

public interface IDownCounterGrain : ICounterGrain;

docs/site/src/content/docs/grains/grain-placement-filtering.md:39

  • This attribute example uses a collection expression (["zone", "tier"]) as an attribute argument, which is not valid in C# attribute syntax. Use an array creation expression instead so the sample compiles.

This issue also appears in the following locations of the same file:

  • line 56
  • line 75
  • line 78
[RequiredMatchSiloMetadataPlacementFilter(
    ["zone", "tier"])]

docs/site/src/content/docs/grains/grain-placement.md:16

  • The description of resource-optimized placement omits the MaxAvailableMemory signal, but the implementation and options include it (ResourceOptimizedPlacementOptions.MaxAvailableMemoryWeight) and it contributes to the score. Consider mentioning it and including it in the configuration snippet to avoid misleading readers.
<xref:Orleans.Runtime.ResourceOptimizedPlacement> is the default placement strategy. It uses sampled silo runtime statistics and a power-of-k-choices algorithm to balance new activations while avoiding overloaded silos. It considers CPU, memory, available memory, activation count, and a preference for the local silo.

Configure its weights through <xref:Orleans.Configuration.ResourceOptimizedPlacementOptions>:
  • Files reviewed: 18/18 changed files
  • Comments generated: 0 new

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1f2dcc52-4f1d-4a86-b7c4-68d9abdb53bf
Copilot AI review requested due to automatic review settings August 5, 2026 13: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.

Copilot's findings

  • Files reviewed: 18/18 changed files
  • Comments generated: 0 new

ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Aug 5, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9be838b5-7660-444e-b2c5-bf2e9b373472
@ReubenBond
ReubenBond merged commit 14f3f29 into dotnet:main Aug 6, 2026
67 checks passed
@ReubenBond
ReubenBond deleted the reubenbond-modernize-grain-programming-docs branch August 6, 2026 22:28
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Aug 7, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9be838b5-7660-444e-b2c5-bf2e9b373472
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