feat(std): xxHash32/64 and the LZ4 frame format (step 2 of #121) #782

Open
orion wants to merge 3 commits from loop/781-xxhash-lz4-frame into main
Collaborator

What

  • std/digest: Bytes.xxHash32(seed) and Bytes.xxHash64(seed), tested against published vectors and the xxhsum sanity buffer (lengths 1, 14, 222, 1000; seeds 0 and 0x9E3779B1).
  • std/compression: Bytes.lz4Framed() and lz4Unframed(maximumSize): content checksum, block checksums, linked blocks, content size, stored blocks, skippable frames, concatenated frames, 4 MiB blocks. lz4DecompressInto gets a history start so linked blocks can reference earlier blocks.
  • Malformed input returns Fail(CompressionError) with an offset: bad magic, header checksum, flipped content checksum, truncated block, output over maximumSize, reserved bits, version, block size.
  • Docs: doc comments, docs/standard-library/compression.md, regenerated skills/, FIRST-PARTY.md gap 26.

Evidence

torb test std/compression std/digest: 92 passed. torb format --check: clean. Pure TorbScript, no seed/, no compiler/ir, backend or runtime change, so tier B is not required.

Deviation from the criteria

The reference lz4 CLI was not available where this was built. The frame vectors are a frame from the lz4js library, a hand-built frame from the format description (linked blocks, block checksums, content size, content checksum), a stored-block frame and the standard empty frame. Criterion 3 ("written by the reference tool") is only met by that substitute; a vector from the lz4 CLI should be added by someone who has it. Hence Refs, not Closes.

Bootstrap, gates and LTO builds were not run locally; CI only.

Refs #781

## What - `std/digest`: `Bytes.xxHash32(seed)` and `Bytes.xxHash64(seed)`, tested against published vectors and the xxhsum sanity buffer (lengths 1, 14, 222, 1000; seeds 0 and 0x9E3779B1). - `std/compression`: `Bytes.lz4Framed()` and `lz4Unframed(maximumSize)`: content checksum, block checksums, linked blocks, content size, stored blocks, skippable frames, concatenated frames, 4 MiB blocks. `lz4DecompressInto` gets a history start so linked blocks can reference earlier blocks. - Malformed input returns `Fail(CompressionError)` with an offset: bad magic, header checksum, flipped content checksum, truncated block, output over `maximumSize`, reserved bits, version, block size. - Docs: doc comments, `docs/standard-library/compression.md`, regenerated `skills/`, FIRST-PARTY.md gap 26. ## Evidence `torb test std/compression std/digest`: 92 passed. `torb format --check`: clean. Pure TorbScript, no `seed/`, no compiler/ir, backend or runtime change, so tier B is not required. ## Deviation from the criteria The reference `lz4` CLI was not available where this was built. The frame vectors are a frame from the `lz4js` library, a hand-built frame from the format description (linked blocks, block checksums, content size, content checksum), a stored-block frame and the standard empty frame. Criterion 3 ("written by the reference tool") is only met by that substitute; a vector from the `lz4` CLI should be added by someone who has it. Hence `Refs`, not `Closes`. Bootstrap, gates and LTO builds were not run locally; CI only. Refs #781
feat(std): the LZ4 frame format in std/compression
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 9m49s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m44s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m41s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m28s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 3m53s
ci / every host emits the same C (pull_request) Successful in 9m46s
ci / tier A (linux-x64) (pull_request) Failing after 38m19s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
6ea11b73cc
Collaborator

CI red on 6ea11b7: ci / tier A (linux-x64) failed after 38m19s, and ci / gates failed after 0s (most likely because it needs tier A). The job logs are not readable with the review token, so the cause is not known to me; please check the tier A log and fix or explain. All other checks are green (bootstrap, conformance JS/PHP, playground, same-C, pdisc). This is not a review: it will run again on the next CI result for this PR.

CI red on 6ea11b7: `ci / tier A (linux-x64)` failed after 38m19s, and `ci / gates` failed after 0s (most likely because it needs tier A). The job logs are not readable with the review token, so the cause is not known to me; please check the tier A log and fix or explain. All other checks are green (bootstrap, conformance JS/PHP, playground, same-C, pdisc). This is not a review: it will run again on the next CI result for this PR.
fix(std/digest): name Digest and Sha256 in code, not as doc links the doc gate cannot resolve
Some checks are pending
ci / commit messages (pull_request) Successful in 8s
ci / what the change touches (pull_request) Successful in 7s
ci / gates (pull_request) Blocked by required conditions
ci / pack the seed (pull_request) Blocked by required conditions
ci / archives (pull_request) Blocked by required conditions
pdisc / pdisc (pull_request) Successful in 14s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 10m25s
ci / tier A (linux-x64) (pull_request) Waiting to run
ci / tier B (linux-x64) (pull_request) Waiting to run
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Waiting to run
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Waiting to run
ci / the playground (torb as WebAssembly) (pull_request) Waiting to run
ci / conformance (JavaScript under Node.js) (pull_request) Waiting to run
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Waiting to run
6d2da0de95
orion requested review from argus 2026-11-14 08:25:43 +00:00
Some checks are pending
ci / commit messages (pull_request) Successful in 8s
ci / what the change touches (pull_request) Successful in 7s
ci / gates (pull_request) Blocked by required conditions
Required
Details
ci / pack the seed (pull_request) Blocked by required conditions
ci / archives (pull_request) Blocked by required conditions
pdisc / pdisc (pull_request) Successful in 14s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 10m25s
ci / tier A (linux-x64) (pull_request) Waiting to run
ci / tier B (linux-x64) (pull_request) Waiting to run
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Waiting to run
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Waiting to run
ci / the playground (torb as WebAssembly) (pull_request) Waiting to run
ci / conformance (JavaScript under Node.js) (pull_request) Waiting to run
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Waiting to run
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'loop/781-xxhash-lz4-frame:loop/781-xxhash-lz4-frame'
git switch 'loop/781-xxhash-lz4-frame'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!782
No description provided.