perf(javascript): remove duplicate workflow Evidence snapshots

Pass typed workflow results directly to createEvidence, which validates generic JSON and takes the owned snapshot. Remove the extra generic parse and full result clone from all five workflow helpers; domain producers retain their specific schema validation.

Flameox confirmed JSON validation and copying costs. Alternating warm runs creating Evidence for a valid 2,001-node trace reduced median boundary time from 15.94 ms to 11.20 ms over 120 samples per variant, with identical output digests and independent mutable-input snapshots. This does not measure end-to-end workflow latency.

Validation: 39 focused CLI, SDK MCP and filesystem workflow tests and 17 Evidence tests passed; build, static and documentation checks passed. No deep analysis providers were exercised for this change.
This commit is contained in:
morluto
2026-10-11 03:56:59 +08:00
parent 39da0b150b
commit 6db97d5162
@@ -7,7 +7,6 @@ import type { ApplicationVersionComparisonResult } from "../../domain/javascript
import type { JavaScriptExportShapeComparisonResult } from "../../domain/javascript/javascriptExportShapeComparisonSchemas.js";
import type { ApplicationFeatureTraceResult } from "../../domain/javascript/javascriptFeatureTraceSchemas.js";
import type { JavaScriptSemanticTraceResult } from "../../domain/javascript/javascriptSemanticTraceSchemas.js";
import { jsonValueSchema } from "../../domain/jsonValue.js";
import type { SourceToBundleComparisonResult } from "../../domain/javascript/sourceToBundleComparisonSchemas.js";
import { JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER } from "../InvestigationProviders.js";
@@ -20,7 +19,7 @@ export const createApplicationFeatureTraceEvidence = (
predicateType: "rea.application-feature-trace",
operation: "trace_application_feature",
parameters,
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "inferred",
authority: "analyst-inference",
@@ -38,7 +37,7 @@ export const createJavaScriptSemanticTraceEvidence = (
predicateType: "rea.javascript-semantic-trace",
operation: "trace_javascript_semantics",
parameters,
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "inferred",
authority: "analyst-inference",
@@ -56,7 +55,7 @@ export const createApplicationVersionComparisonEvidence = (
predicateType: "rea.application-version-comparison",
operation: "compare_application_versions",
parameters,
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "inferred",
authority: "analyst-inference",
@@ -74,7 +73,7 @@ export const createSourceToBundleComparisonEvidence = (
predicateType: "rea.source-to-bundle-comparison",
operation: "compare_source_to_bundle",
parameters,
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "inferred",
authority: "analyst-inference",
@@ -92,7 +91,7 @@ export const createJavaScriptExportShapeComparisonEvidence = (
predicateType: "rea.javascript-export-shape-comparison",
operation: "compare_javascript_export_shapes",
parameters,
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "inferred",
authority: "analyst-inference",