Commit Graph
131 Commits
Author SHA1 Message Date
ddidderr 4663a3372e feat(compress): move repcode invalidation to Rust
Keep ZSTD_invalidateRepCodes responsible for extracting the private previous
block state and checking that the match window has no external dictionary.
Delegate only the fixed three-entry repcode reset through a narrow pointer ABI,
with a C assertion preserving the Rust side's ZSTD_REP_NUM assumption.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression zstd_compress::tests::invalidate_rep_codes_clears_all_entries` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` and `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- Required clippy, nightly fmt, and diff checks -- passed
2026-07-18 09:55:01 +02:00
ddidderr 745858e980 feat(compress): move CDict table copy leaf to Rust
ZSTD_copyCDictTableIntoCCtx only transformed tagged CDict match-table
entries or copied untagged entries; context-owned table selection remains in
C. Keep that policy and both call sites in C, forwarding the selected flag
through a narrow ABI. Rust removes the frozen eight-bit short-cache tag or
uses copy_nonoverlapping for C memcpy-equivalent copying without adding
validation.

Test Plan:
- Focused and full compression Rust tests passed (2 and 267 tests).
- `make -B -C lib -j2 lib` passed.
- `make -C tests -j2 fuzzer` passed.
- `./tests/fuzzer -s4560 -t47 -i48 -v` passed.
- Clippy normal/benches/tests before and after `cargo +nightly fmt` passed.
- `git diff --check` and `git diff --cached --check` passed.
2026-07-18 09:47:55 +02:00
ddidderr 3c51a97814 feat(compress): move CParamMode policy to Rust
Keep C responsible for extracting the cdict and CCtx scalar fields while
moving the attach-versus-copy mode decision into the Rust parameter module.
The Rust ABI short-circuits absent cdicts and reuses the established
attachment predicate, preserving unknown-size, force-attach, force-copy, and
force-window behavior.

Test Plan:
- cargo test --manifest-path rust/Cargo.toml --no-default-features
  --features compression
  cparam_mode_preserves_cdict_presence_and_attachment_policy -- passed
- make -B -C lib -j2 lib -- passed
- make -C tests -j2 fuzzer -- passed
- ./tests/fuzzer -s4560 -t47 -i48 -v -- passed
- Required clippy normal/benches/tests, nightly fmt, and diff checks -- passed
2026-07-18 09:42:58 +02:00
ddidderr 527cf01031 feat(compress): move next input hint policy to Rust
Keep ZSTD_nextInputSizeHint's C-owned state-machine and MT routing while
moving its mode-dependent arithmetic behind a narrow scalar ABI. Rust now
receives the buffer mode and four size fields, preserving stable-buffer
capacity, buffered target remainder, and the zero-remainder block-size
fallback without exposing ZSTD_CCtx.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression next_input_size_hint` -- passed (3 tests)
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` and `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- Required clippy, nightly fmt, and staged diff checks -- passed
2026-07-18 09:33:36 +02:00
ddidderr da84c8ff95 feat(compress): move streaming size helpers to Rust
The public streaming-size functions still calculated their values in the C
compressor entry point. Keep those public symbols and their size_t ABI in C,
but route the pure formulas through zstd_compress_api.rs. Rust uses usize for
the C size_t-equivalent constants and reuses its compressBound implementation;
the fixed block and header sizes make the output helper exactly 131591 bytes.

Test Plan:
- Focused Rust cstream size test -- passed (1 test)
- make -B -C lib -j2 lib -- passed
- make -C tests -j2 fuzzer -- passed
- ./tests/fuzzer -s4560 -t47 -i48 -v -- passed
- Required clippy, nightly fmt, and staged diff checks -- passed
2026-07-18 09:26:44 +02:00
ddidderr 7a345bd2f7 feat(compress): move dictionary attachment predicate to Rust
Keep the private CDict and CCtx parameter layouts in C while passing only the
five scalar inputs needed by the dictionary-attachment heuristic. Rust now
owns the exact per-strategy cutoffs and preserves unknown-size handling,
dedicated-search short-circuiting, force-attach and force-copy precedence, and
the force-window prohibition. The existing C helper and reset/copy call paths
remain unchanged.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression dictionary_attachment` -- passed (2 tests)
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` -- passed
- `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- Rust clippy for the library, benches, and tests before and after nightly formatting -- passed
- `cargo +nightly fmt --manifest-path rust/Cargo.toml` -- passed
- `git diff --cached --check` -- passed
2026-07-18 09:18:36 +02:00
ddidderr ae9667052a feat(compress): move dedicated dict hash-log transforms to Rust
Keep dedicated-dictionary strategy dispatch, parameter selection, and call-site
control flow in C while routing only the hashLog field transformations through
scalar Rust ABI helpers. The helpers use wrapping u32 arithmetic so overflow
and the existing subtract-then-clamp behavior remain identical to C.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression dedicated_dict_search_hash_log_adjustments_match_strategy_cases` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` -- passed
- `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- clippy normal, benches, and tests before and after formatting -- passed
- `cargo +nightly fmt --manifest-path rust/Cargo.toml` and `git diff --check` -- passed
2026-07-18 09:13:36 +02:00
ddidderr c86d18be81 feat(compress): move dedicated dict support predicate to Rust
Dedicated dictionary search support is a pure compression-parameter policy
check. Move its strategy and hash/chain-log comparisons into the Rust
parameter module behind a by-value ZSTD_compressionParameters ABI, while
leaving the existing C fallback path in createCDict_advanced2 unchanged.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression dedicated_dict_search_support_matches_strategy_and_log_boundaries` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` -- passed
- `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- `cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed
- The same clippy command with `--benches` and `--tests` -- passed
- `cargo +nightly fmt --manifest-path rust/Cargo.toml` -- passed
- `git diff --cached --check` -- passed
2026-07-18 09:07:42 +02:00
ddidderr 7ef97f97a9 feat(compress): move CCtx zstd parameter setter to Rust
Keep the C helper's ZSTD_checkCParams assertion at the call boundary while
moving its three field assignments into the existing repr(C) Rust CCtx
parameter module. The Rust leaf updates cParams and fParams, resets the
compression-level marker to NO_CLEVEL, and leaves unrelated CCtx state intact.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression set_zstd_params_updates_only_zstd_parameter_fields` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` -- passed
- `tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- required clippy trio, nightly fmt, post-format clippy trio, and `git diff --check` -- passed
2026-07-18 09:00:15 +02:00
ddidderr 934a589500 feat(compress): move block header serialization to Rust
Keep the private writeBlockHeader signature and its debug logging in C while
moving the pure block-type, size, and 24-bit little-endian encoding behind a
narrow Rust ABI. The Rust leaf preserves the RLE blockSize path for cSize == 1
and the compressed cSize path for every other value.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression block_header -- --nocapture` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` -- passed
- `./tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- Required clippy, nightly fmt, and diff checks -- passed
2026-07-18 08:52:42 +02:00
ddidderr 9df7b55d8f fix(compress): restore C fallback for unsupported CCtx strategies
ZSTD_compressCCtx was selecting the Rust frame path for every compression
level. For source sizes that resolve to lazy or optimal strategies, that path
fell through to fast matching and could produce a different frame, including
the CCtx reuse regression caught by fuzzer test 56.

Query the source-size-dependent C parameters before preparing the context.
Keep fast and double-fast strategies on the existing Rust path, while routing
all other strategies through ZSTD_compress_usingDict with no dictionary so the
original simple API initializes requested parameters and C match state.

Test Plan:
- `make -B -C tests -j2 fuzzer` -- passed
- `./tests/fuzzer -s4560 -t56 -i56 -v` -- passed
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- 253 passed
- required clippy normal, benches, and tests checks -- passed
- `cargo +nightly fmt --manifest-path rust/Cargo.toml` -- passed
- `git diff --check` and `git diff --cached --check` -- passed
2026-07-18 08:48:41 +02:00
ddidderr 3ab73f46df feat(compress): move sequence validation identity to Rust
ZSTD_resolveExternalSequenceValidation() is a pure int identity used while
resolving CCtx parameters. Route its existing C wrapper through a Rust
extern "C" entry point in the parameter module, preserving the int-to-int
ABI and every call-site result. Add boundary coverage for signed int modes.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed (253 tests)
- `make -B -C lib -j2 lib` -- passed
- required clippy passes for the compression feature, benches, and tests -- passed
- `cargo +nightly fmt --manifest-path rust/Cargo.toml` and `git diff --check` -- passed
2026-07-18 08:44:36 +02:00
ddidderr 0a06fa778c feat(compress): move C parameter overrides to Rust
The compression-parameter override helper previously lived in C and selectively
copied each nonzero field from a caller-provided override structure. Move that
pure field-wise operation into the Rust compression-parameter module, while
keeping the existing repr(C) structure and pointer-based ABI at both C call
sites. Zero-valued overrides continue to leave the current parameter untouched.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed (252 tests)
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 fuzzer` and `tests/fuzzer -s4560 -t47 -i48 -v` -- passed
- required clippy passes, nightly fmt, and `git diff --check` -- passed
2026-07-18 08:40:32 +02:00
ddidderr 33c937bc87 feat(compress): move deprecated block-size formula to Rust
Keep validation of the applied compression parameters in C and delegate the context-free minimum calculation through a narrow ABI leaf. Preserve the public getter and deprecated block-compression paths.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets

- cargo +nightly fmt --manifest-path rust/Cargo.toml

- make -B -C lib -j2 lib

- make -C tests -j2 fuzzer

- tests/fuzzer -s4560 -t47 -i48 -v
2026-07-18 08:33:07 +02:00
ddidderr 7f22db844d feat(compress): move sequence-store validation to Rust
Keep the C DEBUGLEVEL gate and delegate the read-only match-length validation through the existing SeqStore ABI. Preserve long-match side-band decoding and the original 3-or-4 byte lower-bound assertion.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets

- cargo +nightly fmt --manifest-path rust/Cargo.toml

- make -B -C lib -j2 lib

- make -C tests -j2 fuzzer

- tests/fuzzer -s4560 -t47 -i48 -v
2026-07-18 08:28:49 +02:00
ddidderr 56ae331f09 feat(compress): move block-state confirmation to Rust
Keep C ownership of the block-state structure while delegating the confirmed-block pointer swap through a narrow two-pointer ABI leaf. Preserve every existing confirmation call site and add direct pointer-swap coverage.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets

- cargo +nightly fmt --manifest-path rust/Cargo.toml

- make -B -C lib -j2 lib

- tests/fuzzer -s4560 -t47 -i48 -v

- make -C tests -j2 test-zstream
2026-07-18 08:23:28 +02:00
ddidderr b44b480f17 feat(cli): restore patch-from argument routing
Parse attached and separated --patch-from references, preserve the upstream ultra ceiling and conflict checks, and pass the reference path through the existing file-I/O dictionary ABI with patch mode enabled.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml

- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets

- cargo +nightly fmt --manifest-path rust/Cargo.toml

- make -C tests -j2 check

- small attached/separate patch-from round-trip and rejection smoke
2026-07-18 08:11:55 +02:00
ddidderr b81109095f feat(compress): move block split search to Rust
Port the recursive post-block-split partition search behind a narrow Rust ABI leaf while keeping CCtx ownership, entropy-state projection, and block emission in C. Preserve left-first midpoint insertion, minimum-sequence gating, the split cap, and error-as-no-split behavior.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets

- cargo +nightly fmt --manifest-path rust/Cargo.toml

- make -B -C lib -j2 lib

- tests/fuzzer -s4560 -t47 -i48 -v
2026-07-18 08:08:40 +02:00
ddidderr 7ee445c431 feat(compress): move no-delimiter sequence transfer to Rust
Port the no-delimiter external-sequence block scanner, match splitting, repcode updates, validation, and sequence/literal storage behind a narrow C shim. Preserve trailing bytes as literals when the sequence buffer ends before the requested block, and remove the obsolete C validation wrapper.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (242 passed)

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression [--benches|--tests] (clean)

- cargo +nightly fmt --manifest-path rust/Cargo.toml (clean)

- make -B -C lib -j2 lib (passed)

- make -C tests -j2 test-zstream (84 deterministic; 5960 and 8307 randomized passed)

- make -C tests -j2 test-fuzzer (existing test 56 CCtx-reuse mismatch; also fails at 37eb75758)

- make -C tests -j2 test-zstd (existing Rust CLI --patch-from gap)
2026-07-18 07:49:11 +02:00
ddidderr 37eb757585 feat(compress): move dictionary entropy loading to Rust
Port ZSTD_dictNCountRepeat and ZSTD_loadCEntropy to a dedicated Rust compression module. Preserve the existing C-facing ZSTD_loadCEntropy symbol through a narrow shim while keeping dictionary content and compression-context ownership in C.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --benches --tests

- make -B -C lib -j2 lib

- make -C tests -j2 test-invalidDictionaries

- make -C tests -j2 test-zstream
2026-07-18 07:33:06 +02:00
ddidderr 77841fcfd2 feat(compress): move explicit sequence transfer to Rust
Move ZSTD_transferSequences_wBlockDelim's delimiter scan, literal copying, SeqDef storage, validation, and repcode bookkeeping into the Rust compression statistics module. Keep ZSTD_CCtx and block-state ownership in C through a narrow scalar/pointer shim, with ABI layout assertions for ZSTD_SequencePosition.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --benches --tests

- make -B -C lib -j2 lib

- make -C tests -j2 test-zstream
2026-07-18 07:24:18 +02:00
ddidderr 511882e213 feat(compress): move block size estimation to Rust
Block splitting still estimated literal and sequence section sizes through
three C helpers. Move the pure estimator into zstd_compress_stats.rs so its
histogram, HUF, and FSE cost calculations use the Rust implementations already
behind the compression ABI. Preserve the original literal headers, multi-stream
Huffman surcharge, sequence additional-bit costs, entropy-header accounting,
and fallback estimates; leave C responsible for split recursion and table
ownership.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- 229 passed
- `cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression` plus benches/tests -- passed before and after formatting
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 test-zstream` -- passed, including 84 deterministic and 15,375 randomized cases
2026-07-18 07:08:27 +02:00
ddidderr d334aaafa3 feat(compress): move external block summary to Rust
The explicit-delimiter sequence path still calculated each block summary in C,
with a separate AVX2 implementation and scalar fallback. Move that pure scan
to zstd_compress_stats.rs and keep a C wrapper for the existing orchestration.
The Rust leaf preserves delimiter inclusion, literal and match totals, and the
external-sequences error when no delimiter is present, while the C ABI is pinned
with a repr(C) layout check.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- 227 passed
- `cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression` plus benches/tests -- passed before and after formatting
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 test-zstream` -- passed, including 84 deterministic and 15,464 randomized cases
2026-07-18 06:56:38 +02:00
ddidderr 18f5419cc6 feat(compress): move external sequence conversion to Rust
The external-sequence block path still converted public ZSTD_Sequence values
in C, with separate scalar and AVX2 implementations. Move that pure format
conversion into zstd_compress_stats.rs so both native configurations share one
implementation. Preserve offBase encoding, u16 truncation, the rep-ignored
contract, and the long-length side-band marker; leave C responsible for block
state, repcode resolution, and long-length bookkeeping.

Test Plan:
- `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- 225 passed
- `cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression` plus benches/tests -- passed before and after formatting
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all` -- passed
- `make -B -C lib -j2 lib` -- passed
- `make -C tests -j2 test-zstream` -- passed, including 84 deterministic and 14,768 randomized cases
2026-07-18 06:50:48 +02:00
ddidderr 684963c1a9 feat(cli): move multi-file output policy to Rust
Port the scalar decision matrix for multi-input concatenation behind the CLI Rust ABI. C retains warnings, preference mutation, fatal diagnostics, and confirmation prompts; Rust now classifies protection, remove-file disabling, quiet abort, and confirmation paths with focused coverage.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml fileio_prefs::tests::multi_files_concat

- cargo clippy --manifest-path rust/cli/Cargo.toml

- cargo clippy --manifest-path rust/cli/Cargo.toml --benches

- cargo clippy --manifest-path rust/cli/Cargo.toml --tests

- cargo +nightly fmt --manifest-path rust/Cargo.toml --all

- make -B -C programs -j2 zstd

- make -C tests -j2 test-cli-tests
2026-07-18 06:38:24 +02:00
ddidderr 21f8e8958c feat(compress): move target block policy to Rust
Port the target-sized block action policy behind a scalar Rust ABI while keeping sequence inspection, superblock compression, block-state confirmation, diagnostics, and raw/RLE emission in C. Preserve the strict three-byte header boundary, destination-too-small fallback, and first-block RLE guard with focused tests.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression zstd_compress::tests::target_block

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- cargo +nightly fmt --manifest-path rust/Cargo.toml --all

- make -B -C lib -j2 lib
2026-07-18 06:37:07 +02:00
ddidderr b19ca569f7 feat(compress): move MT synchronization policy to Rust
Port the rsyncable synchronization-point scan and rolling hash policy behind a scalar ABI. Keep the MT scheduler, input buffers, and context ownership in C while adding boundary-focused Rust coverage for disabled, short, buffered, spanning, and hit/no-hit paths.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- cargo +nightly fmt --manifest-path rust/Cargo.toml --all

- make -B -C lib -j2 lib

- make -B -C tests -j2 test-zstream (pending post-commit native gate)
2026-07-18 06:18:30 +02:00
ddidderr 0272ae867b feat(compress): move frame progression accounting to Rust
Port the scalar consumed/produced counter updates and pledged-size overrun predicate behind a narrow Rust ABI while leaving C diagnostics and context ownership intact. Add focused coverage for unknown, exact, and overrun pledges.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- cargo +nightly fmt --manifest-path rust/Cargo.toml --all

- make -B -C lib -j2 lib (pending post-commit native gate)
2026-07-18 06:18:02 +02:00
ddidderr 3bbfacdfd0 feat(compress): move repcode reconciliation to Rust
Port ZSTD_seqStore_resolveOffCodes and its repcode-resolution helper to Rust. The C shim keeps Repcodes_t and SeqStore_t ownership in the compressor context while Rust preserves long-literal handling, mismatch materialization, and independent decoder/compressor history updates.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (208 tests)

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- make -B -C lib -j2 lib
2026-07-18 06:03:55 +02:00
ddidderr 48eb895af3 feat(compress): move raw and RLE block emitters to Rust
Replace the shared C raw and one-byte RLE fallback block serializers with Rust ABI leaves. Preserve the zstd block headers, payload copies, capacity errors, and all existing C compressor dispatch and context ownership; share the raw serializer with the Rust one-shot path.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (208 tests)

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- make -B -C lib -j2 lib
2026-07-18 06:03:39 +02:00
ddidderr 3599d223f9 feat(cli): move dictionary loading backend to Rust
Move malloc-backed dictionary file reads into the Rust CLI backend while keeping C responsible for stat metadata, patch-mode size policy, diagnostics, buffer-type selection, and eventual free(). The Rust leaf returns explicit open, size, allocation, and read statuses and publishes only fully read libc allocations.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml (126 tests)

- cargo clippy --manifest-path rust/cli/Cargo.toml

- make -B -C programs -j2 zstd

- make -C tests -j2 test-cli-tests (41 tests)
2026-07-18 06:02:22 +02:00
ddidderr 459782ad55 feat(compress): move frame epilogue serialization to Rust
Port the scalar frame-finalization policy and byte serialization into the Rust compression leaf while keeping checksum finalization, tracing, and the compression context in C. Preserve the init-to-ongoing transition on partial failure and reset the stage only after a successful epilogue.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml

- cargo clippy --manifest-path rust/Cargo.toml --benches

- cargo clippy --manifest-path rust/Cargo.toml --tests

- make -B -C lib -j2 lib

- make -B -C tests -j2 test-zstream (84 deterministic, 6737 and 9012 fuzzer cases)
2026-07-18 05:49:37 +02:00
ddidderr 52c0eb4b9b feat(cli): move regular-file removal to Rust
Route the CLI backend's safe file-removal leaf through a narrow Rust status ABI while preserving C diagnostics, Windows read-only handling, and the existing return convention.

Test Plan: cargo test --manifest-path rust/cli/Cargo.toml; cargo clippy --manifest-path rust/cli/Cargo.toml; cargo clippy --manifest-path rust/cli/Cargo.toml --benches; cargo clippy --manifest-path rust/cli/Cargo.toml --tests; make -B -C programs -j2 zstd; make -C tests -j2 test-cli-tests (41 tests); make -B -C programs -j2 zstd-small zstd-frugal.
2026-07-18 05:39:21 +02:00
ddidderr 327272f8b3 feat(compress): move optimal block policy to Rust
Move the frame chunk pre-split policy behind a scalar Rust ABI while retaining C ownership of ZSTD_CCtx and workspace extraction.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression; cargo clippy --manifest-path rust/Cargo.toml; cargo clippy --manifest-path rust/Cargo.toml --benches; cargo clippy --manifest-path rust/Cargo.toml --tests; make -B -C lib -j2 lib; make -B -C tests -j2 test-zstream (84 deterministic, 6697 and 9217 fuzzer cases).
2026-07-18 05:38:54 +02:00
ddidderr 1a05952013 feat(compress): move external sequence validation to Rust
Port the external-sequence window, offset, and minimum-match checks through a scalar C ABI leaf while retaining the C caller's control flow and diagnostics.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression; cargo clippy --manifest-path rust/Cargo.toml; cargo clippy --manifest-path rust/Cargo.toml --benches; cargo clippy --manifest-path rust/Cargo.toml --tests; make -B -C lib -j2 lib; make -B -C tests -j2 test-zstream (84 deterministic, 7063 and 8665 fuzzer cases).
2026-07-18 05:19:19 +02:00
ddidderr 4c6a00722f feat(compress): move parameter update policy to Rust
Move ZSTD_isUpdateAuthorized behind the existing Rust parameter API while retaining the C context-stage checks, diagnostics, and mutation flow.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (187 tests)

- cargo clippy for library, benches, and tests

- make -B -C lib -j2 lib
2026-07-18 05:11:26 +02:00
ddidderr ce992fb0be feat(cli): move cycle log policy to Rust
Move the CLI's strategy-dependent cycle-log calculation behind a scalar Rust ABI shim while retaining the C assertion and call-site behavior.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark (116 tests)

- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets with the full CLI feature set

- make -B -C programs -j2 zstd zstd-small zstd-frugal

- make -C tests -j2 test-cli-tests (41 scenarios)
2026-07-18 05:06:48 +02:00
ddidderr cba0373a2b feat(compress): move hash and window reset policies to Rust
Move hash-salt mixing and context-reset overflow predicates behind scalar Rust ABI shims. Keep the C-owned match state and window arithmetic in the C wrapper while preserving exact architecture-dependent thresholds.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (186 tests)

- cargo clippy for library, benches, tests, and CLI all-targets

- make -B -C lib -j2 lib

- make -B -C tests -j2 test-zstream (84 deterministic tests; fuzzers 6451 and 9879 cases)
2026-07-18 05:06:32 +02:00
ddidderr 52deffe66c feat(cli): move patch memory-limit policy to Rust
Move patch-from memory-limit sizing and rejection status selection behind a Rust ABI shim. Keep the C diagnostics and assertion in place, and leave the existing preference unchanged when input sizes are unknown or exceed the window limit.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark (113 tests)

- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets with the CLI feature set

- make -B -C programs -j2 zstd zstd-small zstd-frugal

- make -C tests -j2 test-cli-tests (41 scenarios) and make -B -C tests -j2 test-zstream
2026-07-18 04:54:28 +02:00
ddidderr 59eda8deac feat(compress): move block policy predicates to Rust
Move target block-size and block-splitter policy predicates behind narrow Rust ABI shims while retaining the C debug logging, finalized-mode assertion, and surrounding control flow.

Test Plan:

- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression

- cargo clippy --manifest-path rust/Cargo.toml and native library build

- make -B -C tests -j2 test-zstream (84 deterministic tests; fuzzers 6778 and 8299 cases)
2026-07-18 04:54:15 +02:00
ddidderr 49f03de3e2 feat(cli): move summary display predicates to Rust
Port the single-file and multiple-file summary decisions through the existing FIO context ABI, including the display-level lookup and the original multiple-file assertion invariant. Keep the C wrappers and call sites unchanged.

Test Plan: cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark (108 passed); CLI all-target clippy; make -B -C programs -j2 zstd zstd-small zstd-frugal; make -C tests -j2 test-cli-tests (41 passed).
2026-07-18 04:43:53 +02:00
ddidderr d9fe5d25ab feat(compress): move MT overlap window policy to Rust
Move construction of the external-dictionary and active-prefix ranges into a narrow Rust ABI while retaining the C window and logging surface. Preserve byte-range half-open overlap semantics and leave the input-range overlap wrapper available to its other C caller.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (180 passed); root and CLI clippy; make -B -C lib -j2 lib; make -C tests -j2 test-cli-tests (41 passed); make -B -C tests -j2 test-zstream (84 named tests plus 6,845 and 9,628 fuzz cases passed).
2026-07-18 04:43:41 +02:00
ddidderr 2cd0b29790 feat(compress): move match table reduction to Rust
Port the 16-cell match-table reduction leaf while preserving the window-index threshold, wrapping subtraction, and btlazy2 unsorted marker. Keep ZSTD_reduceIndex and its strategy-specific table selection in C behind the narrow Rust ABI.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (180 passed); root clippy, bench clippy, and test clippy; make -B -C lib -j2 lib; make -B -C tests -j2 test-zstream (84 named tests plus 6,845 and 9,628 fuzz cases passed).
2026-07-18 04:43:26 +02:00
ddidderr 5362112c9c feat(cli): move file info aggregation to Rust
Mirror fileio.c's private fileInfo_t with a checked repr(C) ABI and aggregate totals, flags, and file counts through an output-pointer shim. Preserve zeroed non-aggregate fields and use wrapping arithmetic for the original integer operations.

Test Plan: cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark (106 passed); cargo clippy --all-targets with the same features; make -B -C programs -j2 zstd zstd-small zstd-frugal; make -C tests -j2 test-cli-tests (41 passed).
2026-07-18 04:31:43 +02:00
ddidderr d5ae2a450b feat(compress): move external sequence sizing leaves to Rust
Port repcode offBase finalization and explicit-delimiter block sizing through the Rust compression ABI. Preserve wrapped sequence arithmetic, external-sequence error codes, and the no-delimiter target-size policy while keeping the C control flow intact.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression (176 passed); cargo clippy root, benches, and tests; make -B -C lib -j2 lib; make -B -C tests -j2 test-zstream (84 named tests plus 6,230 and 8,598 fuzz cases passed).
2026-07-18 04:31:22 +02:00
ddidderr 42481fb366 feat(cli): move decompressed filename policy to Rust
Port destination-name derivation to the Rust file-I/O preference module. Preserve build-configured suffix matching, tar-name conversion, stdin/stdout sentinels, output-directory handling, diagnostics, static-buffer reuse, and allocation behavior through the existing C adapter.

Test Plan:\n- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark\n- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features helpers\n- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features cli,compression,decompression,benchmark\n- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features helpers\n- make -B -C programs -j2 zstd zstd-small zstd-frugal\n- make -C tests -j2 test-cli-tests
2026-07-18 04:14:40 +02:00
ddidderr e80fbe4b06 feat(compress): move sequence policy leaves to Rust
Move external-sequence postprocessing and MT overlap detection into the Rust compression modules. Keep C stateful dispatch and locking code intact while preserving error encoding, delimiter handling, and half-open range semantics.

Test Plan:\n- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression\n- cargo clippy --manifest-path rust/Cargo.toml\n- cargo clippy --manifest-path rust/Cargo.toml --benches\n- cargo clippy --manifest-path rust/Cargo.toml --tests\n- make -B -C lib -j2 lib\n- make -C tests -j2 test-cli-tests
2026-07-18 04:14:27 +02:00
ddidderr af2991ea40 feat(cli): move compressed filename helper to Rust
Port the compressed destination-name helper to the Rust file-I/O preference module. Preserve stdin/stdout sentinels, output-directory basename handling, suffix assembly, static-buffer reuse, and allocation failure behavior behind the existing C shim.

Test Plan:\n- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features cli,compression,decompression,benchmark\n- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features helpers\n- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features cli,compression,decompression,benchmark\n- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features helpers\n- make -B -C programs -j2 zstd zstd-small zstd-frugal\n- make -B -C tests -j2 test-cli-tests
2026-07-18 04:06:02 +02:00
ddidderr bdb14b4fbf feat(compress): move sequence leaves to Rust
Move sequence-store byte accounting, chunk derivation, and repcode resolution into the Rust compression module. Move MT raw-sequence buffer conversions into Rust while preserving the existing C adapters and ABI layouts.

Test Plan:\n- cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression\n- cargo clippy --manifest-path rust/Cargo.toml\n- cargo clippy --manifest-path rust/Cargo.toml --benches\n- cargo clippy --manifest-path rust/Cargo.toml --tests\n- make -B -C lib -j2 lib\n- make -B -C tests -j2 test-cli-tests
2026-07-18 04:05:48 +02:00
ddidderr 1edec2cc0e feat(compress): move seq-store leaves to Rust
Move compressed-block state reset, final-literal storage, sequence-store reset, sequence-length summation, RLE detection, and RLE heuristics into the Rust compression statistics module. Preserve the C helper surface and add focused pointer/layout and boundary tests.

Test Plan: cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression; cargo clippy --manifest-path rust/Cargo.toml; cargo clippy --manifest-path rust/Cargo.toml --benches; cargo clippy --manifest-path rust/Cargo.toml --tests; make -B -C lib -j2 lib; make -B -C programs -j2 zstd zstd-small zstd-frugal; make -B -C tests -j2 test-cli-tests; make -B -C tests -j2 test-zstream
2026-07-18 03:55:57 +02:00