Conversation
…mizations and other fixes for stability was applied; test: tests have been adjusted a bit
…balanceExecutionController
…elds and constructor assignment for EventCounterCacheDiagnostics
…g for concurrency, diagnostics, and documentation
…chitecture, build, test, and code style instructions
… error handling hasve been added
…anagement and graceful shutdown; docs: update README with resource management and disposal behavior details; test: add unit tests for WindowCache disposal behavior and idempotency
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.
… documentation comments has been imporved
…lance 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
…y model documentation; enhance AsyncActivityCounter description and usage semantics
…d idle detection invariants; docs: enhance AsyncActivityCounter documentation with critical invariants and call site details
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
refactor: rename concurrency model document to architecture model; docs: enhance documentation with additional references and explanations
…ed strategies; refactor test helpers to support execution strategy variations
…e strategy coverage validation details
…t 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
…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
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates SlidingWindowCache’s concurrency/execution architecture by moving rebalance decision-making into a background intent-processing loop, adding a configurable execution-queue strategy (RebalanceQueueCapacity), and expanding tests/docs to cover disposal, execution strategy selection, and updated invariants/diagnostics.
Changes:
- Introduces execution strategy selection (task-chained unbounded vs bounded channel) via
WindowCacheOptions.RebalanceQueueCapacity. - Adds lock-free idle detection via
AsyncActivityCounterand updatesWindowCache.WaitForIdleAsync/ disposal flow accordingly. - Expands unit/integration/invariant tests and refreshes architectural documentation to reflect the new intent/execution model.
Reviewed changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs | Adds threshold-sum validation and new RebalanceQueueCapacity option with docs. |
| src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs | Adds lock-free “idle” tracking primitive used by WaitForIdleAsync. |
| src/SlidingWindowCache/Public/WindowCache.cs | Wires new intent/execution actors; updates WaitForIdleAsync and disposal behavior. |
| src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs | Adds internal disposal and publishes intents to the new background intent loop. |
| src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs | New background intent loop + decision evaluation + scheduling into execution controller. |
| src/SlidingWindowCache/Core/Rebalance/Execution/*.cs | Adds execution-controller abstraction plus task-based and channel-based implementations. |
| tests/**/*.cs | Adds/updates tests for disposal, threshold sum validation, and execution strategy behavior. |
| docs/**/*.md, AGENTS.md | Updates/expands architecture/diagnostics docs and agent guidance to match new model. |
| benchmarks//*.md, benchmarks//SlowDataSource.cs | Adds benchmark artifacts and a latency data source used for strategy benchmarking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/SlidingWindowCache.Unit.Tests/Public/WindowCacheDisposalTests.cs
Outdated
Show resolved
Hide resolved
src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs
Show resolved
Hide resolved
tests/SlidingWindowCache.Integration.Tests/ExecutionStrategySelectionTests.cs
Show resolved
Hide resolved
src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs
Show resolved
Hide resolved
benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SlowDataSource.cs
Outdated
Show resolved
Hide resolved
…t boundary inclusivity; feat: cancellation token has been added to execution request methods for graceful shutdown during disposal
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 60 out of 61 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs
Outdated
Show resolved
Hide resolved
…CompletionSource for concurrent safety
This PR updates SlidingWindowCache’s concurrency/execution architecture by moving rebalance decision-making into a background intent-processing loop, adding a configurable execution-queue strategy (RebalanceQueueCapacity), and expanding tests/docs to cover disposal, execution strategy selection, and updated invariants/diagnostics.
Changes:
Introduces execution strategy selection (task-chained unbounded vs bounded channel) via WindowCacheOptions.RebalanceQueueCapacity.
Adds lock-free idle detection via AsyncActivityCounter and updates WindowCache.WaitForIdleAsync / disposal flow accordingly.
Expands unit/integration/invariant tests and refreshes architectural documentation to reflect the new intent/execution model.