refactor(javascript): own runtime reconciliation failures

Return expected source and semantic failures from the runtime input owner as tagged Results. Bind source schema validation to concrete schemas, preserve nested active-capture paths, and let unexpected interpretation and derivation failures reach the adapter boundary.

Remove broad protocol-error wrappers, duplicate active identity validation, and redundant JSON result parsing. Migrate parsed-fact consumers and retain CLI/MCP contracts. Relevant source and public-boundary tests pass; six injected implementation-fault controls fail on the prior revision. Live Electron behavior was not exercised.
This commit is contained in:
morluto committed 2026-10-23 09:55:02 +08:00
1 parent ed069bb9d4
commit f4b2ba1313
13 files changed
+358 -171

No files matched your search

@@ -1,6 +1,6 @@
import { digestCanonicalValue } from "../canonicalDigest.js";
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
import { parseEvidence, type Evidence } from "../evidence.js";
import type { Evidence } from "../evidence.js";
import {
javascriptApplicationAnalysisResultSchema,
type JavaScriptApplicationAnalysisResult,
@@ -9,8 +9,9 @@ import type { JavaScriptApplicationGraph } from "./javascriptApplicationGraph.js
import type { ReconcileJavaScriptRuntimeInput } from "./javascriptRuntimeReconciliationSchemas.js";
import {
assertEvidenceIdentity,
authenticateRuntimeEvidence,
invalidInput,
parseAtPath,
parseInputAtPath,
} from "./javascriptRuntimeReconciliationInputValidation.js";
type StaticLayerInput =
@@ -43,9 +44,9 @@ const parseStaticLayer = (
layer: StaticLayerInput,
evidencePath: readonly (string | number)[],
): ParsedStaticLayer => {
const evidence = parseAtPath(parseEvidence, layer.analysis, evidencePath);
const result = parseAtPath(
(value) => javascriptApplicationAnalysisResultSchema.parse(value),
const evidence = authenticateRuntimeEvidence(layer.analysis, evidencePath);
const result = parseInputAtPath(
javascriptApplicationAnalysisResultSchema,
evidence.normalized_result,
[...evidencePath, "normalized_result"],
);