Files
git.stella-ops.org/docs/features/checked/policy/delta-if-present-calculations-for-missing-signals.md
2026-02-13 02:04:55 +02:00

3.5 KiB

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

  • Calculate single signal delta for VEX; verify hypothetical score changes from base
  • Calculate delta for high-risk (1.0) vs low-risk (0.0) EPSS; verify higher risk produces higher score
  • Verify adding a missing signal decreases entropy (less uncertainty)
  • Run full gap analysis on partial snapshot; verify all gaps identified with prioritization
  • Verify gap prioritization orders by maximum potential impact
  • Verify best/worst/prior case scenarios included for each gap
  • Calculate score bounds with no gaps; verify Range=0 and Min=Max
  • Calculate score bounds with gaps; verify positive Range with Max >= Min
  • Verify all 6 signal weights are correct (VEX=0.25, EPSS=0.15, etc.)
  • Verify deterministic output: same inputs produce identical results
  • Verify DI wiring: IDeltaIfPresentCalculator resolves through AddDeterminization()
  • 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/