save progress
This commit is contained in:
@@ -70,7 +70,35 @@ internal static class ReachabilityFactDigestCalculator
|
||||
Score: state.Score,
|
||||
Path: NormalizeList(state.Path),
|
||||
RuntimeHits: NormalizeList(state.Evidence?.RuntimeHits),
|
||||
BlockedEdges: NormalizeList(state.Evidence?.BlockedEdges)))
|
||||
BlockedEdges: NormalizeList(state.Evidence?.BlockedEdges),
|
||||
GateMultiplierBps: Math.Clamp(state.Evidence?.GateMultiplierBps ?? 10000, 0, 10000),
|
||||
Gates: NormalizeGates(state.Evidence?.Gates)))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static List<CanonicalGate> NormalizeGates(IEnumerable<CallgraphGate>? gates)
|
||||
{
|
||||
if (gates is null)
|
||||
{
|
||||
return new List<CanonicalGate>();
|
||||
}
|
||||
|
||||
return gates
|
||||
.Where(g => g is not null)
|
||||
.Select(g => new CanonicalGate(
|
||||
Type: g.Type.ToString(),
|
||||
GuardSymbol: g.GuardSymbol?.Trim() ?? string.Empty,
|
||||
DetectionMethod: g.DetectionMethod?.Trim() ?? string.Empty,
|
||||
Confidence: double.IsNaN(g.Confidence) ? 0.0 : Math.Clamp(g.Confidence, 0.0, 1.0),
|
||||
SourceFile: string.IsNullOrWhiteSpace(g.SourceFile) ? null : g.SourceFile.Trim(),
|
||||
LineNumber: g.LineNumber is > 0 ? g.LineNumber : null,
|
||||
Detail: g.Detail?.Trim() ?? string.Empty))
|
||||
.OrderBy(g => g.Type, StringComparer.Ordinal)
|
||||
.ThenBy(g => g.GuardSymbol, StringComparer.Ordinal)
|
||||
.ThenBy(g => g.DetectionMethod, StringComparer.Ordinal)
|
||||
.ThenBy(g => g.SourceFile, StringComparer.Ordinal)
|
||||
.ThenBy(g => g.LineNumber ?? 0)
|
||||
.ThenBy(g => g.Detail, StringComparer.Ordinal)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -192,7 +220,18 @@ internal static class ReachabilityFactDigestCalculator
|
||||
double Score,
|
||||
List<string> Path,
|
||||
List<string> RuntimeHits,
|
||||
List<string> BlockedEdges);
|
||||
List<string> BlockedEdges,
|
||||
int GateMultiplierBps,
|
||||
List<CanonicalGate> Gates);
|
||||
|
||||
private sealed record CanonicalGate(
|
||||
string Type,
|
||||
string GuardSymbol,
|
||||
string DetectionMethod,
|
||||
double Confidence,
|
||||
string? SourceFile,
|
||||
int? LineNumber,
|
||||
string Detail);
|
||||
|
||||
private sealed record CanonicalRuntimeFact(
|
||||
string SymbolId,
|
||||
|
||||
Reference in New Issue
Block a user