fix(perf): authenticate PCAP receipts with the runtime owner

Validate complete, summary and page Evidence with the selected runtime’s
existing authenticated parser before recording observations. Preserve the
original envelope and remove duplicate outer shape/ID checks now owned by
that parser. Keep task-specific capture/view semantics separate.

Actual SDK before/after swapped-ID faults reproduce the false acceptance
and verify rejection, with final complete/summary controls passing. All six
original receipts from four real-model tasks independently authenticate
against the pinned runtime. Pure factual-grader fixtures are not claimed as
authentication evidence. Unchanged Python/comparator tests are not rerun.

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:
N0zoM1z0
2026-10-14 02:40:31 +08:00
committed by morluto
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Kaoru0822
parent e5a5c17e52
commit e6cf2e354e
2 changed files with 19 additions and 9 deletions
+10 -9
View File
@@ -524,15 +524,11 @@ const inspectEvmTarget = async () => {
};
const PCAP_EVIDENCE_ID = /^ev_[a-f0-9]{64}$/u;
const pcapObservation = (evidence, requestedView) => {
if (
!Array.isArray(evidence.limitations) ||
!evidence.limitations.every((item) => typeof item === "string")
)
throw new Error("PCAP Evidence lacks a valid limitations list");
const pcapObservation = (evidence, requestedView, parseEvidence) => {
// Authenticate with the selected runtime's owner, preserving the original
// envelope for measurement and provenance rather than reconstructing it.
parseEvidence(evidence);
const evidenceId = evidence.evidence_id;
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 (
@@ -609,6 +605,10 @@ const pcapObservation = (evidence, requestedView) => {
};
};
const inspectPcapTarget = async () => {
const { parseEvidence } = await import(
pathToFileURL(resolve(values["runtime-root"], "dist/domain/evidence.js"))
.href
);
const input = {
path: values.path,
...(values.delivery === "summary" ? { detail: "summary" } : {}),
@@ -627,6 +627,7 @@ const inspectPcapTarget = async () => {
pcapObservation(
inspected,
values.delivery === "summary" ? { kind: "summary" } : undefined,
parseEvidence,
),
];
let capture, uris;
@@ -651,7 +652,7 @@ const inspectPcapTarget = async () => {
view,
});
const page = normalized(selected);
const observation = pcapObservation(selected, view);
const observation = pcapObservation(selected, view, parseEvidence);
const total = capture.retained_counts.http_request_uris;
const examined = Math.min(view.limit, total);
const expectedCoverage = {
@@ -250,3 +250,12 @@ parent Evidence ID for both summary and page views. SDK acceptance and factual
grading reject mismatches and missing digests while preserving complete
deliveries. Before/after private actual-reply mutations verify both view roles;
unmodified deliveries and four stored original-model factual regrades pass.
The SDK observation boundary additionally authenticates each complete, summary
and page envelope with the selected runtime’s existing `parseEvidence` owner.
It preserves the original envelope, without duplicating semantic-ID hashing.
Format-valid swapped-ID mutations over actual SDK replies pass before this
guard and fail afterward; unmodified complete/summary controls pass. The model
grader tests selected facts against cited transcript receipts; its synthetic
fixtures do not establish Evidence authentication. The original real-model
receipts are independently authenticated against the pinned runtime.