Skip to content

C#: Add support for zstd compression and default to it - #23346

Merged
jketema merged 3 commits into
mainfrom
jketema/csharp-zstd-trap
Dec 4, 2026
Merged

jketema merged 3 commits into
mainfrom
jketema/csharp-zstd-trap

Conversation

@jketema

@jketema jketema commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

This makes things more uniform across extractors. The C# extractor is the last one defaulting to Brotli at the moment.

This is possible because .NET 11 now comes with Zstandard compression build in.

DCA shows about a 10% reduction in the disk spaces needed for TRAP files.

jketema and others added 2 commits December 3, 2026 10:53
Allow the trap.compression extractor option to select zstd while preserving the Brotli default. Emit .trap.zst files and test option parsing and compression round trips.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b72d8e74-03a1-42af-a982-5659fcb53469
Use zstd by default for both traced and standalone extraction, keeping Brotli available as an explicit option.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b72d8e74-03a1-42af-a982-5659fcb53469
@github-actions github-actions Bot added the C# label Dec 3, 2026
@jketema
jketema marked this pull request as ready for review December 4, 2026 10:27
@jketema
jketema requested a review from a team as a code owner December 4, 2026 10:27
Copilot AI adaptive review requested due to automatic review settings December 4, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Changing the default C# TRAP codec requires human confirmation of packaged .NET 11 Zstandard compatibility with CodeQL ingestion across supported platforms, beyond the local round-trip evidence.

No open issues 🎉

What changed in this PR

Adds Zstandard compression and makes it the C# extractor’s default TRAP format, aligning it with other extractors.

Changes:

  • Writes Zstandard-compressed TRAP files with the .trap.zst extension.
  • Updates the default compression and accepted configuration values.
  • Adds round-trip and option-parsing tests.
File Description
csharp/​extractor/​Semmle.Extraction.Tests/​TrapWriter.cs Tests Zstandard round trips for empty and Unicode content.
csharp/​extractor/​Semmle.Extraction.Tests/​Options.cs Tests the new default and explicit Zstandard options.
csharp/​extractor/​Semmle.Extraction.CSharp/​Extractor/​TrapWriter.cs Adds Zstandard compression and filename support.
csharp/​extractor/​Semmle.Extraction.CSharp/​Extractor/​CommonOptions.cs Defaults TRAP compression to Zstandard.
csharp/​codeql-extractor.yml Documents and accepts the zstd option.

Review effort: Balanced (adaptive)

@michaelnebel michaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent work! Should we consider adding a change-note?

@jketema

jketema commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Should we consider adding a change-note?

Good point. Yes.

@jketema

jketema commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Should we consider adding a change-note?

Good point. Yes.

Added in 60469f7

@michaelnebel michaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@jketema
jketema merged commit 617c8e9 into main Dec 4, 2026
22 checks passed
@jketema
jketema deleted the jketema/csharp-zstd-trap branch December 4, 2026 11:50
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.

3 participants