Files
git.stella-ops.org/docs/features/unchecked/scanner/reachability-caching-with-incremental-updates.md

35 lines
2.5 KiB
Markdown

# Reachability Caching with Incremental Updates
## Module
Scanner
## Status
IMPLEMENTED
## Description
Postgres-backed reachability cache with incremental updates, graph delta computation, impact set calculation, and state flip detection for efficient cache invalidation.
## Implementation Details
- **Reachability Cache**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/IReachabilityCache.cs` - `IReachabilityCache` interface for cached reachability results
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/PostgresReachabilityCache.cs` - `PostgresReachabilityCache` PostgreSQL-backed cache for reachability analysis results
- **Incremental Updates**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/IncrementalReachabilityService.cs` - `IncrementalReachabilityService` performs incremental reachability updates based on graph deltas
- **Graph Delta Computation**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/IGraphDeltaComputer.cs` - `IGraphDeltaComputer` interface for computing graph changes
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/GraphDeltaComputer.cs` - `GraphDeltaComputer` computes added/removed/modified nodes and edges between graph versions
- **Impact Set Calculation**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/ImpactSetCalculator.cs` - `ImpactSetCalculator` determines which reachability paths are affected by graph changes
- **State Flip Detection**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/StateFlipDetector.cs` - `StateFlipDetector` detects reachability state changes (reachable->unreachable or vice versa) for cache invalidation
- **PR Reachability Gate**:
- `src/Scanner/__Libraries/StellaOps.Scanner.Reachability/Cache/PrReachabilityGate.cs` - `PrReachabilityGate` provides PR-level reachability gating using cached results
## E2E Test Plan
- [ ] Scan an image, verify reachability results are cached in PostgreSQL, then rescan and verify cache hits avoid recomputation
- [ ] Modify one dependency in the image and verify incremental update only recomputes affected paths
- [ ] Verify graph delta computation correctly identifies added, removed, and modified nodes and edges
- [ ] Verify impact set calculation determines exactly which reachability paths need re-evaluation
- [ ] Verify state flip detection correctly identifies findings that changed from reachable to unreachable (or vice versa)
- [ ] Verify the PR reachability gate uses cached results to quickly evaluate PR-level reachability changes