more features checks. setup improvements

This commit is contained in:
master
2026-02-13 02:04:55 +02:00
parent 9911b7d73c
commit 9ca2de05df
675 changed files with 37550 additions and 1826 deletions

View File

@@ -0,0 +1,47 @@
# Delta-If-Present Calculations for Missing Signals
## Module
Policy
## Status
VERIFIED
## Description
Computes "delta if present" values showing what would change if missing signals arrived (TSF-004). Calculates hypothetical score changes for individual signals, full gap analysis with best/worst/prior case scenarios, and score bounds (min/max range) across all gaps. Includes REST API endpoints for policy decision support.
## Implementation Details
- **DeltaIfPresentCalculator**: `src/Policy/__Libraries/StellaOps.Policy.Determinization/Scoring/DeltaIfPresentCalculator.cs` -- core calculator implementing `IDeltaIfPresentCalculator`
- `CalculateSingleSignalDelta(snapshot, signal, assumedValue)` -- hypothetical score if a specific missing signal had a given value
- `CalculateFullAnalysis(snapshot)` -- analyzes all signal gaps with best-case (0.0), worst-case (1.0), and prior-case scenarios; prioritizes by max impact
- `CalculateScoreBounds(snapshot)` -- computes min/max possible scores given current gaps
- **Signal Types**: VEX (0.25), EPSS (0.15), Reachability (0.25), Runtime (0.15), Backport (0.10), SBOMLineage (0.10)
- **Default Priors**: VEX=0.5, EPSS=0.3, Reachability=0.5, Runtime=0.3, Backport=0.5, SBOMLineage=0.5
- **Hypothetical Snapshots**: Creates modified snapshots with simulated signal values for counterfactual analysis
- **DeltaIfPresentEndpoints**: `src/Policy/StellaOps.Policy.Engine/Endpoints/DeltaIfPresentEndpoints.cs` -- REST API
- `POST /api/v1/policy/delta-if-present/signal` -- single signal delta
- `POST /api/v1/policy/delta-if-present/analysis` -- full gap analysis
- `POST /api/v1/policy/delta-if-present/bounds` -- score bounds
- **Dependencies**: UncertaintyScoreCalculator (entropy from missing signals), TrustScoreAggregator (trust score computation)
- **DI Registration**: `AddDeterminization()` registers IDeltaIfPresentCalculator as singleton
## E2E Test Plan
- [x] Calculate single signal delta for VEX; verify hypothetical score changes from base
- [x] Calculate delta for high-risk (1.0) vs low-risk (0.0) EPSS; verify higher risk produces higher score
- [x] Verify adding a missing signal decreases entropy (less uncertainty)
- [x] Run full gap analysis on partial snapshot; verify all gaps identified with prioritization
- [x] Verify gap prioritization orders by maximum potential impact
- [x] Verify best/worst/prior case scenarios included for each gap
- [x] Calculate score bounds with no gaps; verify Range=0 and Min=Max
- [x] Calculate score bounds with gaps; verify positive Range with Max >= Min
- [x] Verify all 6 signal weights are correct (VEX=0.25, EPSS=0.15, etc.)
- [x] Verify deterministic output: same inputs produce identical results
- [x] Verify DI wiring: IDeltaIfPresentCalculator resolves through AddDeterminization()
- [x] Verify all 6 signal types can be analyzed without exceptions
## Verification
- **Run ID**: run-002
- **Date**: 2026-02-12
- **Tests**: 438 tests passed in Determinization.Tests (12 targeted for this feature) + 1262/1263 in Engine.Tests (10 integration tests targeted); 1 pre-existing unrelated failure
- **Bug Fixed**: DeltaIfPresentCalculator.CalculateScoreBounds had min/max score ordering inverted (bestSnapshot mapped to maxScore but should be minScore when trust aggregator returns lower scores for lower risk)
- **Status Correction**: Feature was previously marked NOT_FOUND but is fully implemented with DeltaIfPresentCalculator (TSF-004), REST endpoints, unit tests, and integration tests
- **Evidence**: `docs/qa/feature-checks/runs/policy/delta-if-present-calculations-for-missing-signals/run-002/`