|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build and Test Commands |
| 6 | + |
| 7 | +### Building the Solution |
| 8 | +```bash |
| 9 | +# Standard build |
| 10 | +dotnet build |
| 11 | +dotnet build -c Release |
| 12 | + |
| 13 | +# Build with warnings as errors (CI validation) |
| 14 | +dotnet build -warnaserror |
| 15 | +``` |
| 16 | + |
| 17 | +### Running Tests |
| 18 | +```bash |
| 19 | +# Run all tests |
| 20 | +dotnet test -c Release |
| 21 | + |
| 22 | +# Run tests for specific framework |
| 23 | +dotnet test -c Release --framework net8.0 |
| 24 | +dotnet test -c Release --framework net48 |
| 25 | + |
| 26 | +# Run specific test by name |
| 27 | +dotnet test -c Release --filter DisplayName="TestName" |
| 28 | + |
| 29 | +# Run tests in a specific project |
| 30 | +dotnet test path/to/project.csproj -c Release |
| 31 | +``` |
| 32 | + |
| 33 | +### Incremental Testing (for changed code only) |
| 34 | +```bash |
| 35 | +# Run only unit tests for changed projects |
| 36 | +dotnet incrementalist run --config .incrementalist/testsOnly.json -- test -c Release --no-build --framework net8.0 |
| 37 | + |
| 38 | +# Run only multi-node tests for changed projects |
| 39 | +dotnet incrementalist run --config .incrementalist/mutliNodeOnly.json -- test -c Release --no-build --framework net8.0 |
| 40 | +``` |
| 41 | + |
| 42 | +### Code Quality |
| 43 | +```bash |
| 44 | +# Format check |
| 45 | +dotnet format --verify-no-changes |
| 46 | + |
| 47 | +# API compatibility check |
| 48 | +dotnet test -c Release src/core/Akka.API.Tests |
| 49 | +``` |
| 50 | + |
| 51 | +### Documentation |
| 52 | +```bash |
| 53 | +# Generate API documentation |
| 54 | +dotnet docfx metadata ./docs/docfx.json --warningsAsErrors |
| 55 | +dotnet docfx build ./docs/docfx.json --warningsAsErrors |
| 56 | +``` |
| 57 | + |
| 58 | +## High-Level Architecture |
| 59 | + |
| 60 | +### Project Structure |
| 61 | +- **`/src/core/`** - Core actor framework components |
| 62 | + - `Akka/` - Base actor system, routing, dispatchers, configuration |
| 63 | + - `Akka.Remote/` - Distributed actor communication and serialization |
| 64 | + - `Akka.Cluster/` - Clustering, gossip protocols, distributed coordination |
| 65 | + - `Akka.Persistence/` - Event sourcing, snapshots, journals |
| 66 | + - `Akka.Streams/` - Reactive streams with backpressure |
| 67 | + - `Akka.TestKit/` - Testing utilities for actor systems |
| 68 | + |
| 69 | +- **`/src/contrib/`** - Contributed modules (DI integrations, serializers, cluster extensions) |
| 70 | +- **`/src/benchmark/`** - Performance benchmarks using BenchmarkDotNet |
| 71 | +- **`/src/examples/`** - Sample applications demonstrating patterns |
| 72 | + |
| 73 | +### Key Architectural Concepts |
| 74 | +- **Actor Model**: Message-driven, hierarchical supervision, location transparency |
| 75 | +- **Fault Tolerance**: Supervision strategies, let-it-crash philosophy |
| 76 | +- **Distribution**: Remote actors, clustering, sharding |
| 77 | +- **Reactive Streams**: Backpressure-aware stream processing |
| 78 | +- **Event Sourcing**: Persistence with journals and snapshots |
| 79 | + |
| 80 | +### Testing Patterns |
| 81 | +- Inherit from `AkkaSpec` or use `TestKit` for actor tests |
| 82 | +- Use `TestProbe` for creating lightweight test actors |
| 83 | +- Use `EventFilter` for asserting log messages |
| 84 | +- Pass `ITestOutputHelper output` to test constructors for debugging |
| 85 | +- Multi-node tests use separate projects (*.Tests.MultiNode.csproj) |
| 86 | + |
| 87 | +## Code Style and Conventions |
| 88 | + |
| 89 | +### C# Style |
| 90 | +- Allman style braces (opening brace on new line) |
| 91 | +- 4 spaces indentation, no tabs |
| 92 | +- Private fields prefixed with underscore `_fieldName` |
| 93 | +- Use `var` when type is apparent |
| 94 | +- Default to `sealed` classes and records |
| 95 | +- Enable `#nullable enable` in new/modified files |
| 96 | +- Never use `async void`, `.Result`, or `.Wait()` |
| 97 | +- Always pass `CancellationToken` through async call chains |
| 98 | + |
| 99 | +### API Design |
| 100 | +- Maintain compatibility with JVM Akka while being .NET idiomatic |
| 101 | +- Use `Task<T>` instead of Future, `TimeSpan` instead of Duration |
| 102 | +- Extend-only design - don't modify existing public APIs |
| 103 | +- Preserve wire format compatibility for serialization |
| 104 | +- Include unit tests with all changes |
| 105 | + |
| 106 | +### Test Naming |
| 107 | +- Use `DisplayName` attribute for descriptive test names |
| 108 | +- Follow pattern: `Should_ExpectedBehavior_When_Condition` |
| 109 | + |
| 110 | +## Development Workflow |
| 111 | + |
| 112 | +### Git Branches |
| 113 | +- **`dev`** - Main development branch (default for PRs) |
| 114 | +- **`v1.4`**, **`v1.3`**, etc. - Version maintenance branches for older releases |
| 115 | +- Feature branches: `feature/description` |
| 116 | +- Bugfix branches: `fix/description` |
| 117 | + |
| 118 | +### Making Changes |
| 119 | +1. Always read existing code patterns in the module you're modifying |
| 120 | +2. Follow existing conventions for that specific module |
| 121 | +3. Add/update tests for your changes |
| 122 | +4. Run incremental tests before committing |
| 123 | +5. Ensure API compatibility tests pass for core changes |
| 124 | + |
| 125 | +### Target Frameworks |
| 126 | +- **.NET 8.0** - Primary target |
| 127 | +- **.NET 6.0** - Library compatibility |
| 128 | +- **.NET Framework 4.8** - Legacy support |
| 129 | +- **.NET Standard 2.0** - Library compatibility |
| 130 | + |
| 131 | +## Important Files |
| 132 | +- `Directory.Build.props` - MSBuild properties, package versions |
| 133 | +- `global.json` - .NET SDK version (8.0.403) |
| 134 | +- `xunit.runner.json` - Test configuration (60s timeout, no parallelization) |
| 135 | +- `.incrementalist/*.json` - Incremental build configurations |
| 136 | +- `RELEASE_NOTES.md` - Version history and changelog |
0 commit comments