From a4634ba21b1e63a8435d9b12c9890d2f095a1a3c Mon Sep 17 00:00:00 2001 From: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Date: Tue, 13 Oct 2026 18:03:29 +0000 Subject: [PATCH] fix(perf): bind summary views to outer artifact identity Verify both the summary target and outer view artifact against the selected capture at the shared SDK observation boundary and full factual grader. Make the passing fixture preserve the real outer artifact and reject missing or incorrect outer identities without changing original model measurements. Validation: 29 related grading/context tests, before/after actual SDK fault probes with complete/summary controls, and all four stored factual regrades. 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> --- experiments/analysis-efficiency/measure.mjs | 5 ++++- .../analysis-efficiency/pcap-small-captures.md | 11 +++++++++-- experiments/analysis-efficiency/review-model.py | 1 + .../analysis-efficiency/test_codex_context.py | 17 ++++++++++++++++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/experiments/analysis-efficiency/measure.mjs b/experiments/analysis-efficiency/measure.mjs index 14b339aa3..11faa451b 100644 --- a/experiments/analysis-efficiency/measure.mjs +++ b/experiments/analysis-efficiency/measure.mjs @@ -551,7 +551,10 @@ const pcapObservation = (evidence, requestedView) => { evidence.subject?.digest?.sha256 !== inputSha || evidence.subject?.local_path !== values.path || target?.sha256 !== inputSha || - target?.path !== values.path + target?.path !== values.path || + (value.kind === "summary" && + (value.artifact?.sha256 !== inputSha || + value.artifact?.path !== values.path)) ) throw new Error("PCAP Evidence does not identify the selected capture"); // Summary delivery delegates to a retained view, whose Evidence operation is diff --git a/experiments/analysis-efficiency/pcap-small-captures.md b/experiments/analysis-efficiency/pcap-small-captures.md index 65953b1bc..ea944caef 100644 --- a/experiments/analysis-efficiency/pcap-small-captures.md +++ b/experiments/analysis-efficiency/pcap-small-captures.md @@ -126,7 +126,7 @@ validated. Both real CLI complete results match full MCP normalized results, subjects, parameters, IDs and limitations. Portable CLI summary/URI views match MCP retained normalized facts and subjects; source forms/caller parameters remain distinct. -Source bytes stay unchanged. Twenty-eight context/grading regressions pass, including +Source bytes stay unchanged. Twenty-nine context/grading regressions pass, including cited complete metadata/counts/UTF-16 diagnostics and exact ordered response ID lists that reject parent lookups, duplicates and nested representations. URI prefix coverage must come from its cited page, even if an uncited page has the @@ -159,7 +159,7 @@ the preceding driver accepts inconsistent coverage, while the corrected driver rejects wrong status, next offset or exhaustion. Unmodified exhausted and continuable URI pages still pass. The grader also requires each cited receipt's subject digest and local path to identify the reference capture, and uses the -reference page's verified coverage. Twenty-eight grading/context regressions pass, +reference page's verified coverage. Twenty-nine grading/context regressions pass, including missing or malformed subjects and faithful but inconsistent coverage; all four original model answers still pass factual regrading. Strict resource grades remain false where terminal whole-scope counters are unknown. @@ -237,3 +237,10 @@ accepted inconsistent summary coverage and verify rejection after the guard; complete and summary controls still pass. These mutations do not establish a malformed-response defect in the provider. The four stored model answers still pass factual regrading without another model run. + +Summary views must preserve both the outer artifact path/digest and the nested +summary target, as well as the Evidence subject. The full grader rejects +faithful receipts with missing or incorrect outer artifact identities. Private +mutations over actual SDK replies reproduce the previous false success and +verify rejection after the shared observation guard; normal deliveries and all +four original model answers retain their recorded facts. diff --git a/experiments/analysis-efficiency/review-model.py b/experiments/analysis-efficiency/review-model.py index e329c936d..6c8dee8e6 100644 --- a/experiments/analysis-efficiency/review-model.py +++ b/experiments/analysis-efficiency/review-model.py @@ -328,6 +328,7 @@ def main(): source.get('kind') == 'summary' and source.get('parent_operation') == 'inspect_pcap_capture' and capture == reference['capture'] + and source.get('artifact') == {key: capture['target'][key] for key in ['path', 'sha256']} and isinstance(source.get('parent_evidence_id'), str) and page.get('parent_evidence_id') == source['parent_evidence_id'] and page.get('parent_operation') == 'inspect_pcap_capture' diff --git a/experiments/analysis-efficiency/test_codex_context.py b/experiments/analysis-efficiency/test_codex_context.py index 779fc317a..326f27f02 100644 --- a/experiments/analysis-efficiency/test_codex_context.py +++ b/experiments/analysis-efficiency/test_codex_context.py @@ -87,7 +87,8 @@ class PcapGraderWorkflowTests(unittest.TestCase): 'limitations': ['source', 'view'], 'normalized_result': {'kind': 'summary', 'view': {'kind': 'summary'}, 'parent_operation': 'inspect_pcap_capture', 'parent_evidence_id': parent, - 'summary': capture, 'coverage': {'status': 'complete-within-view', 'examined': 1, 'total': 1, 'next_offset': None, 'exhausted': True}, + 'summary': capture, 'artifact': copy.deepcopy(capture['target']), + 'coverage': {'status': 'complete-within-view', 'examined': 1, 'total': 1, 'next_offset': None, 'exhausted': True}, 'limitations': ['source', 'view'], 'unknowns': ['unrecorded traffic']}} page = {'evidence_id': page_id, 'operation': 'inspect_analysis_view', 'subject': copy.deepcopy(subject), 'evidence_links': [parent], @@ -354,6 +355,20 @@ class PcapGraderWorkflowTests(unittest.TestCase): answer, records, reference = self.fixture();records[index]['normalized_result'][field] = wrong self.assertFalse(self.grade(answer, records, reference, tools)['all_factual_checks_pass']) + def test_summary_outer_artifact_must_identify_the_selected_capture(self): + for wrong in [None, {}, [], 'artifact', + {'path': '/fixture/other.pcapng', 'sha256': 'd' * 64}, + {'path': '/fixture/http.pcapng', 'sha256': 'e' * 64}]: + with self.subTest(artifact=wrong): + answer, records, reference = self.fixture() + records[0]['normalized_result']['artifact'] = wrong + report = self.grade(answer, records, reference) + self.assertTrue(report['factual_checks']['pcap_original_delivery_observations']) + self.assertFalse(report['all_factual_checks_pass']) + answer, records, reference = self.fixture() + records[0]['normalized_result'].pop('artifact') + self.assertFalse(self.grade(answer, records, reference)['all_factual_checks_pass']) + def test_faithful_summary_coverage_must_describe_the_single_complete_view(self): for field, wrong in [('status', 'page'), ('examined', 0), ('total', 2), ('next_offset', 0), ('exhausted', False), ('examined', 1.0)]: