* test(perf): pin genuine Fiddler captures and raw HTTP oracles Pin two public Microsoft SAZ captures with 13 and 1311 sessions, immutable source/digest/member coverage and predeclared caller-ordered transaction questions. Independently preserve stored HTTP headers, binary/empty bodies and archive coordinates; admit only known corpus bytes before ZIP allocation. Five reader regressions and both genuine selected-record checks pass. No production or performance-gain claim. 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> * test(perf): measure SAZ selection and retained recovery workflows Add authenticated complete/ordinal/retained-page SDK experiments, fixed real-Codex prompts and independent cited-byte grading. Preserve actual failed RPCs and exact retained-reference recovery when complete MCP delivery exceeds its receive buffer. Verify selected CLI/MCP facts, parameters and semantic Evidence identity. Keep a genuine partial-message admission-negative probe. Focused 12 tests and 10 actual-Evidence grading cases pass; no formal model or gain claim yet. 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> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(perf): verify resolved SAZ Evidence selection parameters Distinguish omitted request ordinals from the complete resolved ordinal scope recorded by WebNetworkCaptureService. Share the expected sanitized Evidence representation between SDK checks and model grading; preserve original caller arguments. A focused regression and both saved genuine baseline RPCs confirm the correction. Keep original collector failures and costs unchanged; freeze a new driver before repeated measurements. 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> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(perf): retain mixed SAZ whole-task costs and failure boundaries Record both SDK batches, twelve corrected workflows, all four actual Codex attempts, independent byte equivalence and verified payload-phase CPU/memory. Distinguish successful-analysis MCP transport limits from real provider timeouts and negative partial-message admission. Three model questions complete; the only completed pair saves 1.6 percent input but takes 2 percent longer, with no consistent benefit. Keep production APIs/defaults/cache unchanged and preserve all deviations, failed attempts and unknowns. 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> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- 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> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
49 lines
2.2 KiB
Python
49 lines
2.2 KiB
Python
"""Stored-byte semantics and fail-before-allocation admission, not providers."""
|
|
|
|
import base64
|
|
import importlib.util
|
|
from pathlib import Path
|
|
import tempfile
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
spec = importlib.util.spec_from_file_location('saz_oracle', Path(__file__).with_name('saz-oracle.py'))
|
|
oracle = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(oracle)
|
|
|
|
|
|
class SazOracleTests(unittest.TestCase):
|
|
def test_duplicate_spelling_and_folding_are_source_facts(self):
|
|
result = oracle.stored_http(b'HTTP/1.1 200 OK\r\nX-Case: first\r\nx-case:second\r\n continuation\r\n\r\n', False)
|
|
self.assertEqual(result['headers'], [{'name': 'X-Case', 'value': ' first'},
|
|
{'name': 'x-case', 'value': 'second\r\n continuation'}])
|
|
self.assertEqual(result['body']['bytes'], 0)
|
|
self.assertEqual(result['body']['text'], '')
|
|
|
|
def test_body_keeps_encoded_bytes_and_internal_separators(self):
|
|
body = b'\x1f\x8b\xff\n\n\r\n\r\n'
|
|
result = oracle.stored_http(b'HTTP/1.1 200 OK\r\nContent-Encoding: gzip\r\n\r\n' + body, False)
|
|
self.assertEqual(base64.b64decode(result['body']['content_base64']), body)
|
|
self.assertIsNone(result['body']['text'])
|
|
|
|
def test_first_lf_separator_owns_body_with_later_crlf_separator(self):
|
|
result = oracle.stored_http(b'GET / HTTP/1.1\nHost: example.com\n\nbody\r\n\r\n', True)
|
|
self.assertEqual(result['body']['text'], 'body\r\n\r\n')
|
|
|
|
def test_malformed_start_and_unowned_continuation_fail(self):
|
|
for data in [b'garbage\r\n\r\n', b'HTTP/1.1 200 OK\r\n orphan\r\n\r\n']:
|
|
with self.assertRaises(ValueError):
|
|
oracle.stored_http(data, False)
|
|
|
|
def test_wrong_digest_cannot_allocate_zip_objects(self):
|
|
with tempfile.TemporaryDirectory() as root:
|
|
path = Path(root)/'wrong.saz'
|
|
path.write_bytes(b'X'*43515)
|
|
with patch.object(oracle.zipfile, 'ZipFile', side_effect=AssertionError('Too late')):
|
|
with self.assertRaisesRegex(ValueError, 'pinned SAZ corpus'):
|
|
oracle.read_saz('xbox-clear_nomp.saz', path)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|