Skip to content

Refuse out-of-range compression levels and drop chrono from common - #249

Merged
saworbit merged 2 commits into
mainfrom
batch/common-fixes
Nov 15, 2026
Merged

saworbit merged 2 commits into
mainfrom
batch/common-fixes

Conversation

@saworbit

Copy link
Copy Markdown
Owner

Two fixes in common.

Refuse out-of-range compression levels (#236). Policy::validate now refuses an LZ4 level outside 1 to 16 and a Zstd level outside -5 to 22, with PolicyError::CompressionLevelOutOfRange naming the level and the range. Those are the ranges compression::adjusted_level clamps to, now read from common::policy::LZ4_LEVELS and ZSTD_LEVELS so the two can't drift. The clamp stays for any policy that skips validation. spacectl create --policy-file with !Zstd { level: 99 } fails with invalid policy file level.yaml before anything is written.

Drop chrono from common (#237). Nothing in common used it. Cargo.lock loses chrono, iana-time-zone, android_system_properties, core-foundation-sys and the windows-core family. No other crate depends on chrono. cargo deny check and cargo audit pass.

Tests:

  • compression_levels_must_be_in_the_codecs_range: both ends of each range pass, levels past them fail, the message names the range, and every preset passes. Fails with the check disabled.
  • policy_files_refuse_unknown_and_unsupported_settings in spacectl gains a level 99 case.
  • cargo clippy --workspace --all-targets --locked -- -D warnings is clean.

CHANGELOG updated.

Fixes #236
Fixes #237

Nothing in common uses chrono. Removing it takes chrono, iana-time-zone
and their platform crates out of Cargo.lock.

Fixes #237
A policy with a Zstd level outside -5..=22, or an LZ4 level outside
1..=16, is now refused with a PolicyError naming the level and the
range. The compressor used to clamp it with a warning while the capsule
kept the level it was given. The compressor's clamp now reads the same
ranges from common.

Fixes #236
@saworbit
saworbit enabled auto-merge (squash) November 15, 2026 08:18
@saworbit
saworbit merged commit 18b75c9 into main Nov 15, 2026
17 checks passed
@saworbit
saworbit deleted the batch/common-fixes branch November 15, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Repo] Drop the unused chrono dependency from common [Core] Refuse out-of-range compression levels in Policy::validate

1 participant