Skip to content

uorc client: inspect, verify, safe writes, multi-file archives - #110

Merged
afflom merged 1 commit into
mainfrom
claude/project-thread-3dnp1u
Nov 9, 2026
Merged

afflom merged 1 commit into
mainfrom
claude/project-thread-3dnp1u

Conversation

@afflom

@afflom afflom commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Requested by Alex · project thread

Targets main; rebased onto it after #104 merged. Rust and web only: no change to client/src, the LexLean export or generated/rust.

Closes #36, closes #37, closes #38.

What changes

Inspect and verify (#36)

  • uorc inspect [--json] <archive> reads the frame header (format, profile, scope/basis, representation raw / ulz-kernel / program, object lengths, body and archive sizes) and checks the UORC-SHA256-CHAIN-v1 seal without decoding. It walks archives written back to back, so it also covers the streams that Stream input of any size in bounded frames #106 adds.
  • uorc verify [--json] <archive> [original] decodes in memory, checks the seal and the declared lengths, and with an original compares the bytes.
  • Exit codes: 0 ok, 2 usage, 3 I/O (including a refused overwrite), 4 invalid archive or integrity, 5 step budget, 6 overflow, 7 differs from the original.
  • Library: inspect, frames, verify, Info, Representation, Error::Mismatch.

Safe output (#37)

  • Output goes to a temporary file next to the destination, is synced, then moved into place. Without --force the move is a hard link, which fails if the destination exists, so nothing can be overwritten between check and move. With --force it is an atomic rename. The temporary file is removed on every error path. An existing output is refused before any work starts.

Ordered objects and trees (#38)

  • compress_objects / decompress_objects handle any number of objects, including zero and empty ones. The body codes the concatenation once, so similar files compress together, and the frame's standard objectLengths records each length (resealed). decompress checks the seal of a multi-object archive, relabels it to one object, and runs the existing certified path.
  • uorc compress <dir> or uorc compress a b c -o x.uorc stores [manifest, file₁…fileₙ]. The manifest holds relative paths and kinds (file, executable, directory), so empty directories and the +x bit survive. An empty tree is the archive of zero objects. A one-object archive is always a plain stream, so the two never collide.
  • Restore refuses absolute paths, .., empty components and parents that are symlinks. --resume keeps files that already hold the right bytes, so an interrupted restore can finish. Symlinks are skipped when packing.

wasm and Pages

  • uorc-wasm adds inspect, verify (with an original_buffer), compress_tree and decompress_tree. web/uorc.js exposes inspect, verify, compressFiles and decompressFiles.
  • The page adds multi-file and folder compress, a per-file download list on decompress, Inspect and Verify buttons, and usage for the new commands.
  • Fixes a latent loader bug: the wasm memory view was taken before the input allocation could grow memory, which detached it.

Tests

  • cargo test --release -p uorc: 14 library tests and 7 CLI tests pass. They cover: refused overwrite, --force, a failed run leaving no file, inspect on kernel and corrupt archives, verify with match and mismatch, the exit codes, ordered objects (zero, empty, mixed), streams, a broken seal on a relabelled archive, a nested directory with empty files, binary data, an empty dir and the +x bit, --resume, and a hostile manifest.
  • cargo clippy -p uorc -p uorc-wasm --all-targets -D warnings and cargo fmt are clean.
  • Pages checked in headless Chromium against the release wasm: inspect, verify (match and mismatch), compressFiles/decompressFiles round trip, and the single-file compress button.

No CI legs are added. UC-OBJ-01 can cite ordered_objects_round_trip and directories_round_trip_with_empty_files_binary_and_nesting (conformance rows are #108's lane).

🤖 Generated with Claude Code

https://claude.ai/code/session_013Asa3LpDk5B19xbzm4jSei

@afflom afflom self-assigned this Nov 9, 2026
- uorc inspect: frame header (scope, representation, object lengths, sizes)
  and the UORC-SHA256-CHAIN-v1 seal, without decoding; walks archives
  written back to back. --json for machine output.
- uorc verify: decode in memory, check seal and declared lengths, and
  optionally compare with an original. Distinct exit codes: 2 usage, 3 I/O,
  4 invalid archive, 5 budget, 6 overflow, 7 differs from the original.
- Outputs go to a temporary file beside the destination and are moved into
  place with a no-replace hard link (or rename under --force); a failed run
  leaves nothing behind.
- Ordered objects: compress_objects/decompress_objects code the
  concatenation once and record each length in the frame's objectLengths
  (resealed); decompress relabels to one object for the certified path.
- Trees: a directory or several paths become [manifest, file...]; restore
  refuses absolute and '..' paths and symlinked parents; --resume keeps
  files already restored.
- wasm exports inspect, verify, compress_tree, decompress_tree; the Pages
  site gains multi-file/folder compress, per-file download, Inspect, Verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3LpDk5B19xbzm4jSei
@afflom
afflom force-pushed the claude/project-thread-3dnp1u branch from 4b9ed73 to 8fedf95 Compare November 9, 2026 16:19
@afflom
afflom changed the base branch from claude/project-thread-jl6avw to main November 9, 2026 16:20
@afflom
afflom merged commit 37498ea into main Nov 9, 2026
14 checks passed
afflom pushed a commit that referenced this pull request Nov 9, 2026
…ands

UC-API-01 now covers inspect and verify across library, CLI and Wasm;
UC-OBJ-01 is build evidence from multi-object archives (zero objects,
distinct empty objects, truncation and trailing bytes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3Pb2pARmowTZwiuFLV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants