Skip to content

Initialization#1

Merged
blaze6950 merged 63 commits intomasterfrom
initialization
Feb 16, 2026
Merged

Initialization#1
blaze6950 merged 63 commits intomasterfrom
initialization

Conversation

@blaze6950
Copy link
Copy Markdown
Collaborator

@blaze6950 blaze6950 commented Feb 9, 2026

The initial implementation is a production-ready, enterprise-grade sliding window cache library.

Mykyta Zotov added 2 commits February 9, 2026 21:58
…ate machine, scenario model, storage strategies, and system actors
@blaze6950 blaze6950 self-assigned this Feb 9, 2026
Mykyta Zotov added 19 commits February 9, 2026 23:23
…ecture, updating LastRequested and NoRebalanceRange properties to internal access. Modify intent handling to include delivered data, ensuring Rebalance Execution uses this data as the authoritative source for cache normalization.
…estHelpers, improving code reuse and maintainability.
… and performance, simplifying method implementations and removing redundant code.
…ancing clarity and detail in behavioral tests and documentation.
…ariables and methods related to delivered data, enhancing code readability and maintainability.
…UG")] attributes for cleaner code and improved maintainability
…e fetch operations, improving tracking of full range and missing segments fetches.
… consistency, simplifying assertions and enhancing test clarity.
…on for background rebalance operations, introducing WaitForIdleAsync() method for race-free testing and improved reliability in DEBUG builds.
…ing and introduce debounce execution method
Mykyta Zotov added 7 commits February 12, 2026 01:34
…tion counters and ensure proper execution flow
…er request and background rebalance verification
…llation handling, ensuring thread-safety and non-blocking operations.
…tation details and thread-safety validation under concurrent load.
Mykyta Zotov added 13 commits February 15, 2026 01:24
…alysis, introducing RangeSpan and CacheCoefficientSize parameters across multiple benchmark classes.
…ion and improved configuration for span behavior and storage strategy, ensuring deterministic workload generation and isolation of rebalance costs.
…adjusting range sizes and cache coefficients in documentation and code comments.
…able of contents, visual aids, and sections for configuration and contribution guidelines
@blaze6950 blaze6950 marked this pull request as ready for review February 15, 2026 23:41
Copilot AI review requested due to automatic review settings February 15, 2026 23:41
Copy link
Copy Markdown
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

Introduces the initial implementation of the SlidingWindowCache library, including the public API facade, internal rebalance architecture (intent/decision/execution), storage strategies, and diagnostics; plus a full supporting test suite, docs, benchmarks, CI workflow, and a WebAssembly compilation validation target.

Changes:

  • Add core cache implementation (public API + internal actors for user path and background rebalance) with diagnostics and two storage strategies.
  • Add Unit/Integration/Invariants test projects and supporting test infrastructure.
  • Add CI workflow + SDK pinning, extensive documentation, benchmarks, and a net8.0-browser compile-only validation project.

Reviewed changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj Adds unit test project configuration and dependencies.
tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs Shared helpers for storage-related unit tests.
tests/SlidingWindowCache.Unit.Tests/Infrastructure/Instrumentation/NoOpDiagnosticsTests.cs Unit test ensuring diagnostics no-op implementation never throws.
tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs Test-only variable-step domain implementation for extension testing.
tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj Adds invariants test project configuration.
tests/SlidingWindowCache.Integration.Tests/TestInfrastructure/SpyDataSource.cs Thread-safe test spy IDataSource for integration contract tests.
tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj Adds integration test project configuration and dependencies.
tests/SlidingWindowCache.Integration.Tests/RebalanceExceptionHandlingTests.cs Integration coverage for rebalance exception handling via diagnostics.
tests/SlidingWindowCache.Integration.Tests/RangeSemanticsContractTests.cs Contract tests around range semantics and returned data invariants.
tests/SlidingWindowCache.Integration.Tests/RandomRangeRobustnessTests.cs Property-style robustness tests using randomized ranges.
tests/SlidingWindowCache.Integration.Tests/README.md Documentation describing integration/robustness test suites and usage.
src/SlidingWindowCache/SlidingWindowCache.csproj Adds main library project configuration + NuGet metadata.
src/SlidingWindowCache/Public/WindowCache.cs Defines public facade interface and WindowCache composition root + WaitForIdleAsync.
src/SlidingWindowCache/Public/IDataSource.cs Defines IDataSource contract including default parallel batch fetch implementation.
src/SlidingWindowCache/Public/Dto/RangeChunk.cs Adds DTO for associating a range with fetched data.
src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs Adds configuration record for cache sizing, thresholds, and debounce.
src/SlidingWindowCache/Public/Configuration/UserCacheReadMode.cs Adds Snapshot vs CopyOnRead read-mode enum and docs.
src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs Snapshot storage strategy backing reads with an array slice.
src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs Internal storage strategy interface.
src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs Copy-on-read storage with dual-buffer rematerialization strategy.
src/SlidingWindowCache/Infrastructure/Instrumentation/NoOpDiagnostics.cs No-op diagnostics implementation.
src/SlidingWindowCache/Infrastructure/Instrumentation/ICacheDiagnostics.cs Diagnostics interface describing cache/rebalance lifecycle events.
src/SlidingWindowCache/Infrastructure/Instrumentation/EventCounterCacheDiagnostics.cs Default diagnostics implementation using counters + Debug output.
src/SlidingWindowCache/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs Domain-agnostic extensions dispatching to fixed/variable Intervals.NET APIs.
src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs Implements user request handling and publishes rebalance intents.
src/SlidingWindowCache/Core/State/CacheState.cs Shared mutable cache state container.
src/SlidingWindowCache/Core/Rebalance/Intent/ThresholdRebalancePolicy.cs Threshold policy for no-rebalance range and rebalance decisions.
src/SlidingWindowCache/Core/Rebalance/Intent/RebalanceScheduler.cs Debounced background scheduling + task tracking for idle synchronization.
src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs Lock-free intent lifecycle management (cancellation/versioning).
src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs Intent record carrying requested range + available data.
src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs Executes rebalance normalization and applies cache mutations.
src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs Computes missing segments and fetches/merges range data.
src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs Pure decision logic for whether to execute a rebalance and desired range.
src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecision.cs Decision result type (skip/execute).
src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs Plans desired cache range based on requested span and coefficients.
src/SlidingWindowCache.WasmValidation/WasmCompilationValidator.cs Minimal usage to ensure net8.0-browser compilation.
src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj Adds net8.0-browser compile-validation project.
src/SlidingWindowCache.WasmValidation/README.md Documentation for the WebAssembly compile-validation target.
global.json Adds repo-wide .NET SDK pinning configuration.
docs/scenario-model.md Adds detailed behavioral scenario model documentation.
docs/concurrency-model.md Documents concurrency model and WaitForIdleAsync semantics.
docs/cache-state-machine.md Adds formal state machine for cache lifecycle.
docs/actors-and-responsibilities.md Maps actors/components to invariants and responsibilities.
benchmarks/SlidingWindowCache.Benchmarks/SlidingWindowCache.Benchmarks.csproj Adds BenchmarkDotNet project for performance benchmarks.
benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md Adds benchmark results artifact.
benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md Adds benchmark results artifact.
benchmarks/SlidingWindowCache.Benchmarks/Program.cs Benchmark runner entry point.
benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SynchronousDataSource.cs Zero-latency data source for benchmarks.
benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/UserFlowBenchmarks.cs Benchmarks focused on user path call cost patterns.
benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ScenarioBenchmarks.cs End-to-end scenario benchmarks including cold start + rebalance.
benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs Benchmarks focused on rebalance/rematerialization mechanics.
SlidingWindowCache.sln Adds solution structure including tests, docs, benchmarks, CI items.
.github/workflows/slidingwindowcache.yml Adds CI workflow for build/test/coverage/pack/publish + WASM build validation.
.github/test-ci-locally.ps1 Adds local script to replicate CI steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/SlidingWindowCache.Integration.Tests/README.md Outdated
Comment thread tests/SlidingWindowCache.Integration.Tests/README.md Outdated
Comment thread tests/SlidingWindowCache.Integration.Tests/README.md Outdated
Comment thread docs/cache-state-machine.md Outdated
Comment thread src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs Outdated
Copy link
Copy Markdown
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 71 out of 71 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SlidingWindowCache/Public/WindowCache.cs
@blaze6950 blaze6950 merged commit 1f42347 into master Feb 16, 2026
8 checks passed
@blaze6950 blaze6950 deleted the initialization branch February 16, 2026 00:44
blaze6950 pushed a commit that referenced this pull request Feb 21, 2026
BREAKING DOCS CHANGE: Decision evaluation runs in background intent processing loop, not user thread

This corrects systematic documentation inaccuracies that emerged after architectural
refactoring in commit 3e8ed0f (Feb 17, 2026). The decision evaluation pipeline
(RebalanceDecisionEngine, ProportionalRangePlanner, NoRebalanceRangePlanner,
ThresholdRebalancePolicy) executes in a background thread within the intent
processing loop (IntentController.ProcessIntentsAsync), NOT in the user thread.

User thread boundary ends at PublishIntent() return, which performs only atomic
operations (Interlocked.Exchange + semaphore signal) and returns immediately
(fire-and-forget pattern).

THREADING MODEL CLARIFICATION:
- User Thread: GetDataAsync → UserRequestHandler → PublishIntent [RETURNS HERE]
- Background Thread #1: ProcessIntentsAsync → DecisionEngine → Planners
- Background Thread #2: ProcessExecutionRequestsAsync → Executor → Cache Mutation

Files updated:
- XML docs: RebalanceDecisionEngine.cs, ProportionalRangePlanner.cs,
  NoRebalanceRangePlanner.cs, ThresholdRebalancePolicy.cs, IntentController.cs
- Markdown docs: component-map.md, actors-and-responsibilities.md,
  actors-to-components-mapping.md, README.md
- Added: Comprehensive threading flow diagram in component-map.md

This is a documentation-only change with no functional code modifications.
blaze6950 added a commit that referenced this pull request Feb 23, 2026
…cy model (#3)

* fix: the async idle state detection logic was reconsidered; some optimizations and other fixes for stability was applied;
test: tests have been adjusted a bit

* docs: improve documentation for last execution request tracking in RebalanceExecutionController

* refactor: refactor test diagnostics initialization to use readonly fields and constructor assignment for EventCounterCacheDiagnostics

* todo: add TODO comments outlining planned improvements and refactoring for concurrency, diagnostics, and documentation

* docs: agent guidelines for SlidingWindowCache have been added with architecture, build, test, and code style instructions

* docs: exception testing examples to AGENTS.md for improved clarity on error handling hasve been added

* feat: implement disposal pattern for WindowCache to ensure resource management and graceful shutdown;
docs: update README with resource management and disposal behavior details;
test: add unit tests for WindowCache disposal behavior and idempotency

* docs: correct threading model documentation across codebase

BREAKING DOCS CHANGE: Decision evaluation runs in background intent processing loop, not user thread

This corrects systematic documentation inaccuracies that emerged after architectural
refactoring in commit 3e8ed0f (Feb 17, 2026). The decision evaluation pipeline
(RebalanceDecisionEngine, ProportionalRangePlanner, NoRebalanceRangePlanner,
ThresholdRebalancePolicy) executes in a background thread within the intent
processing loop (IntentController.ProcessIntentsAsync), NOT in the user thread.

User thread boundary ends at PublishIntent() return, which performs only atomic
operations (Interlocked.Exchange + semaphore signal) and returns immediately
(fire-and-forget pattern).

THREADING MODEL CLARIFICATION:
- User Thread: GetDataAsync → UserRequestHandler → PublishIntent [RETURNS HERE]
- Background Thread #1: ProcessIntentsAsync → DecisionEngine → Planners
- Background Thread #2: ProcessExecutionRequestsAsync → Executor → Cache Mutation

Files updated:
- XML docs: RebalanceDecisionEngine.cs, ProportionalRangePlanner.cs,
  NoRebalanceRangePlanner.cs, ThresholdRebalancePolicy.cs, IntentController.cs
- Markdown docs: component-map.md, actors-and-responsibilities.md,
  actors-to-components-mapping.md, README.md
- Added: Comprehensive threading flow diagram in component-map.md

This is a documentation-only change with no functional code modifications.

* refactor: code clarity by removing redundant whitespace and enhancing documentation comments has been imporved

* refactor: execution controller interface has been introduced for rebalance execution strategies;
feat: rebalance execution queue capacity configuration has been added to support bounded and unbounded strategies;
docs: execution strategy details have been documented in README and concurrency model;
test: integration tests for execution strategy selection have been implemented;
fix: cancellation handling in execution requests has been improved

* refactor(concurrency model): improve clarity and detail of concurrency model documentation; enhance AsyncActivityCounter description and usage semantics

* chore: not used DTO has been removed

* docs: update invariants documentation to include activity tracking and idle detection invariants;
docs: enhance AsyncActivityCounter documentation with critical invariants and call site details

* feat(docs): add diagnostics documentation for cache behavior events;
refactor(docs): improve clarity in concurrency model and decision pipeline descriptions;
fix(docs): correct inaccuracies in rebalance execution and skip conditions;
style(docs): update formatting and terminology for consistency across documentation

* docs: update architectural documentation for clarity and accuracy;
refactor: rename concurrency model document to architecture model;
docs: enhance documentation with additional references and explanations

* feat(tests): enhance test coverage with new gap tests and parameterized strategies; refactor test helpers to support execution strategy variations

* docs: README and WasmCompilationValidator have been updated to include strategy coverage validation details

* docs: glossary document has been added to define technical terms used in the project

* fix: NoRebalanceRange planner logic was fixed taking into account that 1 or more of threshold sum means no rebalance range at all (not equal to the current cache range); also, the validation of threshold was extended in options;
docs: update documentation for NoRebalanceRange and WindowCacheOptions validation; clarify threshold sum constraint and its enforcement

* feat(benchmark): add execution strategy benchmarks for unbounded and bounded queue performance under burst loads;
feat(data source): implement SlowDataSource to simulate I/O latency for testing;
fix(README): update documentation to include execution strategy selection and benchmark results

* refactor: data generation logic for range has been improved to respect boundary inclusivity;
feat: cancellation token has been added to execution request methods for graceful shutdown during disposal

* refactor(concurrency): enhance async disposal coordination using TaskCompletionSource for concurrent safety

---------

Co-authored-by: Mykyta Zotov <mykyta.zotov@ihsmarkit.com>
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