Skip to content

test: golden-dictionaries dict interop coverage#4

Merged
dfa1 merged 1 commit into
mainfrom
test/golden-dictionaries
Jun 26, 2026
Merged

test: golden-dictionaries dict interop coverage#4
dfa1 merged 1 commit into
mainfrom
test/golden-dictionaries

Conversation

@dfa1

@dfa1 dfa1 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Extends GoldenCorpusTest with a GoldenDictionaries nested suite driving zstd's vendored third_party/zstd/tests/golden-dictionaries/ corpus across the FFM/JNI boundary.

zstd's own playTests.sh pairs each golden dictionary with golden-compression/http and asserts a dict round-trip survives. We do the same, both directions:

  • java compress with dict → zstd-jni decode with same dict
  • zstd-jni compress with dict → java decode with same dict
  • dict id rides with the frameZstdFrame.dictId(frame) equals dict.id() and is non-zero

Parameterized over the corpus (currently http-dict-missing-symbols — the adversarial dictionary that omits symbols the entropy tables expect, id 1386686301). Submodule-gated like the sibling suites, so shallow clones still build.

Test

./mvnw -pl integration-tests -am test -Dtest=GoldenCorpusTest — 18 tests green (3 new), checkstyle clean.

🤖 Generated with Claude Code

Drive zstd's vendored golden-dictionaries corpus across the FFM/JNI
boundary, mirroring zstd's own regression pairing (the dictionary against
golden-compression/http):

- java compress with dict -> zstd-jni decode with same dict
- zstd-jni compress with dict -> java decode with same dict
- dict id rides with the frame (ZstdFrame.dictId == dict.id, non-zero)

Parameterized over the corpus, submodule-gated like the sibling suites, so
shallow clones still build. Covers http-dict-missing-symbols, the
adversarial dictionary that omits symbols the entropy tables expect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 merged commit bce47a8 into main Jun 26, 2026
1 check passed
@dfa1 dfa1 deleted the test/golden-dictionaries branch June 26, 2026 15:17
dfa1 added a commit that referenced this pull request Jun 26, 2026
…tinels (#22)

Follow-ups from the code-quality inspection:

- Thread-safety docs (#2): document the four streams as not thread-safe
  (confine to one thread) and the two digested dictionaries as immutable
  and safe to share across threads.
- Null validation (#3): fail fast with a named NullPointerException on
  public byte[]/dictionary/sample/stream arguments instead of an opaque
  NPE deep in native code. requireNative now also rejects null, covering
  every MemorySegment entry point.
- Sentinel DRY (#4): one definition of CONTENTSIZE_UNKNOWN/_ERROR in Zstd,
  reused by ZstdFrame and ZstdFrameHeader (drops a duplicate and the
  CONTENT_SIZE_ERROR naming drift).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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