fix(evidence): classify derived failures at their owning boundary
Parse caller selections and authenticated Evidence at their owners, reuse the parsed function and comparison facts, and preserve unexpected implementation failures. Remove downstream error guessing and redundant validation wrappers. Verify with 526 affected tests, source checks, docs conformance, test discovery and duplication checks. Seven public SDK regressions fail on the main baseline. No real-provider execution was performed.
This commit is contained in:
1 parent
7091be291c
commit
93a384db77
46 files changed
+1706
-566
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import { requireAuthenticationHeadroom } from "./JsonAuthenticationHeadroom.js";
|
||||
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
||||
|
||||
import { describeValidationFailure } from "../domain/validationFailure.js";
|
||||
import {
|
||||
describeEvidenceBundleFailure,
|
||||
describeValidationFailure,
|
||||
parseImmutableEvidenceBundle,
|
||||
parseEvidenceBundle,
|
||||
type EvidenceBundle,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { AnalysisProtocolError } from "../domain/analysisErrorCore.js";
|
||||
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import {
|
||||
createEvidence,
|
||||
type Evidence,
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
import type { MobileApplicationProjectionWithSources } from "../domain/mobileApplicationGraphProjection.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { requestInputError, workflowInputError } from "./workflowInputError.js";
|
||||
import { requestInputError } from "./workflowInputError.js";
|
||||
import { ArtifactInventoryCarrierError } from "../domain/artifactInventoryEvidence.js";
|
||||
|
||||
interface InventoryProjectionInput {
|
||||
readonly inventory_evidence: readonly Evidence[];
|
||||
@@ -42,7 +43,6 @@ interface InventoryProjectionOptions<
|
||||
readonly predicateType: string;
|
||||
readonly provider: EvidenceProvider;
|
||||
readonly subjectFormat: (first: Evidence) => EvidenceSubjectTarget["format"];
|
||||
readonly protocolError: string;
|
||||
}
|
||||
|
||||
/** Parse one inventory projection and wrap its deterministic result in Evidence. */
|
||||
@@ -92,10 +92,25 @@ export const projectInventoryEvidence = <
|
||||
sources: projected.sources,
|
||||
});
|
||||
} catch (cause: unknown) {
|
||||
return err(
|
||||
cause instanceof TypeError || cause instanceof z.ZodError
|
||||
? workflowInputError(options.operation, cause)
|
||||
: new AnalysisProtocolError(options.protocolError, { cause }),
|
||||
);
|
||||
if (cause instanceof AnalysisError) return err(cause);
|
||||
if (cause instanceof ArtifactInventoryCarrierError)
|
||||
return err(
|
||||
new AnalysisInputError(
|
||||
options.operation,
|
||||
{ cause, userMessage: cause.message },
|
||||
[
|
||||
{
|
||||
path: [
|
||||
"inventory_evidence",
|
||||
...(cause.index === undefined ? [] : [cause.index]),
|
||||
...(cause.index === undefined ? [] : ["operation"]),
|
||||
],
|
||||
reason: "invalid_value",
|
||||
message: cause.message,
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
throw cause;
|
||||
}
|
||||
};
|
||||
@@ -2,8 +2,8 @@ import { uniqueSorted, uniqueSortedBy } from "../domain/canonicalOrdering.js";
|
||||
import { digestCanonicalValue } from "../domain/canonicalDigest.js";
|
||||
|
||||
import type { Evidence } from "../domain/evidence.js";
|
||||
import { describeValidationFailure } from "../domain/validationFailure.js";
|
||||
import {
|
||||
describeValidationFailure,
|
||||
parseEvidenceBundle,
|
||||
type EvidenceBundle,
|
||||
} from "../domain/evidenceBundle.js";
|
||||
|
||||
@@ -24,6 +24,5 @@ export const projectAndroidApplicationEvidence = (
|
||||
predicateType: "rea.android-application-graph",
|
||||
provider: ANDROID_APPLICATION_PROVIDER,
|
||||
subjectFormat: () => "apk",
|
||||
protocolError: "Android application projection produced an invalid result",
|
||||
});
|
||||
};
|
||||
@@ -24,6 +24,5 @@ export const projectAppleApplicationEvidence = (
|
||||
predicateType: "rea.apple-application-graph",
|
||||
provider: APPLE_APPLICATION_PROVIDER,
|
||||
subjectFormat: (first) => first.subject?.format ?? "unknown",
|
||||
protocolError: "Apple application projection produced an invalid result",
|
||||
});
|
||||
};
|
||||
@@ -24,7 +24,5 @@ export const projectHarmonyApplicationEvidence = (
|
||||
predicateType: "rea.harmony-application-graph",
|
||||
provider: HARMONY_APPLICATION_PROVIDER,
|
||||
subjectFormat: (first) => first.subject?.format ?? "unknown",
|
||||
protocolError:
|
||||
"HarmonyOS application projection produced an invalid result",
|
||||
});
|
||||
};
|
||||
@@ -10,7 +10,7 @@ import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
|
||||
import type { AnalysisErrorProjection } from "../../domain/analysisErrorProjection.js";
|
||||
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
||||
import { createEvidence } from "../../domain/evidence.js";
|
||||
import { describeValidationFailure } from "../../domain/evidenceBundle.js";
|
||||
import { describeValidationFailure } from "../../domain/validationFailure.js";
|
||||
import { jsonValueSchema } from "../../domain/jsonValue.js";
|
||||
import {
|
||||
analysisInputErrorFromIssues,
|
||||
|
||||
Reference in new issue
Block a user