You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Core] Refuse out-of-range compression levels in Policy::validate #236
Policy::validate doesn't check the compression level. A policy file with compression: !Zstd { level: 99 } (or level: -5000) is accepted, and spacectl create --policy-file exits 0. The compressor clamps the level to -5..=22 with a warning, but the capsule's stored policy keeps 99. Item 10 of #197 found this.
Policy::validate in crates/common/src/policy.rs, and adjusted_level in crates/compression/src/lib.rs.
Proposed fix
Refuse a Zstd level outside -5..=22 and an LZ4 level outside the range the compressor uses, with a PolicyError naming the level and the range. spacectl already prints PolicyErrors as invalid policy file <name>.
Acceptance
A policy with an out-of-range level is refused before anything is written.
The levels in the default policies and docs examples still pass.
Fixed in 8c931d3, PR #249. Policy::validate now refuses LZ4 levels outside 1 to 16 and Zstd levels outside -5 to 22, naming the level and the range. spacectl create --policy-file fails before writing anything. The compressor's clamp reads the same ranges from common. Test fails without the check. Changelog updated. Closes when the PR merges.
Activity
saworbit commentedon Nov 15, 2026
Fixed in 8c931d3, PR #249. Policy::validate now refuses LZ4 levels outside 1 to 16 and Zstd levels outside -5 to 22, naming the level and the range. spacectl create --policy-file fails before writing anything. The compressor's clamp reads the same ranges from common. Test fails without the check. Changelog updated. Closes when the PR merges.