fix(perf): validate summary coverage and normalized provenance
Reject PCAP summaries that do not describe their single complete view and reject present normalized limitations/unknowns outside string arrays at the shared observation boundary and factual grader. Preserve omission and empty arrays. Add regressions that reproduce faithful malformed receipts and keep original model measurements unchanged. Validation: 28 context/grader tests, seven actual SDK consumer fault/control probes, and factual regrading of all four original model answers. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
committed by
morluto
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Kaoru0822
parent
008c55c835
commit
14c93a753f
@@ -534,6 +534,13 @@ const pcapObservation = (evidence, requestedView) => {
|
||||
if (typeof evidenceId !== "string" || !PCAP_EVIDENCE_ID.test(evidenceId))
|
||||
throw new Error("PCAP Evidence receipt identity is missing or malformed");
|
||||
const value = normalized(evidence);
|
||||
for (const key of ["limitations", "unknowns"])
|
||||
if (
|
||||
Object.hasOwn(value, key) &&
|
||||
(!Array.isArray(value[key]) ||
|
||||
!value[key].every((item) => typeof item === "string"))
|
||||
)
|
||||
throw new Error("PCAP normalized provenance lacks a valid string list");
|
||||
const target =
|
||||
value.kind === "summary"
|
||||
? value.summary?.target
|
||||
@@ -618,6 +625,16 @@ const inspectPcapTarget = async () => {
|
||||
if (values.delivery === "summary") {
|
||||
if (n.kind !== "summary" || n.parent_operation !== "inspect_pcap_capture")
|
||||
throw new Error("Runtime returned no requested PCAP summary");
|
||||
if (
|
||||
!isDeepStrictEqual(n.coverage, {
|
||||
status: "complete-within-view",
|
||||
examined: 1,
|
||||
total: 1,
|
||||
next_offset: null,
|
||||
exhausted: true,
|
||||
})
|
||||
)
|
||||
throw new Error("PCAP summary coverage differs from its complete view");
|
||||
capture = n.summary;
|
||||
const parentEvidenceId = observations[0].parent_evidence_id;
|
||||
const view = { kind: "pcap", facet: "http-uris", offset: 0, limit: 2 };
|
||||
|
||||
Reference in New Issue
Block a user