Skip to content

Commit d2556d4

Browse files
ncipollinaclaude
andauthored
feat: add CLAUDE.md and update package references (#23)
* feat: add CLAUDE.md and update package references to latest versions - Add comprehensive CLAUDE.md documentation for Claude Code guidance - Update GitHub Actions workflows to use v6.1 templates with MTP support - Update package references to latest versions (AWS SDK, Microsoft.Extensions) - Enable Microsoft Testing Platform runner in test project - Update xUnit to v3.0.0 and other test dependencies 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: enable code coverage in PR build with 80% threshold * feat: add Microsoft.Testing.Extensions.CodeCoverage package for coverage collection --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0bf3227 commit d2556d4

7 files changed

Lines changed: 98 additions & 23 deletions

File tree

.github/workflows/build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ on:
1111
permissions: write-all
1212
jobs:
1313
build:
14-
uses: LayeredCraft/devops-templates/.github/workflows/package-build.yaml@v3.2
14+
uses: LayeredCraft/devops-templates/.github/workflows/package-build.yaml@v6.1
1515
with:
1616
dotnet-version: |
1717
8.0.x
1818
9.0.x
19+
hasTests: true
20+
useMtpRunner: true
21+
testDirectory: "test"
1922
secrets: inherit

.github/workflows/pr-build.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ on:
77
permissions: write-all
88
jobs:
99
build:
10-
uses: LayeredCraft/devops-templates/.github/workflows/pr-build.yaml@v3.2
10+
uses: LayeredCraft/devops-templates/.github/workflows/pr-build.yaml@v6.1
1111
with:
1212
solution: DynamoDb.DistributedLock.sln
1313
hasTests: true
1414
dotnetVersion: |
1515
8.0.x
1616
9.0.x
1717
runCdk: false
18+
useMtpRunner: true
19+
testDirectory: "test"
20+
enableCodeCoverage: true
21+
coverageThreshold: 80
1822
secrets: inherit

CLAUDE.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a .NET library that provides distributed locking using Amazon DynamoDB. It supports .NET 8 and 9, uses nullable reference types, and follows modern C# conventions.
8+
9+
### Key Architecture Components
10+
11+
- **DynamoDbDistributedLock** (src/DynamoDb.DistributedLock/DynamoDbDistributedLock.cs): Main implementation of the distributed lock
12+
- **IDistributedLockHandle** (src/DynamoDb.DistributedLock/IDistributedLockHandle.cs): Handle interface with IAsyncDisposable for automatic cleanup
13+
- **DynamoDbLockOptions** (src/DynamoDb.DistributedLock/DynamoDbLockOptions.cs): Configuration options with retry settings
14+
- **Retry System** (src/DynamoDb.DistributedLock/Retry/): Exponential backoff retry policy with jitter
15+
- **Dependency Injection** (src/DynamoDb.DistributedLock/Extensions/ServiceCollectionExtensions.cs): Configuration binding and service registration
16+
17+
## Development Commands
18+
19+
### Build
20+
```bash
21+
dotnet build
22+
```
23+
24+
### Run Tests (uses Microsoft Testing Platform)
25+
```bash
26+
dotnet run --project test/DynamoDb.DistributedLock.Tests
27+
```
28+
29+
### Run Tests for Specific Framework
30+
```bash
31+
dotnet run --project test/DynamoDb.DistributedLock.Tests --framework net8.0
32+
dotnet run --project test/DynamoDb.DistributedLock.Tests --framework net9.0
33+
```
34+
35+
### Run Single Test Class
36+
```bash
37+
dotnet run --project test/DynamoDb.DistributedLock.Tests -- --filter "ClassName=DynamoDbDistributedLockTests"
38+
```
39+
40+
### Pack NuGet Package
41+
```bash
42+
dotnet pack --configuration Release
43+
```
44+
45+
## Testing Framework
46+
47+
- **xUnit v3** with Microsoft Testing Platform runner
48+
- **AutoFixture + NSubstitute** for test data generation and mocking
49+
- **FluentAssertions (AwesomeAssertions)** for assertions
50+
- **Custom TestKit** with specialized attributes and specimen builders:
51+
- `DynamoDbDistributedLockAutoDataAttribute` for streamlined tests
52+
- Specimen builders for consistent test object creation
53+
54+
## Configuration Notes
55+
56+
- The library uses **Directory.Build.props** for shared MSBuild properties
57+
- Test projects are automatically excluded from packing via `IsTestProject=true`
58+
- Both main library and tests target .NET 8.0 and 9.0
59+
- Tests use `UseMicrosoftTestingPlatformRunner=true` for modern test execution
60+
61+
## Code Patterns
62+
63+
- Uses nullable reference types throughout
64+
- Implements IAsyncDisposable pattern for lock handles
65+
- Dependency injection follows Microsoft.Extensions patterns
66+
- Configuration binding supports both programmatic and JSON configuration
67+
- Internal visibility is granted to test projects via InternalsVisibleTo
68+
69+
## AWS Integration
70+
71+
- Uses AWSSDK.DynamoDBv2 for DynamoDB operations
72+
- Supports configurable table structure (partition key, sort key attributes)
73+
- Implements TTL-based lock expiration
74+
- Handles DynamoDB-specific exceptions for retry logic

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>1.1.0</VersionPrefix>
3+
<VersionPrefix>1.1.1</VersionPrefix>
44
<PackageLicenseExpression>MIT</PackageLicenseExpression>
55

66
<!-- Other useful metadata -->

DynamoDb.DistributedLock.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2323
LICENSE = LICENSE
2424
README.md = README.md
2525
icon.png = icon.png
26+
CLAUDE.md = CLAUDE.md
2627
EndProjectSection
2728
EndProject
2829
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamoDb.DistributedLock.Tests", "test\DynamoDb.DistributedLock.Tests\DynamoDb.DistributedLock.Tests.csproj", "{1D5ED003-9182-475F-8FAB-3701D2BC900C}"

src/DynamoDb.DistributedLock/DynamoDb.DistributedLock.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="4.0.1.8" />
30+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="4.0.3.1" />
3131
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.2" />
32-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.6" />
33-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
34-
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.6" />
32+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.7" />
33+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
34+
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.7" />
3535
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
3636
<PrivateAssets>all</PrivateAssets>
3737
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

test/DynamoDb.DistributedLock.Tests/DynamoDb.DistributedLock.Tests.csproj

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,8 @@
77
<RootNamespace>DynamoDb.DistributedLock.Tests</RootNamespace>
88
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
99
<LangVersion>default</LangVersion>
10-
<!--
11-
To enable the Microsoft Testing Platform 'dotnet test' experience, add property:
12-
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
13-
14-
To enable the Microsoft Testing Platform native command line experience, add property:
15-
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
16-
17-
For more information on Microsoft Testing Platform support in xUnit.net, please visit:
18-
https://xunit.net/docs/getting-started/v3/microsoft-testing-platform
19-
-->
10+
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
11+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
2012
</PropertyGroup>
2113
<PropertyGroup>
2214
<IsTestProject>true</IsTestProject>
@@ -33,14 +25,15 @@
3325
<ItemGroup>
3426
<PackageReference Include="AutoFixture.AutoNSubstitute" Version="4.18.1"/>
3527
<PackageReference Include="AutoFixture.Xunit3" Version="4.19.0"/>
36-
<PackageReference Include="AwesomeAssertions" Version="9.0.0"/>
37-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.6" />
28+
<PackageReference Include="AwesomeAssertions" Version="9.1.0"/>
29+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.7"/>
3830
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
31+
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
3932
<PackageReference Include="NSubstitute" Version="5.3.0"/>
40-
<PackageReference Include="xunit.v3" Version="2.0.3" />
41-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
42-
<PrivateAssets>all</PrivateAssets>
43-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
<PackageReference Include="xunit.v3" Version="3.0.0"/>
34+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
35+
<PrivateAssets>all</PrivateAssets>
36+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4437
</PackageReference>
4538
</ItemGroup>
4639

0 commit comments

Comments
 (0)