up
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -96,7 +96,7 @@ public sealed class EntryTraceRuntimeReconciler
|
||||
terminalBuilder[index] = terminalBuilder[index] with { Confidence = confidence.Score };
|
||||
}
|
||||
|
||||
diagnostics.Add(BuildDiagnostic(confidence, plan.TerminalPath));
|
||||
diagnostics.Add(BuildDiagnostic(confidence, plan.TerminalPath, procGraph, match?.Process));
|
||||
}
|
||||
|
||||
// Update any terminals that were not tied to plans.
|
||||
@@ -242,7 +242,7 @@ public sealed class EntryTraceRuntimeReconciler
|
||||
return new ConfidenceResult(60d, ConfidenceLevel.Low, runtimePath);
|
||||
}
|
||||
|
||||
private static EntryTraceDiagnostic BuildDiagnostic(ConfidenceResult result, string predictedPath)
|
||||
private EntryTraceDiagnostic BuildDiagnostic(ConfidenceResult result, string predictedPath, ProcGraph procGraph, ProcProcess? process)
|
||||
{
|
||||
var runtimePath = string.IsNullOrWhiteSpace(result.RuntimePath) ? "<unknown>" : result.RuntimePath;
|
||||
var severity = result.Level == ConfidenceLevel.High
|
||||
@@ -251,10 +251,18 @@ public sealed class EntryTraceRuntimeReconciler
|
||||
var reason = result.Level == ConfidenceLevel.High
|
||||
? EntryTraceUnknownReason.RuntimeMatch
|
||||
: EntryTraceUnknownReason.RuntimeMismatch;
|
||||
|
||||
var chain = process is null ? null : BuildProcessChain(procGraph, process.Value);
|
||||
|
||||
var message = result.Level == ConfidenceLevel.High
|
||||
? $"Runtime process '{runtimePath}' matches EntryTrace prediction '{predictedPath}'."
|
||||
: $"Runtime process '{runtimePath}' diverges from EntryTrace prediction '{predictedPath}'.";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(chain))
|
||||
{
|
||||
message += $" Runtime chain: {chain}.";
|
||||
}
|
||||
|
||||
return new EntryTraceDiagnostic(
|
||||
severity,
|
||||
reason,
|
||||
@@ -269,6 +277,50 @@ public sealed class EntryTraceRuntimeReconciler
|
||||
return command.Length > 0 && WrapperNames.Contains(command);
|
||||
}
|
||||
|
||||
private static string? BuildProcessChain(ProcGraph graph, ProcProcess process)
|
||||
{
|
||||
var chain = new List<string>();
|
||||
var current = process;
|
||||
while (true)
|
||||
{
|
||||
var display = string.IsNullOrWhiteSpace(current.ExecutablePath)
|
||||
? current.CommandName
|
||||
: current.ExecutablePath;
|
||||
if (string.IsNullOrWhiteSpace(display))
|
||||
{
|
||||
display = current.CommandName;
|
||||
}
|
||||
|
||||
chain.Add(display);
|
||||
|
||||
if (current.ParentPid == current.Pid || current.ParentPid == 0 || !graph.Processes.TryGetValue(current.ParentPid, out var parent))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
current = parent;
|
||||
}
|
||||
|
||||
chain.Reverse();
|
||||
|
||||
// Collapse adjacent wrappers to a single token for readability.
|
||||
var collapsed = new List<string>(chain.Count);
|
||||
foreach (var segment in chain)
|
||||
{
|
||||
var name = Path.GetFileName(segment);
|
||||
var isWrapper = WrapperNames.Contains(name);
|
||||
|
||||
if (isWrapper && collapsed.Count > 0 && WrapperNames.Contains(Path.GetFileName(collapsed[^1])))
|
||||
{
|
||||
continue; // skip duplicate adjacent wrapper entries
|
||||
}
|
||||
|
||||
collapsed.Add(segment);
|
||||
}
|
||||
|
||||
return collapsed.Count == 0 ? null : string.Join(" -> ", collapsed);
|
||||
}
|
||||
|
||||
private static string GetCommandName(ProcProcess process)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(process.CommandName))
|
||||
|
||||
@@ -3,3 +3,6 @@
|
||||
| Task ID | Status | Date | Summary |
|
||||
| --- | --- | --- | --- |
|
||||
| SCANNER-ENG-0008 | DONE | 2025-11-16 | Documented quarterly EntryTrace heuristic cadence and workflow; attached to Sprint 0138 Execution Log. |
|
||||
| SCANNER-ENTRYTRACE-18-504 | DONE | 2025-12-01 | EntryTrace NDJSON emission and streaming (entry/node/edge/target/warning/capability) wired via Worker → WebService/CLI. |
|
||||
| SCANNER-ENTRYTRACE-18-505 | DONE | 2025-12-01 | Runtime ProcGraph reconciliation adjusts plan/terminal confidence and diagnostics for matches/mismatches. |
|
||||
| SCANNER-ENTRYTRACE-18-506 | DONE | 2025-12-01 | EntryTrace graph/NDJSON exposed via WebService `/scans/{id}/entrytrace` and CLI rendering. |
|
||||
|
||||
Reference in New Issue
Block a user