Skip to content

Refactor/improve code#5

Merged
blaze6950 merged 23 commits intomasterfrom
refactor/improve-code
Mar 1, 2026
Merged

Refactor/improve code#5
blaze6950 merged 23 commits intomasterfrom
refactor/improve-code

Conversation

@blaze6950
Copy link
Owner

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:

  • Renamed and reorganized documentation files for clarity and consistency, such as replacing scenario-model.md with scenarios.md, consolidating architecture and actor documents, and introducing a new components documentation folder. References in both AGENTS.md and SlidingWindowCache.sln have been updated accordingly. [1] [2] [3]
  • Updated references to the instrumentation namespace from SlidingWindowCache.Infrastructure.Instrumentation to SlidingWindowCache.Public.Instrumentation in documentation and project structure, and added the corresponding folder to the file map. [1] [2] [3]

Benchmark Code Improvements:

  • Ensured that generated data for benchmarks is always materialized as a list by calling .ToList() in both synchronous and asynchronous data sources, improving consistency and preventing deferred execution issues. [1] [2] [3] [4]
  • Marked the benchmark project to be excluded from code coverage analysis for more accurate reporting.

Other Updates:

  • Added a new infrastructure test project, SlidingWindowCache.Tests.Infrastructure, to the solution for improved test coverage. [1] [2] [3]
  • Clarified concurrency documentation by updating terminology (e.g., LastRequested to IsInitialized) for improved accuracy.

Mykyta Zotov added 10 commits February 27, 2026 00:30
…ate range chunk and intent structures; chore: add new test infrastructure project
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
@blaze6950 blaze6950 self-assigned this Feb 28, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2026

Mykyta Zotov added 2 commits February 28, 2026 20:15
…counter have been added;

test: rebalance failure handling and disposal scenarios have been validated;
test: execution request lifecycle behavior has been verified
@blaze6950 blaze6950 marked this pull request as ready for review February 28, 2026 19:19
Copilot AI review requested due to automatic review settings February 28, 2026 19:19
Copy link
Contributor

Copilot AI left a comment

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 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.Infrastructure to 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, RangeChunk data 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.

Mykyta Zotov and others added 6 commits February 28, 2026 23:08
…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
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

blaze6950 and others added 3 commits March 1, 2026 00:44
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>
Mykyta Zotov added 2 commits March 1, 2026 01:06
…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
@blaze6950 blaze6950 merged commit 5374144 into master Mar 1, 2026
2 checks passed
@blaze6950 blaze6950 deleted the refactor/improve-code branch March 1, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants