refactor(evidence): centralize JSON payload admission

Give ordinary Evidence creation an explicit unknown-payload input contract
while retaining the strong JSON contract for producer helpers and cooperative
immutable creation. Keep schema admission, input snapshotting and identity
hashing with the Evidence owner.

Remove 32 generic JSON preparses that only fed ordinary Evidence construction.
Preserve semantic format validation, selected-source bindings, standalone
JSON boundaries, typed executions and scenario digest contracts. Invalid JSON
now reports its Evidence parameters/normalized_result/raw_result prefix.

Validation: fresh runtime/catalog build, 560 focused and README tests passed,
4 platform-specific cases skipped, full static/docs checks, test discovery,
duplication and diff checks. New regressions cover omitted semantic optionals,
raw-result defaults and nested undefined refusal without input mutation.
Installed providers, real browsers/Frida/JADX and Linux-only recovery remain
unverified; boundary providers are authored fixtures.
This commit is contained in:
morluto committed 2026-10-25 05:01:36 +08:00
1 parent 835904e4ee
commit 58fb824105
26 files changed
+162 -69

No files matched your search

@@ -4,7 +4,7 @@ import type { CanonicalElectronActiveObservationInput } from "./ElectronActiveOb
import type { Evidence, EvidenceObservation } from "../../domain/evidence.js";
import { createEvidence } from "../../domain/evidence.js";
import type { ElectronActiveObservationResult } from "../../domain/javascript/electronActiveObservation.js";
import { jsonObjectSchema, jsonValueSchema } from "../../domain/jsonValue.js";
import { jsonObjectSchema } from "../../domain/jsonValue.js";
/** Commit the selected Electron experiment and its observed result. */
export const createElectronActiveEvidence = (
@@ -16,7 +16,7 @@ export const createElectronActiveEvidence = (
predicateType: "rea.electron-active-scenario",
operation: "capture_electron_scenario",
parameters: parameters(input),
result: jsonValueSchema.parse(result),
result,
confidence: "observed",
authority: "controlled-replay",
environment: {
@@ -11,7 +11,6 @@ import {
javascriptRecoveryInputSchema,
javascriptRecoveryResultSchema,
} from "../../domain/javascript/javascriptRecovery.js";
import { jsonObjectSchema, jsonValueSchema } from "../../domain/jsonValue.js";
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
import { err, type Result } from "../../domain/result.js";
import type { ExecutionOptions } from "../AnalysisProvider.js";
@@ -115,8 +114,8 @@ export class JavaScriptRecoveryService {
execution.value.provider,
{
operation: OPERATION,
parameters: jsonObjectSchema.parse(parsed.data),
result: jsonValueSchema.parse(result.data),
parameters: parsed.data,
result: result.data,
rawResult: execution.value.rawResult,
locations: execution.value.locations,
limitations: execution.value.limitations,
@@ -10,7 +10,6 @@ import type {
ListJavaScriptRuntimeTargetsInput,
ObserveJavaScriptRuntimeInput,
} from "../../domain/javascript/javascriptRuntimeObservation.js";
import { jsonValueSchema } from "../../domain/jsonValue.js";
type RuntimeObservationOperation =
| "list_javascript_runtime_targets"
@@ -30,7 +29,7 @@ export const createJavaScriptRuntimeObservationEvidence = (
: "rea.javascript-runtime-observation",
operation,
parameters: parameters(input),
result: jsonValueSchema.parse(result),
result,
rawResult: null,
confidence: "observed",
authority: "external-service",