| 1 | { |
| 2 | "schema": "zipelo.file-snapshot.candidate.v1", |
| 3 | "base_head": "23b8d1c615f24f42469138fcc63e7fce7cda4f24", |
| 4 | "branch": "features/rust-file-snapshot", |
| 5 | "status": "source-only; not compiled or executed", |
| 6 | "api": { |
| 7 | "capture": "capture<E>(Request { path: &Path, limits: Limits }, FnMut(Checkpoint) -> Result<(), Stop<E>>) -> Result<FileSnapshot, Failure<E>>", |
| 8 | "ownership": "FileSnapshot and Identity fields are private, with no public constructors, Default, deserialization, from-bytes or from-fd hooks. bytes() only borrows; into_bytes consumes the snapshot and returns the original Vec. No worker/publication/atomic-snapshot proof type exists.", |
| 9 | "output": "Owned bytes, SHA256 of those bytes, observed device/inode/length/nlink/mode/mtime/ctime, and per-attempt Usage. No source path retained. Debug for FileSnapshot omits bytes, identity and digest.", |
| 10 | "failure": "Failure preserves Error<E> plus all accumulated Usage and never returns partial payload. Io preserves operation and std::io::Error including raw errno. Callback(E) preserves the original E without conversion.", |
| 11 | "threading": "Synchronous API; no thread, queue, process, join or forced interrupt. E need not implement Send; sending Failure<E> across a thread requires E: Send and spawn-owned captures/results require 'static. No compile-time Send assertions have run." |
| 12 | }, |
| 13 | "scope": { |
| 14 | "platform": "Linux source path uses openat2 and verified procfs. Non-Linux returns Unsupported(Platform) without touching the supplied path. x86_64 Linux is the initial metadata target; no OS runtime support is claimed.", |
| 15 | "input": "Absolute OS-byte path, 2..4096 bytes, nonempty components <=255 bytes, no dot/dotdot/NUL/trailing or repeated slash. UTF-8 is not required. Backslash remains a Linux name byte. This is a host input path policy, not a replacement archive entry name policy.", |
| 16 | "pinning": "openat2 with O_PATH|O_CLOEXEC and RESOLVE_NO_SYMLINKS pins the inode without opening FIFO/device data I/O. fstat must report regular file with exactly one hard link before any data open. FIFO/directory/socket/device and multiple hard links are rejected.", |
| 17 | "reopen": "Open /proc using O_PATH|O_DIRECTORY|O_CLOEXEC and RESOLVE_NO_SYMLINKS, check fstatfs PROC_SUPER_MAGIC, then numeric PID/fd using BENEATH|NO_SYMLINKS|NO_XDEV. openat follows only the held numeric fd link with O_RDONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC. Recheck identity before reading. No supplied source pathname reopen; no normal pathname fallback.", |
| 18 | "trust": "Kernel/procfs, process fd table and process-local ownership are trusted. Does not defend against malicious code in the same process or a privileged actor controlling mounts/ptrace. Descriptor close is RAII, not measured OS cleanup proof. No temporary data file is created.", |
| 19 | "copy": "Read from offset zero into one bounded Vec, accumulating positive short reads. Probe one byte at initial length for EOF after each pass. Compare reread bytes exactly with the retained first pass; compare metadata after copy and after the final callback. SHA256 covers owned bytes only.", |
| 20 | "stability": "This is a two-pass observational copy, not an atomic source snapshot, coherent point-in-time guarantee, exclusion of concurrent writes, full ABA detection, archive integrity validation or pathname persistence guarantee. Rename/replacement can leave the held inode readable; observed metadata/link changes may reject it, but unchanged pathname association is not proved.", |
| 21 | "preservation": "No write/unlink/rename/chmod/launch syscalls. Reading can update source atime. Source contents and existing outputs are never intentionally modified. No app-core/UI integration yet." |
| 22 | }, |
| 23 | "limits": { |
| 24 | "memory_bytes": 16777216, |
| 25 | "scratch_bytes": 65536, |
| 26 | "max_io_reservations": 134217728, |
| 27 | "max_read_calls": 131072, |
| 28 | "max_duration_seconds": 300, |
| 29 | "default_duration_seconds": 30, |
| 30 | "empty": "Empty regular input is supported with two one-byte EOF reservations; max_bytes=0 permits it, max_io_bytes=0 cannot complete those probes. max_read_calls=0 is InvalidLimits.", |
| 31 | "allocation": "try_reserve_exact before Vec resize. Bounds logical payload length, not allocator overhead/capacity rounding, total process RSS, callback allocations or infallible small path allocations. OOM abort is not covered.", |
| 32 | "io": "Before every read_at attempt reserve the full requested buffer length and one read call. No refund on short read, EOF, native error or mismatch. actual_read_bytes records successful returned bytes, compared_bytes records all second-pass bytes including a mismatching chunk. Earlier usage survives failures.", |
| 33 | "formula": "Normal full-chunk success for N bytes reserves 2*N+2 bytes, reads 2*N actual bytes, compares N bytes and takes 2*ceil(N/65536)+2 read calls. Positive short reads may consume more reservations and calls. Fixed acquisition path uses at most 4 open calls and 5 metadata calls, excluding automatic close.", |
| 34 | "attempts": "Limits and time are per capture invocation; no hidden retry. A caller retry creates a new attempt and must aggregate Failure/Success Usage if it needs a job-wide budget. Native archive library Budgets are untouched.", |
| 35 | "time": "Instant elapsed checks at checkpoints and after final metadata; cooperative only. Callback, open/stat/read/hash/allocator calls cannot be forcibly interrupted. No hard syscall timeout or worker isolation claim." |
| 36 | }, |
| 37 | "control": { |
| 38 | "stages": [ |
| 39 | "Opening", |
| 40 | "Pinned", |
| 41 | "Copying", |
| 42 | "Comparing", |
| 43 | "Finalizing" |
| 44 | ], |
| 45 | "checkpoint": "Opening before path validation/syscalls, Pinned after first metadata, Copying before allocation and each read plus EOF probe, Comparing before each read plus EOF probe, Finalizing after digest before final metadata. offset is stage-local; Usage is cumulative.", |
| 46 | "priority": "InvalidLimits first. At a checkpoint callback Cancelled/Callback(E) precedes Deadline. Native operation failures, read reservation failures and observed mismatch return directly before a later callback; errors are never rewritten by a later cancellation. Final metadata failure precedes the post-metadata deadline check.", |
| 47 | "late_cancel": "Finalizing is the final cancellation checkpoint. A request arriving after it can coexist with successful return; caller must not rewrite a returned snapshot. No public hook covers this narrow interval.", |
| 48 | "observers": "Callbacks run synchronously and can block/panic; panic propagates and RAII drops local handles, without synthesizing a completion. No transport policy is implemented. A callback is not allowed to supply bytes/identity as evidence." |
| 49 | }, |
| 50 | "validation": { |
| 51 | "performed": [ |
| 52 | "rustfmt 1.99.1 syntax/format", |
| 53 | "Cargo 1.99.1 offline lock generation", |
| 54 | "locked/offline metadata x86_64-unknown-linux-gnu", |
| 55 | "static API/bounds/manifest review", |
| 56 | "dependency archive checksum and cached source equality" |
| 57 | ], |
| 58 | "not_performed": [ |
| 59 | "Rust compile/type-check", |
| 60 | "unit/integration tests", |
| 61 | "capture syscall invocation", |
| 62 | "synthetic or user file capture", |
| 63 | "Send compilation checks", |
| 64 | "Windows or other OS validation" |
| 65 | ], |
| 66 | "test_owner": "Independent regression source belongs to Kanon under root tests/rust-file-snapshot; none added here.", |
| 67 | "future_cases": [ |
| 68 | "empty and chunk/limit boundaries", |
| 69 | "each path-component symlink and FIFO nonblocking rejection", |
| 70 | "hard link and special-file rejection", |
| 71 | "positive short reads and premature EOF", |
| 72 | "native errno and callback E preservation", |
| 73 | "append/truncate/same-size overwrite at checkpoints", |
| 74 | "path replacement with pinned inode semantics", |
| 75 | "cancel and deadline priority", |
| 76 | "failed attempt usage", |
| 77 | "opaque result and Send compile checks" |
| 78 | ], |
| 79 | "excluded": [ |
| 80 | "publication", |
| 81 | "worker launch", |
| 82 | "execveat retry/bypass", |
| 83 | "new installation or network restore", |
| 84 | "held ZIP/Huffman probes", |
| 85 | "C# edits", |
| 86 | "main merge" |
| 87 | ] |
| 88 | }, |
| 89 | "references": [ |
| 90 | { |
| 91 | "head": "018e7593ecb2b3a7ae0bc17a440ecf2c0de8b4dd", |
| 92 | "path": "src/Zipelo.Core/OutputPathPolicy.cs", |
| 93 | "use": "Host path vs archive name policy distinction" |
| 94 | }, |
| 95 | { |
| 96 | "head": "06e5d6c17318349ea96efef81a9e7d8f54c1e1a1", |
| 97 | "path": "src/Zipelo.Runtime/Streaming/StreamingZipWorkerClient.cs", |
| 98 | "use": "SnapshotAsync two-pass comparison and non-atomic limitation; no C# code copied" |
| 99 | }, |
| 100 | { |
| 101 | "url": "https://man7.org/linux/man-pages/man2/open.2.html", |
| 102 | "use": "O_PATH type inspection, procfs held fd reopening, O_NONBLOCK" |
| 103 | }, |
| 104 | { |
| 105 | "url": "https://man7.org/linux/man-pages/man2/openat2.2.html", |
| 106 | "use": "Kernel path resolution restrictions; no fallback" |
| 107 | } |
| 108 | ] |
| 109 | } |