Skip to content

zstd: Default to full zero frames#1134

Merged
klauspost merged 1 commit intomasterfrom
zstd-full-zero-frames
Mar 18, 2026
Merged

zstd: Default to full zero frames#1134
klauspost merged 1 commit intomasterfrom
zstd-full-zero-frames

Conversation

@klauspost
Copy link
Copy Markdown
Owner

@klauspost klauspost commented Mar 18, 2026

Probably easiest to reference this: klauspost/stdgozstd#1

The decoder still accepts both.

Summary by CodeRabbit

  • Bug Fixes
    • Improved encoder default configuration to properly handle zero-length inputs by generating complete frames, enhancing zstandard compression compatibility and ensuring consistent behavior across all input scenarios.

Probably easiest to reference this: klauspost/stdgozstd#1

The decoder still accepts both.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

📝 Walkthrough

Walkthrough

The change adds initialization of the fullZero field set to true in the default encoder options. This sets the default behavior for encoding zero-length input as complete zstandard frames within the setDefault() method of the encoderOptions struct.

Changes

Cohort / File(s) Summary
Encoder Options Configuration
zstd/encoder_options.go
Added fullZero: true initialization to the setDefault() method, enabling full frame encoding for zero-length input by default.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'zstd: Default to full zero frames' directly describes the main change: adding fullZero: true to encoder defaults for full zero frame encoding.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zstd-full-zero-frames
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/encoder_options.go`:
- Line 45: The empty-frame fast path currently forces Checksum: false even
though fullZero (default true) and crc default may indicate checksums should be
emitted; update the empty branch in EncodeAll (the branch around the empty input
in encoder.go) to propagate the encoder option for crc/checksum instead of
hard-coding false — i.e., read the encoder's checksum/crc option (the same
setting controlled by fullZero/crc) and set Checksum accordingly when
constructing the empty frame response so the advertised checksum behavior
matches non-empty paths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9d96f758-617a-431d-a265-7aa57c35a8d9

📥 Commits

Reviewing files that changed from the base of the PR and between bcf0d12 and 3efde7b.

📒 Files selected for processing (1)
  • zstd/encoder_options.go

Comment thread zstd/encoder_options.go
@klauspost klauspost merged commit fd3f23e into master Mar 18, 2026
22 checks passed
@klauspost klauspost deleted the zstd-full-zero-frames branch March 18, 2026 17:42
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