up
Some checks failed
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-13 09:37:15 +02:00
parent e00f6365da
commit 6e45066e37
349 changed files with 17160 additions and 1867 deletions

View File

@@ -29,6 +29,7 @@ internal sealed class CallgraphIngestionService : ICallgraphIngestionService
private readonly ICallgraphParserResolver parserResolver;
private readonly ICallgraphArtifactStore artifactStore;
private readonly ICallgraphRepository repository;
private readonly IReachabilityStoreRepository reachabilityStore;
private readonly ICallgraphNormalizationService normalizer;
private readonly ILogger<CallgraphIngestionService> logger;
private readonly SignalsOptions options;
@@ -39,6 +40,7 @@ internal sealed class CallgraphIngestionService : ICallgraphIngestionService
ICallgraphParserResolver parserResolver,
ICallgraphArtifactStore artifactStore,
ICallgraphRepository repository,
IReachabilityStoreRepository reachabilityStore,
ICallgraphNormalizationService normalizer,
IOptions<SignalsOptions> options,
TimeProvider timeProvider,
@@ -47,6 +49,7 @@ internal sealed class CallgraphIngestionService : ICallgraphIngestionService
this.parserResolver = parserResolver ?? throw new ArgumentNullException(nameof(parserResolver));
this.artifactStore = artifactStore ?? throw new ArgumentNullException(nameof(artifactStore));
this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
this.reachabilityStore = reachabilityStore ?? throw new ArgumentNullException(nameof(reachabilityStore));
this.normalizer = normalizer ?? throw new ArgumentNullException(nameof(normalizer));
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
this.timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));
@@ -143,6 +146,12 @@ internal sealed class CallgraphIngestionService : ICallgraphIngestionService
document = await repository.UpsertAsync(document, cancellationToken).ConfigureAwait(false);
await reachabilityStore.UpsertGraphAsync(
document.GraphHash,
document.Nodes,
document.Edges,
cancellationToken).ConfigureAwait(false);
logger.LogInformation(
"Ingested callgraph {Language}:{Component}:{Version} (id={Id}) with {NodeCount} nodes and {EdgeCount} edges.",
document.Language,

View File

@@ -157,8 +157,12 @@ public sealed class ReachabilityScoringService : IReachabilityScoringService
var finalScore = baseScore * (1 - pressurePenalty);
var uncertaintyStates = MergeUncertaintyStates(existingFact?.Uncertainty?.States, unknownsCount, pressure, states.Count, computedAt);
var (uncertainty, aggregateTier) = BuildUncertaintyDocument(uncertaintyStates, baseScore, computedAt);
var riskScore = ComputeRiskScoreWithTiers(baseScore, uncertaintyStates, aggregateTier);
var (uncertainty, _, riskScore) = BuildUncertaintyDocument(
uncertaintyStates,
baseScore,
computedAt,
scoringOptions.UncertaintyEntropyMultiplier,
scoringOptions.UncertaintyBoostCeiling);
var document = new ReachabilityFactDocument
{
@@ -252,14 +256,16 @@ public sealed class ReachabilityScoringService : IReachabilityScoringService
.ToList();
}
private static (UncertaintyDocument? Document, UncertaintyTier AggregateTier) BuildUncertaintyDocument(
private static (UncertaintyDocument? Document, UncertaintyTier AggregateTier, double RiskScore) BuildUncertaintyDocument(
List<UncertaintyStateDocument> states,
double baseScore,
DateTimeOffset computedAt)
DateTimeOffset computedAt,
double entropyMultiplier,
double boostCeiling)
{
if (states.Count == 0)
{
return (null, UncertaintyTier.T4);
return (null, UncertaintyTier.T4, baseScore);
}
// Calculate aggregate tier
@@ -270,7 +276,12 @@ public sealed class ReachabilityScoringService : IReachabilityScoringService
var meanEntropy = states.Average(s => s.Entropy);
// Calculate risk score with tier modifiers
var riskScore = UncertaintyTierCalculator.CalculateRiskScore(baseScore, aggregateTier, meanEntropy);
var riskScore = UncertaintyTierCalculator.CalculateRiskScore(
baseScore,
aggregateTier,
meanEntropy,
entropyMultiplier,
boostCeiling);
var document = new UncertaintyDocument
{
@@ -280,7 +291,7 @@ public sealed class ReachabilityScoringService : IReachabilityScoringService
ComputedAt = computedAt
};
return (document, aggregateTier);
return (document, aggregateTier, riskScore);
}
private static UncertaintyStateDocument NormalizeState(UncertaintyStateDocument state)
@@ -315,23 +326,6 @@ public sealed class ReachabilityScoringService : IReachabilityScoringService
};
}
private double ComputeRiskScoreWithTiers(
double baseScore,
IReadOnlyList<UncertaintyStateDocument> uncertaintyStates,
UncertaintyTier aggregateTier)
{
var meanEntropy = uncertaintyStates.Count > 0
? uncertaintyStates.Average(s => s.Entropy)
: 0.0;
return UncertaintyTierCalculator.CalculateRiskScore(
baseScore,
aggregateTier,
meanEntropy,
scoringOptions.UncertaintyEntropyMultiplier,
scoringOptions.UncertaintyBoostCeiling);
}
private static void ValidateRequest(ReachabilityRecomputeRequest request)
{
if (string.IsNullOrWhiteSpace(request.CallgraphId))