Some checks failed
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
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System;
|
|
|
|
namespace StellaOps.Scanner.Reachability;
|
|
|
|
/// <summary>
|
|
/// Represents optional symbol metadata (mangled/demangled names, source, confidence).
|
|
/// Used to enrich reachability evidence without altering canonical IDs.
|
|
/// </summary>
|
|
public sealed record ReachabilitySymbol(
|
|
string? Mangled,
|
|
string? Demangled,
|
|
string? Source,
|
|
double? Confidence)
|
|
{
|
|
public ReachabilitySymbol Trimmed()
|
|
=> new(
|
|
TrimOrNull(Mangled),
|
|
TrimOrNull(Demangled),
|
|
NormalizeSource(Source),
|
|
Confidence is null ? null : ClampConfidence(Confidence.Value));
|
|
|
|
private static string? TrimOrNull(string? value)
|
|
=> string.IsNullOrWhiteSpace(value) ? null : value.Trim();
|
|
|
|
private static string? NormalizeSource(string? source)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(source))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return source.Trim().ToUpperInvariant();
|
|
}
|
|
|
|
private static double ClampConfidence(double value)
|
|
=> Math.Max(0.0, Math.Min(1.0, value));
|
|
}
|