Skip to content

fix(writer): reject enableZstd=true with allowedCascading=0 - #366

Open
dfa1 wants to merge 2 commits into
mainfrom
fix/write-options-zstd-cascading-guard
Open

fix(writer): reject enableZstd=true with allowedCascading=0#366
dfa1 wants to merge 2 commits into
mainfrom
fix/write-options-zstd-cascading-guard

Conversation

@dfa1

@dfa1 dfa1 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

A user-reported bug (real-world feedback on 0.14.0): WriteOptions.defaults().withZstd(true) produces byte-for-byte identical output to WriteOptions.defaults() — enabling Zstd is a complete silent no-op at the default cascading depth.

Root cause: WriteOptions.enableZstd only feeds VortexWriter's cascadeCodecs list (via buildCascadeCodecs), and that list is only ever consulted inside a CascadingCompressor, which VortexWriter.writeSegment only builds when allowedCascading() > 0. WriteOptions.defaults() sets allowedCascading=0, so there is no code path by which enableZstd(true) can affect a write at the defaults. Confirmed this isn't an edition-guard interaction: vortex.zstd is part of the default CORE_2026_08_0 edition.

Fix

  • WriteOptions's compact constructor now throws IllegalArgumentException when enableZstd=true and allowedCascading=0, so the mistake fails loudly at options-construction time instead of writing plain files with zero signal to the caller.
  • Updated javadoc on the enableZstd record component and withZstd(boolean) to document the requirement and point at WriteOptions.cascading(depth).withZstd(true).
  • Updated docs/reference.md's WriteOptions method table.
  • Added WriteOptionsTest coverage for both the rejection and the valid cascading(depth).withZstd(true) combination.

Every existing withZstd(true) call site in the repo (JavaWritesRustReadsIntegrationTest, FileSizeComparisonIntegrationTest, TaxiLayoutInspector) already pairs it with cascading(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 new WriteOptionsTest cases
  • ./mvnw -pl writer -am package -DskipTests javadoc:javadoc -fae — no javadoc errors/dangling refs

🤖 Generated with Claude Code

https://claude.ai/code/session_01LjU7zWghUiJauRxK58nyUs

dfa1 and others added 2 commits September 4, 2026 20:30
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant