fix(writer): reject enableZstd=true with allowedCascading=0 - #366
Open
dfa1 wants to merge 2 commits into
Open
Conversation
WriteOptions.defaults().withZstd(true) silently produced the exact same output as defaults() — Zstd is only ever added to the cascade codec list, and VortexWriter only builds a CascadingCompressor (the only place that list is consulted) when allowedCascading > 0. At depth 0 the flag had no code path to reach. The compact constructor now rejects enableZstd=true combined with allowedCascading=0, failing fast at WriteOptions construction instead of writing plain files with no signal to the caller. All existing withZstd(true) call sites already pair it with cascading(depth), so this is not a breaking change in practice. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjU7zWghUiJauRxK58nyUs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LjU7zWghUiJauRxK58nyUs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A user-reported bug (real-world feedback on 0.14.0):
WriteOptions.defaults().withZstd(true)produces byte-for-byte identical output toWriteOptions.defaults()— enabling Zstd is a complete silent no-op at the default cascading depth.Root cause:
WriteOptions.enableZstdonly feedsVortexWriter'scascadeCodecslist (viabuildCascadeCodecs), and that list is only ever consulted inside aCascadingCompressor, whichVortexWriter.writeSegmentonly builds whenallowedCascading() > 0.WriteOptions.defaults()setsallowedCascading=0, so there is no code path by whichenableZstd(true)can affect a write at the defaults. Confirmed this isn't an edition-guard interaction:vortex.zstdis part of the defaultCORE_2026_08_0edition.Fix
WriteOptions's compact constructor now throwsIllegalArgumentExceptionwhenenableZstd=trueandallowedCascading=0, so the mistake fails loudly at options-construction time instead of writing plain files with zero signal to the caller.enableZstdrecord component andwithZstd(boolean)to document the requirement and point atWriteOptions.cascading(depth).withZstd(true).docs/reference.md'sWriteOptionsmethod table.WriteOptionsTestcoverage for both the rejection and the validcascading(depth).withZstd(true)combination.Every existing
withZstd(true)call site in the repo (JavaWritesRustReadsIntegrationTest,FileSizeComparisonIntegrationTest,TaxiLayoutInspector) already pairs it withcascading(depth), so this is not a breaking change in practice — it only rejects a combination that was already useless.Test plan
./mvnw -pl writer -am test— all writer tests pass, including newWriteOptionsTestcases./mvnw -pl writer -am package -DskipTests javadoc:javadoc -fae— no javadoc errors/dangling refs🤖 Generated with Claude Code
https://claude.ai/code/session_01LjU7zWghUiJauRxK58nyUs