Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions .github/test-ci-locally.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Local CI/CD Testing Script
# Local CI/CD Testing Script
# This script replicates the GitHub Actions workflow locally for testing

Write-Host "========================================" -ForegroundColor Cyan
Write-Host "SlidingWindowCache CI/CD Local Test" -ForegroundColor Cyan
Write-Host "Intervals.NET.Caching CI/CD Local Test" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

# Environment variables (matching GitHub Actions)
$env:SOLUTION_PATH = "SlidingWindowCache.sln"
$env:PROJECT_PATH = "src/SlidingWindowCache/SlidingWindowCache.csproj"
$env:WASM_VALIDATION_PATH = "src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj"
$env:UNIT_TEST_PATH = "tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj"
$env:INTEGRATION_TEST_PATH = "tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj"
$env:INVARIANTS_TEST_PATH = "tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj"
$env:SOLUTION_PATH = "Intervals.NET.Caching.sln"
$env:PROJECT_PATH = "src/Intervals.NET.Caching/Intervals.NET.Caching.csproj"
$env:WASM_VALIDATION_PATH = "src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj"
$env:UNIT_TEST_PATH = "tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj"
$env:INTEGRATION_TEST_PATH = "tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj"
$env:INVARIANTS_TEST_PATH = "tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj"

# Track failures
$failed = $false
Expand All @@ -21,85 +21,85 @@ $failed = $false
Write-Host "[Step 1/9] Restoring solution dependencies..." -ForegroundColor Yellow
dotnet restore $env:SOLUTION_PATH
if ($LASTEXITCODE -ne 0) {
Write-Host " Restore failed" -ForegroundColor Red
Write-Host "? Restore failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " Restore successful" -ForegroundColor Green
Write-Host "? Restore successful" -ForegroundColor Green
}
Write-Host ""

# Step 2: Build solution
Write-Host "[Step 2/9] Building solution (Release)..." -ForegroundColor Yellow
dotnet build $env:SOLUTION_PATH --configuration Release --no-restore
if ($LASTEXITCODE -ne 0) {
Write-Host " Build failed" -ForegroundColor Red
Write-Host "? Build failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " Build successful" -ForegroundColor Green
Write-Host "? Build successful" -ForegroundColor Green
}
Write-Host ""

# Step 3: Validate WebAssembly compatibility
Write-Host "[Step 3/9] Validating WebAssembly compatibility..." -ForegroundColor Yellow
dotnet build $env:WASM_VALIDATION_PATH --configuration Release --no-restore
if ($LASTEXITCODE -ne 0) {
Write-Host " WebAssembly validation failed" -ForegroundColor Red
Write-Host "? WebAssembly validation failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green
Write-Host "? WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green
}
Write-Host ""

# Step 4: Run Unit Tests
Write-Host "[Step 4/9] Running Unit Tests with coverage..." -ForegroundColor Yellow
dotnet test $env:UNIT_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Unit
if ($LASTEXITCODE -ne 0) {
Write-Host " Unit tests failed" -ForegroundColor Red
Write-Host "? Unit tests failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " Unit tests passed" -ForegroundColor Green
Write-Host "? Unit tests passed" -ForegroundColor Green
}
Write-Host ""

# Step 5: Run Integration Tests
Write-Host "[Step 5/9] Running Integration Tests with coverage..." -ForegroundColor Yellow
dotnet test $env:INTEGRATION_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Integration
if ($LASTEXITCODE -ne 0) {
Write-Host " Integration tests failed" -ForegroundColor Red
Write-Host "? Integration tests failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " Integration tests passed" -ForegroundColor Green
Write-Host "? Integration tests passed" -ForegroundColor Green
}
Write-Host ""

# Step 6: Run Invariants Tests
Write-Host "[Step 6/9] Running Invariants Tests with coverage..." -ForegroundColor Yellow
dotnet test $env:INVARIANTS_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Invariants
if ($LASTEXITCODE -ne 0) {
Write-Host " Invariants tests failed" -ForegroundColor Red
Write-Host "? Invariants tests failed" -ForegroundColor Red
$failed = $true
}
else {
Write-Host " Invariants tests passed" -ForegroundColor Green
Write-Host "? Invariants tests passed" -ForegroundColor Green
}
Write-Host ""

# Step 7: Check coverage files
Write-Host "[Step 7/9] Checking coverage files..." -ForegroundColor Yellow
$coverageFiles = Get-ChildItem -Path "./TestResults" -Filter "coverage.cobertura.xml" -Recurse
if ($coverageFiles.Count -gt 0) {
Write-Host " Found $($coverageFiles.Count) coverage file(s)" -ForegroundColor Green
Write-Host "? Found $($coverageFiles.Count) coverage file(s)" -ForegroundColor Green
foreach ($file in $coverageFiles) {
Write-Host " - $($file.FullName)" -ForegroundColor Gray
}
}
else {
Write-Host "⚠️ No coverage files found" -ForegroundColor Yellow
Write-Host "?? No coverage files found" -ForegroundColor Yellow
}
Write-Host ""

Expand All @@ -110,12 +110,12 @@ if (Test-Path "./artifacts") {
}
dotnet pack $env:PROJECT_PATH --configuration Release --no-build --output ./artifacts
if ($LASTEXITCODE -ne 0) {
Write-Host " Package creation failed" -ForegroundColor Red
Write-Host "? Package creation failed" -ForegroundColor Red
$failed = $true
}
else {
$packages = Get-ChildItem -Path "./artifacts" -Filter "*.nupkg"
Write-Host " Package created successfully" -ForegroundColor Green
Write-Host "? Package created successfully" -ForegroundColor Green
foreach ($pkg in $packages) {
Write-Host " - $($pkg.Name)" -ForegroundColor Gray
}
Expand All @@ -127,11 +127,11 @@ Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Test Summary" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
if ($failed) {
Write-Host " Some steps failed - see output above" -ForegroundColor Red
Write-Host "? Some steps failed - see output above" -ForegroundColor Red
exit 1
}
else {
Write-Host " All steps passed successfully!" -ForegroundColor Green
Write-Host "? All steps passed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host " - Review coverage reports in ./TestResults/" -ForegroundColor Gray
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: CI/CD - SlidingWindowCache
name: CI/CD - Intervals.NET.Caching

on:
push:
branches: [ master, main ]
paths:
- 'src/SlidingWindowCache/**'
- 'src/SlidingWindowCache.WasmValidation/**'
- 'src/Intervals.NET.Caching/**'
- 'src/Intervals.NET.Caching.WasmValidation/**'
- 'tests/**'
- '.github/workflows/slidingwindowcache.yml'
- '.github/workflows/Intervals.NET.Caching.yml'
pull_request:
branches: [ master, main ]
paths:
- 'src/SlidingWindowCache/**'
- 'src/SlidingWindowCache.WasmValidation/**'
- 'src/Intervals.NET.Caching/**'
- 'src/Intervals.NET.Caching.WasmValidation/**'
- 'tests/**'
- '.github/workflows/slidingwindowcache.yml'
- '.github/workflows/Intervals.NET.Caching.yml'
workflow_dispatch:

env:
DOTNET_VERSION: '8.x.x'
SOLUTION_PATH: 'SlidingWindowCache.sln'
PROJECT_PATH: 'src/SlidingWindowCache/SlidingWindowCache.csproj'
WASM_VALIDATION_PATH: 'src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj'
UNIT_TEST_PATH: 'tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj'
INTEGRATION_TEST_PATH: 'tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj'
INVARIANTS_TEST_PATH: 'tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj'
SOLUTION_PATH: 'Intervals.NET.Caching.sln'
PROJECT_PATH: 'src/Intervals.NET.Caching/Intervals.NET.Caching.csproj'
WASM_VALIDATION_PATH: 'src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj'
UNIT_TEST_PATH: 'tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj'
INTEGRATION_TEST_PATH: 'tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj'
INVARIANTS_TEST_PATH: 'tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj'

jobs:
build-and-test:
Expand All @@ -48,9 +48,9 @@ jobs:
- name: Validate WebAssembly compatibility
run: |
echo "::group::WebAssembly Validation"
echo "Building SlidingWindowCache.WasmValidation for net8.0-browser target..."
echo "Building Intervals.NET.Caching.WasmValidation for net8.0-browser target..."
dotnet build ${{ env.WASM_VALIDATION_PATH }} --configuration Release --no-restore
echo " WebAssembly compilation successful - library is compatible with net8.0-browser"
echo "? WebAssembly compilation successful - library is compatible with net8.0-browser"
echo "::endgroup::"

- name: Run Unit Tests with coverage
Expand Down Expand Up @@ -89,17 +89,17 @@ jobs:
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}

- name: Build SlidingWindowCache
- name: Build Intervals.NET.Caching
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore

- name: Pack SlidingWindowCache
- name: Pack Intervals.NET.Caching
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./artifacts

- name: Publish SlidingWindowCache to NuGet
run: dotnet nuget push ./artifacts/SlidingWindowCache.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish Intervals.NET.Caching to NuGet
run: dotnet nuget push ./artifacts/Intervals.NET.Caching.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: slidingwindowcache-package
name: Intervals.NET.Caching-package
path: ./artifacts/*.nupkg
68 changes: 34 additions & 34 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Agent Guidelines for SlidingWindowCache
# Agent Guidelines for Intervals.NET.Caching

This document provides essential information for AI coding agents working on the SlidingWindowCache codebase.
This document provides essential information for AI coding agents working on the Intervals.NET.Caching codebase.

## Project Overview

**SlidingWindowCache** is a C# .NET 8.0 library implementing a read-only, range-based, sequential-optimized cache with decision-driven background rebalancing. This is a production-ready concurrent systems project with extensive architectural documentation.
**Intervals.NET.Caching** is a C# .NET 8.0 library implementing a read-only, range-based, sequential-optimized cache with decision-driven background rebalancing. This is a production-ready concurrent systems project with extensive architectural documentation.

**Key Architecture Principles:**
- Single-Writer Architecture: Only rebalance execution mutates cache state
Expand All @@ -21,19 +21,19 @@ This document provides essential information for AI coding agents working on the
### Common Build Commands
```bash
# Restore dependencies
dotnet restore SlidingWindowCache.sln
dotnet restore Intervals.NET.Caching.sln

# Build solution (Debug)
dotnet build SlidingWindowCache.sln
dotnet build Intervals.NET.Caching.sln

# Build solution (Release)
dotnet build SlidingWindowCache.sln --configuration Release
dotnet build Intervals.NET.Caching.sln --configuration Release

# Build specific project
dotnet build src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Release
dotnet build src/Intervals.NET.Caching/Intervals.NET.Caching.csproj --configuration Release

# Pack for NuGet
dotnet pack src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Release --output ./artifacts
dotnet pack src/Intervals.NET.Caching/Intervals.NET.Caching.csproj --configuration Release --output ./artifacts
```

## Test Commands
Expand All @@ -42,15 +42,15 @@ dotnet pack src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Rel

```bash
# Run all tests
dotnet test SlidingWindowCache.sln --configuration Release
dotnet test Intervals.NET.Caching.sln --configuration Release

# Run specific test project
dotnet test tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj
dotnet test tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj
dotnet test tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj
dotnet test tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj
dotnet test tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj
dotnet test tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj

# Run single test by fully qualified name
dotnet test --filter "FullyQualifiedName=SlidingWindowCache.Unit.Tests.Public.Configuration.WindowCacheOptionsTests.Constructor_WithValidParameters_InitializesAllProperties"
dotnet test --filter "FullyQualifiedName=Intervals.NET.Caching.Unit.Tests.Public.Configuration.WindowCacheOptionsTests.Constructor_WithValidParameters_InitializesAllProperties"

# Run tests matching pattern
dotnet test --filter "FullyQualifiedName~Constructor"
Expand All @@ -77,15 +77,15 @@ dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults
### Namespace Organization
```csharp
// Use file-scoped namespace declarations (C# 10+)
namespace SlidingWindowCache.Public;
namespace SlidingWindowCache.Core.UserPath;
namespace SlidingWindowCache.Infrastructure.Storage;
namespace Intervals.NET.Caching.Public;
namespace Intervals.NET.Caching.Core.UserPath;
namespace Intervals.NET.Caching.Infrastructure.Storage;
```

**Namespace Structure:**
- `SlidingWindowCache.Public` - Public API surface
- `SlidingWindowCache.Core` - Business logic (internal)
- `SlidingWindowCache.Infrastructure` - Infrastructure concerns (internal)
- `Intervals.NET.Caching.Public` - Public API surface
- `Intervals.NET.Caching.Core` - Business logic (internal)
- `Intervals.NET.Caching.Infrastructure` - Infrastructure concerns (internal)

### Naming Conventions

Expand Down Expand Up @@ -123,16 +123,16 @@ namespace SlidingWindowCache.Infrastructure.Storage;

**Import Order:**
1. External libraries (e.g., `Intervals.NET`)
2. Project namespaces (e.g., `SlidingWindowCache.*`)
2. Project namespaces (e.g., `Intervals.NET.Caching.*`)
3. Alphabetically sorted within each group

**Example:**
```csharp
using Intervals.NET;
using Intervals.NET.Domain.Abstractions;
using SlidingWindowCache.Core.Planning;
using SlidingWindowCache.Core.State;
using SlidingWindowCache.Public.Instrumentation;
using Intervals.NET.Caching.Core.Planning;
using Intervals.NET.Caching.Core.State;
using Intervals.NET.Caching.Public.Instrumentation;
```

### XML Documentation
Expand Down Expand Up @@ -350,24 +350,24 @@ refactor: AsyncActivityCounter lock has been removed and replaced with lock-free
## File Locations

**Public API:**
- `src/SlidingWindowCache/Public/WindowCache.cs` - Main cache facade
- `src/SlidingWindowCache/Public/IDataSource.cs` - Data source contract
- `src/SlidingWindowCache/Public/Configuration/` - Configuration classes
- `src/SlidingWindowCache/Public/Instrumentation/` - Diagnostics
- `src/Intervals.NET.Caching/Public/WindowCache.cs` - Main cache facade
- `src/Intervals.NET.Caching/Public/IDataSource.cs` - Data source contract
- `src/Intervals.NET.Caching/Public/Configuration/` - Configuration classes
- `src/Intervals.NET.Caching/Public/Instrumentation/` - Diagnostics

**Core Logic:**
- `src/SlidingWindowCache/Core/UserPath/` - User request handling (read-only)
- `src/SlidingWindowCache/Core/Rebalance/Decision/` - Decision engine
- `src/SlidingWindowCache/Core/Rebalance/Execution/` - Cache mutations (single writer)
- `src/SlidingWindowCache/Core/State/` - State management
- `src/Intervals.NET.Caching/Core/UserPath/` - User request handling (read-only)
- `src/Intervals.NET.Caching/Core/Rebalance/Decision/` - Decision engine
- `src/Intervals.NET.Caching/Core/Rebalance/Execution/` - Cache mutations (single writer)
- `src/Intervals.NET.Caching/Core/State/` - State management

**Infrastructure:**
- `src/SlidingWindowCache/Infrastructure/Storage/` - Storage strategies
- `src/SlidingWindowCache/Infrastructure/Concurrency/` - Async coordination
- `src/Intervals.NET.Caching/Infrastructure/Storage/` - Storage strategies
- `src/Intervals.NET.Caching/Infrastructure/Concurrency/` - Async coordination

## CI/CD

**GitHub Actions:** `.github/workflows/slidingwindowcache.yml`
**GitHub Actions:** `.github/workflows/Intervals.NET.Caching.yml`
- Triggers: Push/PR to main/master, manual dispatch
- Runs: Build, WebAssembly validation, all test suites with coverage
- Coverage: Uploaded to Codecov
Expand Down
Loading