Conversation
…ate range chunk and intent structures; chore: add new test infrastructure project
…age; enhance documentation for clarity
… enhance documentation
refactor: enhance clarity in comments and documentation; chore: exclude benchmark project from code coverage
…us classes; feat: introduce new diagnostics tests for NoOpDiagnostics; fix: correct range handling in tests and documentation; chore: remove redundant test data source and simplify test infrastructure; style: enhance code readability and consistency across files
…d accuracy; style: formatting improvements have been made to tables and lists; refactor: redundant references in documentation have been removed
…iles; refactor: enhance .gitignore for IDE and OS-specific files; docs: add public API and user path documentation
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…counter have been added; test: rebalance failure handling and disposal scenarios have been validated; test: execution request lifecycle behavior has been verified
…nd UserRequestHandler
There was a problem hiding this comment.
Pull request overview
This PR refactors the project’s documentation and test infrastructure while making several public-surface and concurrency/observability adjustments (notably moving instrumentation into SlidingWindowCache.Public.* and tightening execution/disposal semantics).
Changes:
- Reorganized documentation (new
docs/components/*, renamed/merged key docs) and updated solution/agent references. - Introduced
SlidingWindowCache.Tests.Infrastructureto centralize test data sources/helpers; updated multiple test projects to consume it and added new concurrency-focused unit tests. - Updated public API and internals around diagnostics/instrumentation,
RangeChunkdata materialization, storage/execution coordination, and option validation.
Reviewed changes
Copilot reviewed 92 out of 94 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj | Reference shared test infrastructure project. |
| tests/SlidingWindowCache.Unit.Tests/Public/WindowCacheDisposalTests.cs | Replace inline data source with shared SimpleTestDataSource; add concurrent dispose test. |
| tests/SlidingWindowCache.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs | Update diagnostics namespace + adjust method coverage for removed event. |
| tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs | Add equality/validation tests for new option behaviors. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs | Tighten assertions and fix comment semantics. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs | Broaden visibility (internal → public) for reuse. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs | New tests for task-chain resilience after faulted prior task. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs | New tests for ExecutionRequest cancel/dispose idempotence. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs | New test validating diagnostics on cache replacement vs expansion. |
| tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs | New tests for underflow protection and idle semantics. |
| tests/SlidingWindowCache.Tests.Infrastructure/SlidingWindowCache.Tests.Infrastructure.csproj | New shared test infrastructure library project. |
| tests/SlidingWindowCache.Tests.Infrastructure/Helpers/TestHelpers.cs | Move/rename namespace; consolidate data generation; adjust expected-range math; update cancellation/lifecycle assertions. |
| tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SpyDataSource.cs | Move namespace + centralize range-to-data generation. |
| tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs | New reusable minimal data source for tests. |
| tests/SlidingWindowCache.Tests.Infrastructure/DataSources/FaultyDataSource.cs | Tighten contract to return IReadOnlyList; clarify intended usage. |
| tests/SlidingWindowCache.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs | New shared range boundary-aware integer data generation helper. |
| tests/SlidingWindowCache.Tests.Infrastructure/DataSources/BoundedDataSource.cs | Move namespace + centralize data generation helper. |
| tests/SlidingWindowCache.Invariants.Tests/WindowCacheInvariantTests.cs | Update to new test helper/diagnostics namespaces; adjust assertions for new counters/semantics. |
| tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj | Add Intervals.NET packages + reference test infrastructure project. |
| tests/SlidingWindowCache.Invariants.Tests/README.md | Update instrumentation path and terminology; update related-doc links. |
| tests/SlidingWindowCache.Integration.Tests/UserPathExceptionHandlingTests.cs | Update namespaces to shared test infra + public instrumentation. |
| tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj | Reference shared test infrastructure project. |
| tests/SlidingWindowCache.Integration.Tests/RebalanceExceptionHandlingTests.cs | Add coverage for execution failure recording + loop survival; align diagnostics with removed intent-cancel event. |
| tests/SlidingWindowCache.Integration.Tests/RangeSemanticsContractTests.cs | Update namespaces to shared test infra + public instrumentation. |
| tests/SlidingWindowCache.Integration.Tests/RandomRangeRobustnessTests.cs | Update namespaces to shared test infra + public instrumentation. |
| tests/SlidingWindowCache.Integration.Tests/ExecutionStrategySelectionTests.cs | Replace inline data source with shared SimpleTestDataSource; add disposal-during-active-rebalance test. |
| tests/SlidingWindowCache.Integration.Tests/DataSourceRangePropagationTests.cs | Clarify white-box intent; fix right-expansion comment. |
| tests/SlidingWindowCache.Integration.Tests/ConcurrencyStabilityTests.cs | Remove redundant “Assert.True(true)” dead-code assertions; update namespaces. |
| tests/SlidingWindowCache.Integration.Tests/CacheDataSourceInteractionTests.cs | Remove redundant “Assert.True(true)” assertions; minor whitespace cleanup; update namespaces. |
| tests/SlidingWindowCache.Integration.Tests/BoundaryHandlingTests.cs | Add test for DataSegmentUnavailable on out-of-bounds rebalance segments; update namespaces. |
| src/SlidingWindowCache/Public/WindowCache.cs | Move IWindowCache out; switch default diagnostics to singleton; refactor controller/storage factories; adjust disposal coordination. |
| src/SlidingWindowCache/Public/Instrumentation/NoOpDiagnostics.cs | Move to public namespace; make sealed; add singleton; remove intent-cancel event; comment failure no-op. |
| src/SlidingWindowCache/Public/Instrumentation/ICacheDiagnostics.cs | Move to public namespace; remove intent-cancel event; update event location docs. |
| src/SlidingWindowCache/Public/Instrumentation/EventCounterCacheDiagnostics.cs | Move to public namespace; make sealed; remove intent-cancel counter; use Volatile.Read/Write; add Reset warning; include failure in lifecycle integrity. |
| src/SlidingWindowCache/Public/IWindowCache.cs | New file extracted from WindowCache.cs. |
| src/SlidingWindowCache/Public/IDataSource.cs | Generic parameter renames; adjust docs; simplify batch fetch task creation. |
| src/SlidingWindowCache/Public/Dto/RangeChunk.cs | Change payload type to IReadOnlyList<TData> and update docs/type params. |
| src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs | Document record with caveat; add per-threshold upper-bound validation. |
| src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs | Make backing array volatile and document memory ordering; remove unused mode property. |
| src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs | Remove read-mode property from internal storage interface. |
| src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs | Add lock to synchronize reads and swaps; reorganize rematerialization; strengthen range checks and docs. |
| src/SlidingWindowCache/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs | Restrict extension visibility; add FQN rationale comments to avoid ambiguity. |
| src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs | Clarify underflow behavior commentary. |
| src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs | Refactor into explicit cold/full/partial/miss flow; extract single-range fetch helper; update diagnostics namespace usage. |
| src/SlidingWindowCache/Core/State/CacheState.cs | Rename cache storage property; add IsInitialized; centralize mutations into UpdateCacheState method. |
| src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs | Switch decision evaluation inputs (no longer passes whole state); rename outcome recorder; make DisposeAsync public. |
| src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs | New internal intent record extracted from controller file. |
| src/SlidingWindowCache/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs | Use Volatile.Read for task chain; refactor request field access; improve cancellation diagnostics; volatile access for last request on dispose. |
| src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs | Use assembled intent data; apply atomic state update via CacheState.UpdateCacheState. |
| src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs | Implement IAsyncDisposable directly; remove duplicate DisposeAsync declaration. |
| src/SlidingWindowCache/Core/Rebalance/Execution/ExecutionRequest.cs | Replace record with sealed class owning CTS; narrow exception handling to ObjectDisposedException. |
| src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs | Use volatile write for last request; refactor request field access; improve cancellation diagnostics; volatile access for last request on dispose. |
| src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs | Separate diagnostic decision from missing-range computation; rename token param; simplify union helper signature. |
| src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceReason.cs | New file extracting RebalanceReason enum and adding Unspecified. |
| src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs | Update to new policy type and evaluate signature (explicit ranges instead of state/request). |
| src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecision.cs | Remove embedded enum; rename boolean property to IsExecutionRequired. |
| src/SlidingWindowCache/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs | Rename from threshold policy; remove unused type param; update docs. |
| src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs | Update references/links; round planned expansions. |
| src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs | Fix documentation and local variable usage for thresholds. |
| src/SlidingWindowCache.WasmValidation/WasmCompilationValidator.cs | Materialize generated sequences to arrays/lists to avoid deferred execution issues. |
| docs/storage-strategies.md | Update references and reflect new CopyOnRead locking/swap behavior. |
| docs/state-machine.md | New state machine doc replacing legacy file. |
| docs/glossary.md | Rewrite/condense and update link targets to new doc structure. |
| docs/diagnostics.md | Update links to renamed scenarios/components docs. |
| docs/components/user-path.md | New component doc (user path). |
| docs/components/state-and-storage.md | New component doc (state/storage). |
| docs/components/rebalance-path.md | New component doc (rebalance path). |
| docs/components/public-api.md | New component doc (public API). |
| docs/components/intent-management.md | New component doc (intent management). |
| docs/components/infrastructure.md | New component doc (infrastructure/threading). |
| docs/components/execution.md | New component doc (execution). |
| docs/components/decision.md | New component doc (decision). |
| docs/actors.md | New consolidated actors doc replacing legacy mappings. |
| docs/cache-state-machine.md | Removed legacy state machine doc (superseded by docs/state-machine.md). |
| benchmarks/SlidingWindowCache.Benchmarks/SlidingWindowCache.Benchmarks.csproj | Exclude benchmarks from code coverage. |
| benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SynchronousDataSource.cs | Ensure benchmark data is materialized (ToList()). |
| benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SlowDataSource.cs | Ensure benchmark data is materialized (ToList()). |
| SlidingWindowCache.sln | Update solution items; add test infra project; add docs/components solution folder. |
| AGENTS.md | Update documentation map, references, and instrumentation namespace. |
| .gitignore | Add common IDE/user artifact ignores; normalize ReSharper cache entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs
Outdated
Show resolved
Hide resolved
…elines and benchmark reports; refactor: benchmark reports have been reorganized for clarity and consistency; style: formatting improvements made to benchmark sections for better readability
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…king behavior; refactor: enhance ToRangeData method to ensure immutable snapshot is returned; refactor: update invariants and summaries for better clarity on storage strategies
…ctor/improve-code
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 97 out of 99 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tics; refactor(intent-management): enhance intent management logic for clarity; refactor(state): update state management to reflect storage changes; refactor(api): adjust public API documentation for consistency
…ctor/improve-code # Conflicts: # docs/components/public-api.md
This pull request introduces several documentation and project structure improvements, along with minor code updates to the benchmarks. The main focus is on reorganizing documentation files to better reflect the architecture and components of the project, updating references throughout the solution and documentation, and ensuring consistency in data generation for benchmarks.
Documentation and Project Structure Updates:
scenario-model.mdwithscenarios.md, consolidating architecture and actor documents, and introducing a newcomponentsdocumentation folder. References in bothAGENTS.mdandSlidingWindowCache.slnhave been updated accordingly. [1] [2] [3]SlidingWindowCache.Infrastructure.InstrumentationtoSlidingWindowCache.Public.Instrumentationin documentation and project structure, and added the corresponding folder to the file map. [1] [2] [3]Benchmark Code Improvements:
.ToList()in both synchronous and asynchronous data sources, improving consistency and preventing deferred execution issues. [1] [2] [3] [4]Other Updates:
SlidingWindowCache.Tests.Infrastructure, to the solution for improved test coverage. [1] [2] [3]LastRequestedtoIsInitialized) for improved accuracy.