team-ljyzipelo

공개
443줄53 KB
1{
2 "status": "revision-3-worker-implemented",
3 "version": 1,
4 "scope": "One job per separately spawned Rust worker; shared binary codec. Process separation is not an OS sandbox.",
5 "frame": {
6 "magic": "ZAW1",
7 "header_bytes": 32,
8 "fields_le": [
9 "magic[4]",
10 "version:u16=1",
11 "kind:u16",
12 "body_bytes:u32",
13 "reserved:u32=0",
14 "job_id:u64(nonzero)",
15 "sequence:u64"
16 ],
17 "sequence": "Independent direction counters start0 and increase exactly once; reject duplicates, gaps and wrap.",
18 "max_body_bytes": 1048576,
19 "max_frames_per_job": 1000000,
20 "payload": "Fixed enum tags and LE integers; length-prefix byte/string/vector values with allocation bounds; reject unknown tags and trailing fields."
21 },
22 "paths": {
23 "unix": "tag1 and exact native bytes",
24 "windows": "tag2 and UTF-16LE units",
25 "rules": "Platform encoding must match. Reject NUL and nonabsolute roots; Windows UNC/device paths unsupported. No lossy execution paths.",
26 "archive_names": "Separate validated UTF-8 relative names; entry IDs are opaque ordinal u32, not paths."
27 },
28 "commands": {
29 "Start": "Exactly once: List{archive}, Extract{archive,destination,selection:All|EntryIds{ids:[u32]},list_id:optional<ListId>,gzip_output_name:optional<UTF8>}, CreateZip{sources:[source_path,archive_name],output_file,method:Store|Deflate,encryption:None|Aes256}. App supplies job_id; caller can lower worker hard limits. Extract destination is always an absolute output directory. EntryIds requires list_id; All may supply list_id to bind extraction to a displayed list. CreateSevenZip{sources:[Source{path:NativePath,archive_name:UTF8}],output_file:NativePath,method:SevenZipMethod,solid:bool,encryption:Encryption} appends action tag 4. Shared types, codec and the LZMA2 non-solid writer are implemented. Unsupported solid/encryption options fail after Accepted before file access or questions. RecoverZip{archive:NativePath,output_file:NativePath} appends action tag 5; Start and noninteractive StartGuarded only.",
30 "Password": "Matching outstanding challenge_id:u64 and max1024 UTF-8 bytes; never log, Debug, echo or persist secrets.",
31 "Cancel": "Matching header job_id and empty body; command header sequence identifies the request. See CancelAck. Request acceptance is separate from final outcome. EOF alone is not successful cancellation.",
32 "StartInteractive": "Kind 4, body identical to Start with action restricted to Extract. Exactly one initial Start or StartInteractive. Invalid non-Extract action is rejected by the shared encoder and decoder. Opt in to interactive regular-file conflicts; never retry through legacy Start or an older worker automatically. Worker runtime supports the agreed choices; client activation and native UI integration are verified separately.",
33 "ConflictReply": "Kind 5: challenge_id:u64, choice:ConflictChoice(u8), apply_to_remaining:bool. Match the one outstanding conflict challenge exactly once. Applying to remaining affects only later regular-file conflicts in this job.",
34 "StartGuarded": "Kind 6: GuardedStart{start:Start,ceiling:Limits,interactive:bool}. Start limits keep legacy maxima. ceiling.input must equal start.limits.input; ceiling.output and entries may increase up to 64 GiB and 200000. interactive is valid only for Extract. No resource expansion takes effect before a matching ResourceReply. New workers never emit guarded challenges for Start or StartInteractive; older workers reject kind 6 without fallback.",
35 "ResourceReply": "Kind 7: challenge_id:u64,scope:ResourceScope,allow:bool. Frame job_id and exact outstanding challenge_id/scope must match once. Reject premature, stale, duplicate and cross-kind replies as Protocol. False cancels the job without further processing."
36 },
37 "events": {
38 "Accepted": "Action and capabilities; encryption capability is true for implemented ZipCrypto extraction and WinZip AES-256 extraction/creation. CreateSevenZip explicitly reports encryption=false; existing action capabilities are unchanged. RecoverZip also reports encryption=false.",
39 "Entry": "entry_id, name, kind File|Directory|Link|Other, declared sizes, encrypted; ordinal u32 IDs belong to this List job only until its ListEnd token and Completed Terminal are confirmed. Metadata only, no CRC success claim.",
40 "ListEnd": "entry_count:u32 and list_id:ListId for a complete listing. Entry IDs are deterministic zero-based ordinals in archive traversal order. App associates this token with this job entries only after Completed Terminal, both stream EOFs and successful child wait/exit.",
41 "PasswordRequired": "challenge_id, attempt and purpose Decrypt|Encrypt; no secret diagnostics.",
42 "Progress": "stage Scan|Read|Decode|Write|Verify|Commit, processed_bytes,total_bytes:optional,completed_entries; observational only.",
43 "Output": "entry_id:optional, relative_name, disposition Created|PartialRetained|Removed|CommitUncertain; only this job outputs.",
44 "Terminal": {
45 "outcome": "Completed|Failed|Cancelled",
46 "error": "None|Integrity|UnsupportedFormat|UnsupportedFeature|WrongPassword|UnsafePath|Conflict|Limit|Io|Protocol|Internal|SourceChanged|InvalidRequest|DiskFull|MissingVolume|RecoveryIncomplete|RecoveryImpossible",
47 "publication": "None|Partial|Complete|Uncertain",
48 "created_count": "u64",
49 "retained_partial_count": "u64",
50 "durability": "NotApplicable|Synced|Unconfirmed|Failed",
51 "cleanup": "Complete|Failed|Unconfirmed",
52 "detail": "Bounded local description, not a substitute for typed errors."
53 },
54 "CancelAck": {
55 "request_sequence": "u64: echoed Cancel command header sequence; separate from this event header sequence.",
56 "status": "Requested|AlreadyRequested|TooLate|Finished",
57 "Requested": "Cancellation flag was latched for the first time before the job cancellation cutoff. Cooperative request acceptance; not a guarantee of Cancelled, no outputs or rollback.",
58 "AlreadyRequested": "Cancellation was already latched and the job can still observe it. The flag stays latched; no second request or reset.",
59 "TooLate": "Final job completion/commit decision has been sealed so cancellation can no longer influence the outcome; final outcome may still be Failed or publication Uncertain. Previously created entries alone do not make a multi-entry job TooLate.",
60 "Finished": "Business outcome has already been fixed, but Terminal has not yet been emitted. Does not establish success, EOF, child exit or reaping.",
61 "ordering": "Each well-formed Cancel consumed before Terminal is acknowledged once before Terminal. Terminal is the last worker protocol frame. A Cancel racing with Terminal/exit may remain unread and have no acknowledgement; app uses Terminal plus EOF and wait, never synthesizes a worker acknowledgement or successful cancellation."
62 },
63 "ConflictRequired": "Kind 108: challenge_id:u64, entry_id:u32, relative_name:UTF8, incoming_size:u64, existing_size:u64. One ordinary-file conflict at a time, after complete archive integrity validation. All three choices are permitted; links and file/directory type conflicts remain rejected.",
64 "ConflictResolved": "Kind 109: entry_id:u32, relative_name:UTF8, choice:ConflictChoice(u8). Emit for every resolved conflict, including automatically applied choices. This records the action and resolved name, not successful publication; successful overwrite or rename also requires Output Created. Skip emits no Output Created.",
65 "ResourceRequired": "Kind 110: challenge_id:u64,action:ActionKind,scope:ResourceScope,usage:ResourceUsage,soft_limits:Limits,ceiling:Limits. ResourceScope is output:bool,entries:bool,ratio:bool. ResourceUsage fields in order are estimated_bytes:Option<u64>,actual_bytes:Option<u64>,estimated_entries:Option<u32>,actual_entries:Option<u32>,compressed_bytes:Option<u64>,ratio_output_bytes:Option<u64>,available_bytes:Option<u64>. None is unknown, not zero.",
66 "RecoveryEntry": {
67 "fields_in_order": [
68 "candidate_id:u32",
69 "source_offset:u64",
70 "name:Option<UTF8>",
71 "kind:Option<EntryKind>",
72 "status:RecoveryStatus",
73 "reason:RecoveryReason",
74 "declared_size:Option<u64>",
75 "verified_size:Option<u64>",
76 "sha256:Option<[u8;32]>"
77 ],
78 "constraints": "One stable zero-based ordinal per known candidate, ordered by source local offset, with no duplicates. IDs are not List EntryIds. Name is absent rather than invented if unknown; strings/frame budgets remain unchanged. Only Some(File), Some(Directory) or unknown None; Verified requires a known kind. Never invent a type for an unknown candidate. Verified file has exact sizes and SHA256, directory has size zero and no hash. Lost/Unverified have no verified_size or hash. Unknown enum/field combinations are Protocol. Findings before final result are not saved outputs. Verified requires a known name and equal declared/verified sizes; verified directories have both sizes zero and no hash. Validate the explicit status/reason matrix. Source offsets strictly increase and must fall within source_bytes at summary validation; sums use checked arithmetic.",
79 "valid_reasons": {
80 "Verified": [
81 "None",
82 "HeaderRebuilt",
83 "MetadataMissing"
84 ],
85 "Lost": [
86 "Truncated",
87 "CrcMismatch",
88 "DecodeFailure"
89 ],
90 "Unverified": [
91 "BoundaryUnknown",
92 "UnsupportedFeature",
93 "MetadataMissing"
94 ]
95 }
96 },
97 "RecoveryEnd": {
98 "fields_in_order": [
99 "mode:RecoveryMode",
100 "source_bytes:u64",
101 "source_sha256:[u8;32]",
102 "known_entries:Option<u32>",
103 "verified_entries:u32",
104 "lost_entries:u32",
105 "unverified_entries:u32",
106 "unknown_loss:bool"
107 ],
108 "constraints": "At most one summary after completed analysis and before publication. Counts equal emitted findings. Only a central inventory with one-to-one contiguous complete local coverage has known_entries equal to the count sum and unknown_loss=false. Missing inventory, gaps or ambiguous spans give known_entries=None and unknown_loss=true, including in CentralDirectory mode. LocalChain always has None/true. Unknown bytes never create a fabricated candidate or zero loss claim. No ListEnd/ListId or ordinary Entry/preview frames for recovery. A summary alone is not success or proof that a file exists."
109 }
110 },
111 "lifecycle": [
112 "Exactly one Start or StartInteractive; no automatic retry or fallback. Password/Cancel remain readable during work. ConflictReply is accepted only for a matching outstanding interactive conflict.",
113 "Parent drains both streams concurrently. Stdout is protocol only; stderr is bounded diagnostics without secrets.",
114 "Exactly one Terminal ends business results and is the final worker protocol frame; CancelAck can precede but never follow it. Worker exits0 after delivered terminal, including Failed/Cancelled. Malformed protocol or crash can exit nonzero without terminal.",
115 "App requires matching terminal, stdout/stderr EOF and owned child wait/exit before replacement/close. EOF/exit0 alone is not success.",
116 "Lost/killed worker preserves observed outputs; unobserved commit/cleanup stays uncertain, never synthetic Cancelled/rollback/absent output.",
117 "Cancellation retains completed outputs; cleanup removes only owned temporary files and reports any retained partial.",
118 "Completed is not OS sandboxing or release evidence. No security-setting changes."
119 ],
120 "safe_output": [
121 "Reject absolute/dotdot/drive/UNC/device/reserved/alternate-stream names and case/path collisions before writes.",
122 "Reject archive links/special entries on extraction. Do not follow output parent symlinks/reparse points.",
123 "Legacy Start creates output files exclusively and never truncates or writes pre-existing files. StartInteractive may replace an existing ordinary file only after the agreed choice and complete temporary output validation. GZip FNAME does not choose destination.",
124 "CRC/size/stream-end validation precedes committed output events; preserve commit/durability/cleanup distinctions."
125 ],
126 "pending": [
127 "Windows native runtime, forced interruption of blocked OS I/O and a current full dependency advisory audit are not verified."
128 ],
129 "crypto": {
130 "rustcrypto_allowed": true,
131 "approval_message_id": "2966b0ad-a3e0-49b8-aef8-fb51c4e1c5a5",
132 "implementation_verified": false,
133 "policy": "Human approved pure Rust RustCrypto under MIT/Apache. No home-grown AES or password KDF; approval alone does not enable encryption capability."
134 },
135 "revision": 3,
136 "coordination": {
137 "frontend_message_id": "41a0e5a5-27d0-437f-805d-d39313082096",
138 "basis": "Revision 2 list identity, explicit raw GZip output naming and cancellation acknowledgement are implemented. Field order and tags remain unchanged.",
139 "streaming_frontend_message_id": "59142fd4-22d3-4dc5-a875-5347e1b054da",
140 "disk_full_frontend_message_id": "3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1",
141 "conflict_frontend_message_ids": [
142 "37815dda-3271-4f83-be4d-8da1a6e0c2ab",
143 "87ff39f9-f7fe-4efc-bd2e-d73ab3246356"
144 ],
145 "conflict_backend_message_id": "64e29128-e8a2-45e5-8577-db84a66feaa9",
146 "revision_3_status": "Joint agreement complete. Types, codec and interactive worker runtime implemented; frontend activation and native UI integration remain separate."
147 },
148 "list_identity": {
149 "ListId": {
150 "catalog_version": "u16=1; reject unsupported versions without remapping entry IDs.",
151 "format": "ZIP|TAR|GZIP|TAR_GZIP; detected parser mode, not the filename extension.",
152 "source_object": "Tagged native identity from the opened source handle: Unix{device:u64,inode:u64} or Windows{volume_serial:u64,file_id:[u8;16]}. Platform must match; unavailable reliable identity returns UnsupportedFeature.",
153 "archive_bytes": "u64: exact complete compressed/source byte length, bounded by worker limits.",
154 "archive_sha256": "[u8;32]: SHA-256 of every source byte, using the permitted RustCrypto implementation; not CRC or path/size/mtime alone."
155 },
156 "capture": [
157 "Open the regular source file once and keep its handle. Copy through bounded reads into a private job-owned snapshot while computing full SHA-256. Check source handle identity, length and modification metadata before/after capture; detected mutation rejects the capture. Check the named source still resolves to the same object at the validation boundary.",
158 "The completed private snapshot is the sole input to parsing and decoding for this job; never hash one file and later reopen the path to decode. Snapshot storage is bounded, exclusively owned and not writable through attacker-selected names. Failure to establish a stable private snapshot fails before creating destination outputs.",
159 "List builds the deterministic catalog from that snapshot and returns its ListId only with successful ListEnd. A failed/cancelled/truncated listing provides no reusable selection token."
160 ],
161 "extract_validation": [
162 "Treat every supplied ListId and entry ID as untrusted. EntryIds without ListId, empty/duplicate IDs or IDs outside the recomputed catalog fail InvalidRequest before destination output creation.",
163 "Capture the Extract source into a new private snapshot, recompute identity/length/SHA-256/format/catalog version and compare every ListId field before creating any destination output. A mismatch returns Terminal Failed/SourceChanged with publication None and zero created/retained outputs. The app invalidates the displayed selection and asks the user to reopen/list; no automatic extraction retry or ordinal remapping.",
164 "When All supplies ListId, apply the same comparison. All without ListId means extract the current captured archive without claiming it matches any earlier listing.",
165 "EntryIds refer to the recomputed catalog ordinals, never names supplied by the app; extract the selected members in archive traversal order. Link/special-entry and output path guards remain mandatory after identity validation."
166 ],
167 "boundary": "This binds extraction to verified snapshot bytes and observed native identity at capture/validation time. It is not authorization, a signed token, an exclusive filesystem lock or a promise to detect every external edit after capture or a byte-identical change-and-restore. Later source changes cannot change the bytes decoded from the private snapshot."
168 },
169 "gzip_output": {
170 "destination": "Always the output directory, never a full output filename.",
171 "gzip_output_name": "Required Some(nonempty validated UTF-8 single leaf filename) for raw GZIP extraction, for both All and EntryIds. Reject absolute/drive/UNC/device/alternate-stream/reserved names, separators, dot/dotdot and invalid leaf names before creating outputs. Missing/invalid value returns InvalidRequest; no implicit basename or FNAME fallback.",
172 "other_formats": "Must be None for ZIP, TAR and TAR_GZIP; reject Some as InvalidRequest rather than silently ignoring it. TAR_GZIP uses validated inner TAR member names.",
173 "gzip_catalog": "Raw GZIP is one logical stream entry with entry_id0. Its listed display name is not an output path; entry selection still requires ListId.",
174 "publication": "Resolve the supplied leaf under destination using the same no-follow guards. Existing destination files return Conflict for legacy Start. StartInteractive follows the regular-file conflict policy; never automatically downgrade or retry through legacy Start."
175 },
176 "design_references": [
177 {
178 "url": "https://docs.rs/sha2/latest/sha2/",
179 "purpose": "RustCrypto SHA-256 implementation documentation; dependency version and advisories still require selection-time verification."
180 },
181 {
182 "url": "https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_info",
183 "purpose": "Native Windows opened-file identity fields."
184 },
185 {
186 "url": "https://man7.org/linux/man-pages/man2/stat.2.html",
187 "purpose": "Source metadata from the open file descriptor rather than a later path reopen."
188 }
189 ],
190 "format_tags": {
191 "Zip": 0,
192 "Tar": 1,
193 "Gzip": 2,
194 "TarGzip": 3,
195 "SevenZip": 4
196 },
197 "seven_zip_extension": {
198 "agreement_message_id": "5a36fd89-af36-42be-9f79-bca39415e84d",
199 "compatibility": "Existing format values 0 through 3, fields, message tags and frame version stay unchanged. Older clients reject format 4. App Format and bidirectional conversion require an update.",
200 "regression": "Preserve existing format bytes and round-trip SevenZip in ListEnd/ListId."
201 },
202 "streaming_limits": {
203 "agreement": "Revision 2 fields and frame encoding unchanged. Ratio-rejection removal and advisory disk-space checks follow manager decision d6bc0d37-89d1-4cd2-a00b-883b5eb23ec0. DiskFull tag 13 and preserving Io tag 8 for query/access failures were agreed with frontend in message 3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1. The 7z/CreateZip streaming extension follows manager task c4acbf18-0845-49a2-ae10-a92e7934042d; this extension was agreed with frontend in message 81b585cb-84be-494d-a953-1c8220300176 (PR 78 review 5864130366). Existing numeric quotas, frame fields and error tags remain unchanged.",
204 "default_input_bytes": 18446744073709551615,
205 "default_output_bytes": 17179869184,
206 "default_entries": 10000,
207 "lower_limits": "Callers can lower the input, output and entry quotas. input=u64::MAX means no input-size quota; resource and duration checks still apply.",
208 "zip_ratio": "No compression-ratio rejection. Validate declared and actual output sizes, stream end, CRC and HMAC; sum of declared output sizes must fit output quota before decoding.",
209 "gzip_ratio": "No compression-ratio rejection, including concatenated members. Aggregate decoded bytes, including TAR headers/padding, cannot exceed output quota.",
210 "tar_ratio": "Plain TAR copies declared nonoverlapping ranges within the captured input. The sum of file sizes cannot exceed output quota.",
211 "arithmetic": "Checked u64 offsets and totals; free-space block-to-byte conversion uses u128 to avoid multiplication overflow.",
212 "memory_target": "ZIP/TAR/GZ/TAR.GZ/7z List/Extract and ZIP creation: worker process peak RSS <=64 MiB in Linux regression with independently generated 1 GiB payloads. This is a measured target, not an OS-enforced RSS cap. The 64 MiB RSS regression target uses the default 8 MiB metadata policy; approved expanded metadata jobs may use more RSS.",
213 "staging": "64 KiB buffers; immutable input capture and verified decoded content use private temporary files that are removed on last-handle close. No decoded content is published until the entire catalog and integrity checks succeed. Temporary disk usage can include the archive plus expanded content plus current destination temporary file; disk exhaustion fails with DiskFull and closes/removes unpublished data.",
214 "legacy": "The slice parser keeps 64 MiB input /128 MiB output caps; the slice ZIP builder keeps 128 MiB source/result caps. Runtime 7z and ZIP creation use streaming file paths.",
215 "parent_lifetime": "Capture native parent before reading Start. At decode/read/write/password checkpoints, fail Io if parent is gone; close anonymous staging and remove current unpublished destination temp. stdin EOF alone remains valid for one-shot requests. Already published entries and directories are reported and retained. A blocked OS file operation cannot be forcibly interrupted by this cooperative guard.",
216 "disk_space": "Advisory free-space checks use opened Linux x86_64 filesystem handles (fstatvfs) or the Windows handle-derived directory (GetDiskFreeSpaceExW). Legacy Start groups remaining staging and selected output logical bytes by volume before ZIP/7z decoding and before publication. StartInteractive checks required staging before choices, then checks only the current non-skipped output at its resolved name immediately before publication; do not charge undecided or skipped files to the destination. For GZip with unknown expanded size, check staging space before each decoded chunk, then preflight selected output. Input capture also checks its snapshot space. Insufficient space returns DiskFull tag 13. Query failure and other I/O errors retain Io tag 8. Checks do not reserve space or account for every metadata/block-allocation overhead; later ENOSPC still closes staging and removes current unpublished output.",
217 "remaining_risk": "High compression ratios within 16 GiB may expand fully onto disk. Resource duration, cooperative cancellation and measured memory target remain. Free-space checks can race with other disk users; already published outputs are retained on failure.",
218 "seven_zip": "Copy, LZMA and LZMA2 use file-backed solid output with checked declared/actual output totals. Encoded headers are limited to the active metadata policy: 8 MiB before a valid resource grant, 64 MiB after it. Dictionary size remains at most 64 MiB; only the last 8 MiB is cached in memory and older dictionary bytes are read from the temporary output.",
219 "create_zip": "The sum of source logical bytes cannot exceed min(input,output) quotas. output defaults to 16 GiB of uncompressed source content; ZIP container/encryption overhead may exceed that logical content quota. Capture one immutable source at a time, stream Store/Deflate and optional AES-256 through 64 KiB buffers, then publish the completed ZIP without replacing existing files. Emit ZIP64 sizes/offsets only when their 32-bit fields would overflow or equal the sentinel. Check staging and destination free space; StorageFull maps to DiskFull tag 13 and other I/O failures retain Io tag 8."
220 },
221 "validation": "Implementation results belong in the PR verification record. No OS sandbox or native Windows execution claim.",
222 "error_tags": {
223 "None": 0,
224 "Integrity": 1,
225 "UnsupportedFormat": 2,
226 "UnsupportedFeature": 3,
227 "WrongPassword": 4,
228 "UnsafePath": 5,
229 "Conflict": 6,
230 "Limit": 7,
231 "Io": 8,
232 "Protocol": 9,
233 "Internal": 10,
234 "SourceChanged": 11,
235 "InvalidRequest": 12,
236 "DiskFull": 13,
237 "MissingVolume": 14,
238 "RecoveryIncomplete": 15,
239 "RecoveryImpossible": 16
240 },
241 "disk_full_extension": {
242 "agreement_message_id": "3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1",
243 "compatibility": "Existing error tags 0 through 12, fields, message tags, revision 2 and frame version stay unchanged. Older clients reject error 13; app error mapping and worker must be updated together before integration.",
244 "mapping": "Insufficient preflight space and StorageFull I/O failures return DiskFull 13. Windows ERROR_HANDLE_DISK_FULL 39 and ERROR_DISK_FULL 112 also map to DiskFull. Query failure, permission errors and other I/O failures return Io 8. No error classification by localized detail text.",
245 "detail": "디스크 여유 공간이 부족합니다. 공간을 확보한 뒤 다시 시도하세요",
246 "publication": "Keep existing publication, durability and cleanup semantics. DiskFull does not imply rollback or absence of previously published outputs."
247 },
248 "create_zip_sources": {
249 "agreement": "Proposed semantic extension under manager task 82093f56-73b7-4be4-ba6d-2597ffc2c6f7; frontend joint agreement is pending. Revision 2 fields, encoding, numeric quotas and error tags are unchanged.",
250 "roots": "Each source may be a regular file or directory. archive_name names that root inside the ZIP; directory descendants retain relative paths and every directory, including empty directories, gets a trailing-slash ZIP entry.",
251 "links": "Reject the whole job with UnsafePath for symbolic links, Windows reparse points, special files or unsafe/non-UTF-8 descendant names. Do not skip entries or follow external links. Open each path component without following links; enumerate pinned directories.",
252 "limits": "All expanded file and directory entries count toward entries (default 10000). Only file logical bytes count toward min(input,output), default output 16 GiB. Keep 64-component names and the active metadata budget. Legacy/unapproved plans retain 8 MiB and 32768 nodes; resource-approved plans use 64 MiB and 262144 nodes. In approved source plans, path and pending-name copies consume bytes but share their entry node. Validate the complete plan and case-insensitive/path-prefix conflicts before requesting a password.",
253 "consistency": "Capture each file from its validated open handle. Compare planned object identity, kind, size and modification time before capture and check planned objects again before publishing the completed ZIP; detected changes fail SourceChanged. This is not an atomic snapshot of an entire directory tree.",
254 "encryption": "AES-256 protects file contents using the existing AE-2 encoding. Directory entries are stored as zero-byte unencrypted directory records; entry names remain visible, as with other ZIP entries."
255 },
256 "conflict_choice_tags": {
257 "Overwrite": 0,
258 "Skip": 1,
259 "Rename": 2
260 },
261 "extract_conflicts": {
262 "status": "worker-implemented",
263 "compatibility": "Preserve frame version 1, every existing message kind, field order and enum tag. Add StartInteractive=4, ConflictReply=5, ConflictRequired=108 and ConflictResolved=109. Older workers reject kind 4 before output. Do not automatically retry, overwrite or fall back.",
264 "legacy": "Start keeps its existing abort-on-conflict behavior. List and CreateZip never accept interactive conflict mode. Existing limits, source identity, integrity checks and path guards remain mandatory.",
265 "scope": "Only ordinary-file/ordinary-file collisions. Merge existing directories as before; reject file/directory type collisions, symbolic links, reparse points and other special entries. Complete integrity validation of the entire catalog precedes conflict questions and destination publication.",
266 "rename": "Worker selects an unused numbered sibling in the same directory under the validated output root. The app never supplies an arbitrary replacement path. Revalidate the chosen destination before publication. Avoid all selected archive output paths and prior generated names. Preserve UTF-8 boundaries when shortening a leaf to 255 bytes; try at most 10000 numbered candidates.",
267 "wait": "At most one outstanding conflict or password challenge. Reject premature, stale or duplicate replies with Protocol. Cancel remains readable during a conflict wait. EOF without a reply fails Protocol; the existing 300-second job duration includes waits.",
268 "apply_to_remaining": "Keep the chosen policy only for the remaining ordinary-file conflicts in this job. Emit ConflictResolved for every such entry even without another question. Never carry the policy to another job or a file/directory or link collision.",
269 "events": "ConflictResolved reports an action and resolved relative name, not storage success. For overwrite and rename, Output Created separately confirms publication; skip has no Created output. On later errors preserve publication, durability and cleanup distinctions.",
270 "overwrite": "Write, verify, sync and close a new owned temporary file in the destination directory before replacing the existing ordinary file. A pre-replacement failure preserves the original. After replacement, report actual publication and durability; do not claim whole-job rollback.",
271 "counts": "created_count includes published replacement files and newly created files/directories; excludes skipped files. If all files are skipped and no new directory or other output is created, finish Completed/None with created_count=0 and Durability NotApplicable. Newly created directories retain their Output events and actual counts even if all files are skipped.",
272 "implementation_boundary": "Worker supports StartInteractive extraction. Frontend activation and native Windows/Wayland integration require separate verification. Existing Start remains exclusive and aborts on file conflicts.",
273 "target_revalidation": "Before replacement compare parent and file native identities, size and modification time with the question-time observation. Detected changes fail Conflict. This is not atomic compare-and-replace against concurrent writes by the same account.",
274 "disk_space": "Required input capture and complete integrity staging checks remain before conflict questions. Defer destination space checks until the current choice is resolved. Skip has no destination byte charge; overwrite, rename and non-conflicting files are checked immediately before their publication. Preserve legacy Start aggregate preflight, limits, per-write checks and partial-output reporting."
275 },
276 "guarded_resources": {
277 "status": "worker-and-client-implemented; native Windows/Wayland verification pending",
278 "agreement": "Frontend flow agreement 6fe5a494-7d5a-4bda-a7d3-831fb43e9238 and manager policy b3a743d2-10de-495c-8fdb-ecf2a5f3b453. Frame version 1, revision 3 messages and enum tags remain unchanged; this is an explicit opt-in extension.",
279 "admission": "After Accepted, request the output and/or entries scopes that ceiling increases above Start limits before capturing input or planning sources. Usage estimates and actuals are unknown at this point; report current staging-volume free space. The caller must show the requested ceilings and unknown values, not invent estimates. An earlier confirmation is needed because input capture itself can exceed 300 seconds. Each granted scope is confined to this job.",
280 "ratio": "Request ratio scope separately when expanded bytes are at least 256 MiB and strictly exceed compressed bytes times 1000. Check ZIP members and aggregate payload totals, 7z solid folders and totals, and complete compressed TAR/GZip streams. Use u128 arithmetic; unknown compressed length does not become zero. No ratio warning for legacy requests.",
281 "accounting": "Monitor declared catalog sums and counts, real decoded bytes, per-stream ratios and source-plan sums. Decoders must match verified declared lengths before publication. For compressed TAR/GZip the expanded stream includes headers/padding. ZIP creation ceiling counts source logical bytes; ZIP/container/encryption overhead is separately space-checked.",
282 "disk": "Continue staging/destination volume preflight and per-chunk space checks after approval. available_bytes is advisory free space on the current observation storage volume, not a reservation or all-volume total. Unknown storage is None. Preserve DiskFull, partial publication, durability and cleanup semantics.",
283 "waiting": "One resource, password or conflict challenge at a time. Pause processing while waiting; control reader remains live for Cancel. Response EOF fails Protocol. Guarded challenge wait is limited to 300 seconds per question; reset the inactivity clock after a valid reply, excluding the human wait.",
284 "time": "Legacy and unapproved jobs retain their whole-job 300-second deadline. After the first resource grant, use a 60-second inactivity deadline measured only from actual read/decode/write/metadata progress, not repeated cancellation checks or outgoing heartbeats. Cooperative checkpoints cannot forcibly interrupt a blocked OS call.",
285 "hard_ceiling": "Output/source bytes <=64 GiB and entries<=200000, including after approval. Caller may lower both ceilings for normal operation or scaled tests. Input quota cannot be expanded. Existing path, metadata, dictionary, frame and source-identity limits remain independent.",
286 "metadata": "Only after a valid ResourceReply(allow=true) for this job, select 64 MiB MetadataBudget and 262144 nodes, including ZIP/TAR/7z parsing, decoded 7z headers, XZ index/block bounds, member/path validation, implicit output parents and source planning. Legacy Start/StartInteractive, unapproved guarded jobs and slice APIs keep 8 MiB and 32768 nodes. Merely requesting expanded ceilings does not grant a larger budget. Names and source paths still consume checked byte budgets and implicit parents consume nodes, so long/deep paths can hit the metadata cap before 200000 entries. Approved source-path/pending-name copies consume bytes without duplicating their entry node. Expanded metadata jobs do not retain a universal 64 MiB RSS target.",
287 "client": "Normal app jobs use StartGuarded with the existing 16 GiB and 10000-entry limits. Known selection/file estimates request expanded ceilings before processing. After a Limit result, offer an explicit expanded retry only after Terminal, both EOFs and child reap, with Publication::None, zero created/partial counts and complete cleanup. Retry uses a new job ID and requires fresh approval; existing or uncertain output instead shows the saved location and detailed result. App output records, including implicit parent directories, grow to 262144 nodes after any valid resource approval. Catalog entries grow to 200000 only for jobs granted the entries scope. Unapproved output records and catalogs without an entries grant retain their existing 100000 caps. Resource approval, ratio, retry and partial-output UI scenarios, tests and docs/ui-scenario-guide.md are implemented. Native Windows/Wayland verification remains separate.",
288 "tests": "Use numeric 16/64 GiB and 10000/200000 policy boundaries, scaled worker limits, a compressed 257 MiB zero stream, and a virtual clock for the 60-second stall. Include client approval/retry tests in tests/rust-app-ui/guarded.rs and real-worker flows in tests/rust-app-real-worker/guarded_flows.rs. Do not write 64 GiB in tests."
289 },
290 "action_tags": {
291 "List": 0,
292 "Extract": 1,
293 "CreateZip": 2,
294 "Preview": 3,
295 "CreateSevenZip": 4,
296 "RecoverZip": 5
297 },
298 "seven_zip_method_tags": {
299 "Lzma2": 0
300 },
301 "seven_zip_create": {
302 "status": "worker-implemented; frontend-integrated; real-file-native-integration-and-independent-review-pending",
303 "agreement": {
304 "frontend_message_id": "770f1004-0a2b-4fc6-aafd-7f705c8f6c9e",
305 "frontend_review": "https://github.com/Team-LJY/zipelo/pull/127#pullrequestreview-5903269732",
306 "design_review": "https://github.com/Team-LJY/zipelo/pull/127#pullrequestreview-5903282961"
307 },
308 "request": "Append Action::CreateSevenZip and ActionKind::CreateSevenZip=4. Field order: sources:Vec<Source>,output_file:NativePath,method:SevenZipMethod(u8 Lzma2=0),solid:bool,encryption:Encryption(u8 None=0,Aes256=1). Source remains path:NativePath,archive_name:UTF8. Preserve ZIP Method Store=0,Deflate=1, all previous tags, frame version and fields.",
309 "admission": "Start and StartGuarded(interactive=false) are valid. Shared encoder and decoder reject StartInteractive and guarded interactive=true. Sources, native path vectors and strings retain the 32768 item/UTF8-byte bounds and the 1 MiB frame bound even with an expanded ceiling. No automatic fallback to ZIP, Start or an older worker.",
310 "options": "Target support is single-file .7z with LZMA2, non-solid and no body/header encryption. Structurally valid solid=true or Aes256 requests must fail UnsupportedFeature after Accepted, before source enumeration, resource/password/conflict questions or outputs. Unknown enum/bool tags and trailing fields are protocol errors.",
311 "implementation_boundary": "LZMA2 non-solid creation is implemented. Shared source planning, 64 KiB snapshots and writes, private staging, checked header metadata and exclusive publication are used. Unsupported solid/encryption options fail before admission and file access. Native UI real-file integration and independent review remain separate.",
312 "events": "Accepted.action and future ResourceRequired.action use tag 4; Accepted.encryption=false. Future writer reuses Progress Scan/Read/Write/Verify/Commit and guarded resource approval. Unknown totals remain None. No PasswordRequired or ConflictRequired. Exactly one normal Output Created for the published archive, entry_id=None and relative_name=actual destination leaf; not one Output per archive member.",
313 "publication": "Future writer uses ZIP source planning, consistency checks, private file-backed staging and exclusive publication (replace=None). Existing or newly appeared destination returns Conflict without overwrite. Completed requires publication Complete and created_count=1. Prepublication failure/cancel has publication None and zero created/retained counts unless owned temporary cleanup actually failed. Preserve actual postpublication errors, durability, cleanup and uncertain state.",
314 "lifecycle": "Reuse Cancel/CancelAck/Terminal and matching job/challenge/sequence validation. CancelAck is not completion; app requires Terminal, both stream EOFs and owned child wait. No synthetic rollback after publication.",
315 "dependencies": "Existing lzma-rust2 =0.25.0 enables std,xz,encoder with default features disabled. No new lockfile package; encoder=[] adds no transitive dependency. Apache-2.0 originals and hashes are checked through packaging/licenses.py. OSV query on 2026-11-14 returned no advisory for this package/version; this is not a full dependency audit or a vulnerability-free claim.",
316 "design": "docs/sevenzip-create-design.md",
317 "validation": "Round-trip SHA256 and structure in Zipelo and independent 7-Zip 26.00 with ZIPELO_TEST_7ZIP set; 1 GiB creation RSS regression; cancellation, metadata/byte limits, encoder finish/header write/seek/patch failures, destination write/sync and postpublication sync failures. Results and platform limits are recorded in PR127."
318 },
319 "zip_recovery_proposal": {
320 "status": "jointly-agreed; shared-types-codec-and-worker-implemented; frontend-integration-and-independent-implementation-review-pending",
321 "design": "docs/zip-recovery-design.md",
322 "basis": "PLANS 8.10. Joint result/warning and corrected tag agreement complete. RecoverZip=5, RecoveryEntry/End=115/116 and errors 15/16 are active; preserve MissingVolume=14 and all other existing tags, frame version 1 and revision 3.",
323 "request": {
324 "action": "RecoverZip",
325 "proposed_action_tag": 5,
326 "fields_in_order": [
327 "archive:NativePath",
328 "output_file:NativePath"
329 ],
330 "admission": "Start or StartGuarded(interactive=false). Reject StartInteractive or interactive=true in both codec directions. Accepted.encryption=false. Reuse existing resource questions; no password/conflict question and no automatic fallback."
331 },
332 "input_scope": "Initial input support: single-volume non-SFX ZIP32, unencrypted Store or Deflate. ZIP64 input, split/SFX, central encryption, unsupported compression and encrypted-only archives are outside initial repair scope. Existing ordinary list/extract support is unchanged. A clearly identified archive-wide unsupported feature fails UnsupportedFeature without downgrade.",
333 "discovery": {
334 "CentralDirectory": "Use only a fully bounded EOCD/central inventory with exact counts, structural/name validation and nonoverlapping member spans. Repair local signature, CRC or size fields only if the central inventory and intact local name/extra lengths, flags/method/name determine one payload range. Data descriptors require this inventory and exact supported descriptor validation. A complete original inventory additionally requires one-to-one, contiguous local spans from offset zero to the central-directory start. Unaccounted gaps or ambiguous spans force unknown_loss=true and known_entries=None even when the known central entries verify.",
335 "LocalChain": "If there is no usable central inventory, walk complete local records consecutively from offset zero using known ZIP32 lengths and bit3=false. Skip a corrupt payload only when its complete range is known. Stop at a truncated/ambiguous header or unknown descriptor boundary. Never scan payload bytes for a new PK signature or guess names/sizes. Inventory completeness is unknown even when every observed member verifies. Emit a finding only for a structurally established candidate; unrecognized tail bytes create no synthetic entry or count and remain unknown_loss."
336 },
337 "verification": "Only export supported regular-file or empty-directory candidates with stable safe names and exact bounded lengths. Deflate must reach its real stream end and consume exactly its compressed range; decoded length and CRC32 must match independent header evidence. Compute SHA256 of verified file bytes for result/fixture comparison; a new hash or recomputed CRC cannot make corrupt data valid. CRC evidence is not cryptographic authenticity. Never export raw or partial corrupt bytes.",
338 "proposed_tags": {
339 "RecoveryMode": {
340 "CentralDirectory": 0,
341 "LocalChain": 1
342 },
343 "RecoveryStatus": {
344 "Verified": 0,
345 "Lost": 1,
346 "Unverified": 2
347 },
348 "RecoveryReason": {
349 "None": 0,
350 "HeaderRebuilt": 1,
351 "Truncated": 2,
352 "CrcMismatch": 3,
353 "DecodeFailure": 4,
354 "BoundaryUnknown": 5,
355 "UnsupportedFeature": 6,
356 "MetadataMissing": 7
357 },
358 "ErrorCode": {
359 "RecoveryIncomplete": 15,
360 "RecoveryImpossible": 16
361 },
362 "event_kinds": {
363 "RecoveryEntry": 115,
364 "RecoveryEnd": 116
365 }
366 },
367 "RecoveryEntry": {
368 "fields_in_order": [
369 "candidate_id:u32",
370 "source_offset:u64",
371 "name:Option<UTF8>",
372 "kind:Option<EntryKind>",
373 "status:RecoveryStatus",
374 "reason:RecoveryReason",
375 "declared_size:Option<u64>",
376 "verified_size:Option<u64>",
377 "sha256:Option<[u8;32]>"
378 ],
379 "constraints": "One stable zero-based ordinal per known candidate, ordered by source local offset, with no duplicates. IDs are not List EntryIds. Name is absent rather than invented if unknown; strings/frame budgets remain unchanged. Only Some(File), Some(Directory) or unknown None; Verified requires a known kind. Never invent a type for an unknown candidate. Verified file has exact sizes and SHA256, directory has size zero and no hash. Lost/Unverified have no verified_size or hash. Unknown enum/field combinations are Protocol. Findings before final result are not saved outputs. Verified requires a known name and equal declared/verified sizes; verified directories have both sizes zero and no hash. Validate the explicit status/reason matrix. Source offsets strictly increase and must fall within source_bytes at summary validation; sums use checked arithmetic.",
380 "valid_reasons": {
381 "Verified": [
382 "None",
383 "HeaderRebuilt",
384 "MetadataMissing"
385 ],
386 "Lost": [
387 "Truncated",
388 "CrcMismatch",
389 "DecodeFailure"
390 ],
391 "Unverified": [
392 "BoundaryUnknown",
393 "UnsupportedFeature",
394 "MetadataMissing"
395 ]
396 }
397 },
398 "RecoveryEnd": {
399 "fields_in_order": [
400 "mode:RecoveryMode",
401 "source_bytes:u64",
402 "source_sha256:[u8;32]",
403 "known_entries:Option<u32>",
404 "verified_entries:u32",
405 "lost_entries:u32",
406 "unverified_entries:u32",
407 "unknown_loss:bool"
408 ],
409 "constraints": "At most one summary after completed analysis and before publication. Counts equal emitted findings. Only a central inventory with one-to-one contiguous complete local coverage has known_entries equal to the count sum and unknown_loss=false. Missing inventory, gaps or ambiguous spans give known_entries=None and unknown_loss=true, including in CentralDirectory mode. LocalChain always has None/true. Unknown bytes never create a fabricated candidate or zero loss claim. No ListEnd/ListId or ordinary Entry/preview frames for recovery. A summary alone is not success or proof that a file exists."
410 },
411 "output": "Build one new nonencrypted ZIP using Store and the existing safe ZIP/ZIP64 writer, safe normalized relative names, verified file bytes and explicit regular/directory attributes. Do not copy comments, unknown extra fields, symlink/permission attributes or signatures. ZIP64 output is permitted when reconstructed Store sizes require it; ZIP64 input repair remains unsupported initially. Verify the completed private output with the strict reader and per-file hashes before exclusive publication. Do not create a sidecar report or silently extract/reopen it.",
412 "terminal": {
413 "complete": "Completed/None only with a complete central inventory, all known members verified, no loss/unverified count or unknown_loss, one actual Output Created, publication Complete and successful finalization. Display this as a saved recovery copy, not a modified original.",
414 "incomplete_saved": "If at least one verified item is published but any known loss/unverified item or unknown inventory remains: Failed/RecoveryIncomplete, publication Complete, created_count=1. Complete describes the one ZIP artifact publication only, never full source recovery. Keep the artifact and show the warning; do not offer automatic large-limit retry or rollback.",
415 "impossible": "No verified items: Failed/RecoveryImpossible, publication None, zero created/retained outputs unless owned temporary cleanup actually failed.",
416 "fatal_or_cancel": "Limit, UnsafePath, SourceChanged, DiskFull, Io, Conflict, Protocol or cancellation override recovery business summaries. Before publication keep no complete output; preserve actual cleanup/retained/uncertain state. After publication preserve actual Output/durability/cleanup and never synthesize absence or rollback.",
417 "healthy_source": "If the strict normal parser and content verification pass without any header reconstruction needed, reject an explicitly requested RecoverZip with InvalidRequest and zero outputs. A healthy control ZIP remains the normal-list control and is never silently rewritten."
418 },
419 "source_and_publication": "Capture read-only through pinned safe handles into one private snapshot with full source SHA256. All parsing uses that snapshot. Revalidate source identity/length/metadata and full hash once before publication; detected changes abort SourceChanged. Never open the original or any preexisting destination for write/truncate. Same-path/hard-link/existing/newly appeared destination conflicts are never replaced. Reuse existing publication cutoff, fsync/close, owned temporary cleanup and post-verification destination checks.",
420 "resources": "Recovery-only source input cap is min(caller input quota, 4 GiB). More than 4 GiB is outside initial recovery support and returns UnsupportedFeature with no expanded retry; exceeding a lower caller quota keeps Limit. Resource approval cannot expand source input. Reuse existing 16 GiB/10000 decoded-byte/candidate defaults and explicit guarded ceilings up to 64 GiB/200000. Count lost/unverified candidates and bytes actually decoded before failure. Include result records, names, spans, staging indexes and implicit parents in metadata budgets before allocation: 8 MiB/32768 nodes, or 64 MiB/262144 after a valid grant. Use 64 KiB chunks, checked u64 ranges, bounded strings/frames, ZIP ratio challenges and the existing 300-second/60-second/parent lifetime policies. No per-byte candidate restarts. Disk accounting includes input snapshot, verified member spools, built ZIP and destination temp by actual volume; permission or advisory space checks do not reserve storage.",
421 "client": "Explicit recovery-copy action and native ZIP save dialog; never weaken or silently retry ordinary List/Extract. Show Verified/Lost/Unverified with typed reasons and distinguish unknown inventory from zero loss. Keep recovery findings separate from the ordinary catalog; read a saved copy in a new explicit job with a fresh ListId. Retain partial-warning context when opening a copy, and do not present an ordinary later ZIP listing as proof that all original data was recovered. Result details are job data, not an authenticated permanent recovery certificate.",
422 "lifecycle": "Preserve job/sequence/challenge validation, resource approval, CancelAck and exactly one final Terminal. Confirm results only after matching Terminal, both EOFs and owned-child wait. No new security settings or dependency changes. Frontend agreement is recorded; UI scenarios and native integration remain frontend work.",
423 "fixtures": {
424 "basis_commit": "d525c7c23796b06048180c3b3d2bbaee8075989e",
425 "manifest": "tests/zip-recovery-fixtures/expectations.json",
426 "static_expected_verified_counts": {
427 "missing-directory.zip": 6,
428 "broken-eocd.zip": 6,
429 "middle-truncated.zip": 4,
430 "body-corrupt.zip": 5,
431 "unrecoverable.zip": 0,
432 "broken-local-header.zip": 6
433 },
434 "comparison": "Read-only comparison of fixture expectations, not worker execution. The intact-central broken-local-header.zip expects CentralDirectory, known_entries=6 and unknown_loss=false. The other damaged samples lack a usable central inventory and retain unknown_loss."
435 },
436 "tag_correction": "Initial errors 14/15 collided with live MissingVolume=14. Joint correction preserves MissingVolume=14 and activates RecoveryIncomplete=15 and RecoveryImpossible=16. Regression checks consult live wire, not only the historical contract index.",
437 "agreement": {
438 "frontend_result_review": "https://github.com/Team-LJY/zipelo/pull/128#pullrequestreview-5904112564",
439 "frontend_corrected_tag_review": "https://github.com/Team-LJY/zipelo/pull/128#pullrequestreview-5904158997"
440 },
441 "validation": "Backend tests cover all six damaged fixtures against independent expected SHA256, Python ZIP verification, source byte preservation, healthy/control rejection, exact Deflate/descriptor boundaries, input/output/candidate caps, source and destination changes, cancellation, staging/publication ENOSPC/IO/sync errors, and decoded bytes before errors. Full local/native results are recorded in PR128."
442 }
443}