| 1 | { |
| 2 | "schema_version": 1, |
| 3 | "base_head": "018e7593ecb2b3a7ae0bc17a440ecf2c0de8b4dd", |
| 4 | "csharp_reference": { |
| 5 | "head": "f56324c98468076c57e18255ac1661a66fe26f84", |
| 6 | "pr": 18, |
| 7 | "paths": [ |
| 8 | "tests/gzip-history-integration-probe/BoundaryProbe.cs", |
| 9 | "tests/gzip-history-integration-probe/PendingValidation.cs", |
| 10 | "tests/gzip-history-integration-probe/contract.json" |
| 11 | ] |
| 12 | }, |
| 13 | "provenance": { |
| 14 | "implementation": "New Rust implementation of the C# boundary/budget behavior. No source inclusion or dependency on another candidate. Root MIT license applies.", |
| 15 | "api_reference": "PR33 90eafe0b4dcda137e90c78685b64abefa6f33357 experiments/rust-typed-deflate/src/typed_deflate.rs and cached zlib-rs 0.6.8 public API", |
| 16 | "differences_from_pr33": [ |
| 17 | "No ZIP/JSON/base64, crc32fast, cfg-if, path source inclusion, provisional sink or expected ZIP size", |
| 18 | "Actual failed decode output charged before backend error propagation", |
| 19 | "No 131072-call ceiling; continuation requires consumed input or produced output" |
| 20 | ] |
| 21 | }, |
| 22 | "api": { |
| 23 | "read": "read(Request { input: Box<[u8]>, selected: bool }, &mut Budget, FnMut(Checkpoint) -> Result<(), Stop<E>>) -> Result<Completed, Error<E>>", |
| 24 | "budget": "Budget::new(Limits), limits(), usage(), elapsed(). Caller retains the same mutable Budget across retries; no reset API. Instant starts at construction.", |
| 25 | "completed": "Boundary { header_bytes, deflate_bytes, read_ahead_bytes, inflated_bytes, crc32, member_bytes, offered_bytes }; bytes: Option<Vec<u8>>; cumulative usage snapshot", |
| 26 | "unselected": "None output still fully decodes and verifies. Some(empty Vec) distinguishes selected empty payload.", |
| 27 | "ownership": "Input consumed by ownership. Output stays private until successful final check after decoder drop. Failure drops all temporary output but retains budget charges. No early sink or user-controlled decoder injection." |
| 28 | }, |
| 29 | "format": [ |
| 30 | "Single GZip member only; exact magic, CM=8, reserved flags clear", |
| 31 | "Consume MTIME/XFL/OS and FTEXT without interpreting them", |
| 32 | "FEXTRA u16 length and exact bytes; FNAME/FCOMMENT terminated byte fields, never paths or Unicode strings", |
| 33 | "FHCRC lower 16 bits of zlib-rs CRC32 over preceding header bytes", |
| 34 | "Raw Inflate::new(false,15); typed Status and InflateError; no dictionary supplied", |
| 35 | "Actual StreamEnd consumed-input position defines trailer. Re-read read-ahead without duplicate input charge", |
| 36 | "Trailer little-endian CRC32 then ISIZE modulo 2^32 then exact EOF; reject concatenated members and any trailing bytes including zero" |
| 37 | ], |
| 38 | "limits": { |
| 39 | "input_per_call": 16777216, |
| 40 | "processed_cumulative": 134217728, |
| 41 | "selected_output_cumulative": 16777216, |
| 42 | "metadata_cumulative": 1048576, |
| 43 | "duration_seconds": 300, |
| 44 | "chunk_bytes": 65536, |
| 45 | "caller_limits": "Clamp to hard caps. u64 byte limits allow zero; zero duration invalid. Caller may only lower effective caps.", |
| 46 | "zero": "Input=0 rejects nonempty before parsing; metadata=0 rejects first header attempt; processed=0 rejects first input charge; output=0 still allows unselected decoding and selected empty payload.", |
| 47 | "metadata": "Each attempted header byte is charged, including FHCRC; trailer excluded. Metadata charge can survive truncated input.", |
| 48 | "processed": "Header input + bytes offered to decoder including read-ahead + any fresh trailer bytes + all decoded bytes, selected or not. Input high-water is per call; processed survives retries.", |
| 49 | "failed_output": "Validate total_out delta <=65536 then charge actual delta even on decoder Err. A decoded overrun remains in usage and future checks reject. Input/output/metadata charges that would exceed limits fail before increment.", |
| 50 | "allocation": "Charge selected output before try_reserve_exact and append; failure retains charge. Buffer size <=65536. No total allocator-memory or panic/OOM recovery guarantee." |
| 51 | }, |
| 52 | "precedence": [ |
| 53 | "Start checkpoint (Cancelled/Deadline/Callback(E)) then shared processed/time check then input-length cap", |
| 54 | "Ordinary header check then metadata charge then byte check/EOF/input charge. FHCRC metadata charge precedes byte check as in C#", |
| 55 | "BeforeInflate checkpoint/time check; new offered-input charge before decoder call", |
| 56 | "After decoder: invalid total_out delta => Boundary; valid actual decoded charge overrun => Budget; backend Err => Backend(original InflateError); only successful backend return reaches AfterInflate checkpoint/time check", |
| 57 | "Successful call then consumed-input validation, CRC update, selected-output charge/reserve/copy, AfterOutput checkpoint", |
| 58 | "StreamEnd checks, trailer CRC mismatch => Crc before Size before TrailingData; final decoder drop then BeforeReturn checkpoint/time check", |
| 59 | "Any callback Stop::Callback(E) returned unchanged. No later checkpoints after an error. Returned first error retained through normal decoder drop." |
| 60 | ], |
| 61 | "progress": { |
| 62 | "rule": "Each continued decoder call must consume >0 input or produce >0 output. Refill at exhausted window only, <=65536 bytes. Empty-input drain allowed for pending output. Zero progress without StreamEnd becomes Truncated if input exhausted, otherwise NoProgress.", |
| 63 | "finite": "Input <=16MiB; all output charged against cumulative128MiB (at most one chunk observed overrun). No repeated zero-progress calls and no arbitrary call-count ceiling.", |
| 64 | "limitations": "Typed backend has no IsNeedingInput property; zero-progress classification uses supplied/consumed positions. Exact SharpZipLib malformed-stream consumption and failure-cost identity is not claimed." |
| 65 | }, |
| 66 | "checkpoint": { |
| 67 | "stages": [ |
| 68 | "Start", |
| 69 | "Header", |
| 70 | "BeforeInflate", |
| 71 | "AfterInflate", |
| 72 | "AfterOutput", |
| 73 | "Trailer", |
| 74 | "BeforeReturn" |
| 75 | ], |
| 76 | "ordering": "Callback first, then Instant/processed check. Stop::Cancelled takes precedence over elapsed deadline at that check. Callback failure retains E; injected Stop::Deadline maps Budget.", |
| 77 | "granularity": "Header checked per byte, raw input and output at <=64KiB, after output and after decoder cleanup. Callback time counts; callback/codec cannot be forcibly interrupted.", |
| 78 | "observability": "Checkpoints expose usage, not provisional output. Stage calls are Rust API seams, not a claim of identical C# token poll counts." |
| 79 | }, |
| 80 | "errors": { |
| 81 | "reader": [ |
| 82 | "InvalidRequest", |
| 83 | "Header", |
| 84 | "Truncated", |
| 85 | "Boundary", |
| 86 | "Crc", |
| 87 | "Size", |
| 88 | "TrailingData", |
| 89 | "Budget", |
| 90 | "NoProgress", |
| 91 | "Allocation", |
| 92 | "Cancelled" |
| 93 | ], |
| 94 | "backend": "InflateError re-export, preserved NeedDict { dict_id }, StreamError, DataError, MemError", |
| 95 | "callback": "Original generic E preserved; no message matching, catch/default or blanket unwind handling", |
| 96 | "cleanup": "zlib-rs Drop runs decoder cleanup but does not expose its return status. No external sink Dispose in this API; no claim that cleanup failures, panic or OOM are recovered." |
| 97 | }, |
| 98 | "tests": { |
| 99 | "status": "No regression execution in this implementation task. Separate regression owner to be assigned after fixed source head.", |
| 100 | "preserve": [ |
| 101 | "Normal/header options/FHCRC/CRC/ISIZE/truncation/trailing member rejection", |
| 102 | "Budget exact boundaries/zero limits/failure charging/shared retries/cancellation/deadline/final-result discard" |
| 103 | ], |
| 104 | "adapt": [ |
| 105 | "Partial feed and drain become adapter behavior cases, no arbitrary feed size public argument", |
| 106 | "Sink cancellation becomes checkpoint cancellation; HashSink becomes test hashing of Completed bytes", |
| 107 | "SharpZipLib backend failure becomes original typed zlib-rs error with separately tested counter/precedence behavior" |
| 108 | ], |
| 109 | "not_directly_applicable": [ |
| 110 | "Mutable backing array with owned Box input", |
| 111 | "External sink/Dispose exception and injected inflater counter corruption", |
| 112 | "C# assembly identity, CLI, filesystem/Stream I/O" |
| 113 | ], |
| 114 | "not_claimed": [ |
| 115 | "Existing C# 184+162 test counts or equivalent passes", |
| 116 | "Independent execution, Windows, full-product acceptance, performance or vulnerability-free dependency" |
| 117 | ] |
| 118 | }, |
| 119 | "out_of_scope": [ |
| 120 | "tar.gz/TAR interpretation", |
| 121 | "multiple members", |
| 122 | "disk publishing", |
| 123 | "worker/IPC/UI", |
| 124 | "encryption", |
| 125 | "main merge", |
| 126 | "C# deletion" |
| 127 | ], |
| 128 | "validation": { |
| 129 | "toolchain": "Rust/Cargo 1.99.1", |
| 130 | "build": "cargo +1.99.1 build --lib --locked --offline --manifest-path experiments/rust-memory-gzip-reader/Cargo.toml", |
| 131 | "target_directory": "tests/memory-gzip-build/target", |
| 132 | "build_exit": 0, |
| 133 | "regression_tests_executed": 0, |
| 134 | "format": "cargo +1.99.1 fmt --manifest-path experiments/rust-memory-gzip-reader/Cargo.toml", |
| 135 | "security_advisories": "Not checked in this implementation pass; no current advisory or vulnerability-free claim" |
| 136 | } |
| 137 | } |