Skip to content

rfc9842: extract DczCodec, fixing decodeDcz duplication - #124

Merged
dfa1 merged 4 commits into
mainfrom
rfc9842-dcz-codec
Sep 18, 2026
Merged

dfa1 merged 4 commits into
mainfrom
rfc9842-dcz-codec

Conversation

@dfa1

@dfa1 dfa1 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #122.

  • DczTestServer.compressDcz and the byte-for-byte-identical decodeDcz duplicated in Rfc9842ClientDemo and PerfTestDemo now live as DczCodec.compress/decompress — one shared Arena-based codec instead of three separate copies.
  • The compress/decompress pair is named and shaped as actual counterparts of each other (compress/decompress, identical parameter order: bytes, context, digested dictionary, AvailableDictionaryHeader) — the previous compressDcz/decodeDcz naming didn't even share a verb root, and their parameter orders didn't match.
  • Removed now-dead imports (Arena, MemorySegment, JAVA_BYTE, Rfc9842Frame, ZstdFrame, ZstdByteSize) from the three files that no longer touch native memory directly for this.

Test plan

  • mvn -pl rfc9842 test — full suite passes
  • mvn -pl rfc9842 validate javadoc:javadoc — checkstyle + javadoc clean
  • Whole-repo mvn test-compile — clean (learned from the last PR not to scope verification to one module)
  • End-to-end smoke test: ServerDemo + Rfc9842ClientDemo (dcz round trip decodes correctly) and PerfTestDemo (byte counts match the pre-refactor baseline exactly: dcz 263.3 avg bytes/req)

🤖 Generated with Claude Code

DczTestServer.compressDcz and the byte-for-byte-identical decodeDcz
duplicated in Rfc9842ClientDemo and PerfTestDemo now live as
DczCodec.compress/decompress -- one shared Arena-based codec instead of
three copies, and named/shaped as actual counterparts of each other
(compress/decompress, same parameter order: bytes, context, digested
dictionary, AvailableDictionaryHeader) rather than the previous
compressDcz/decodeDcz pairing, whose verbs and parameter order didn't
match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 force-pushed the rfc9842-dcz-codec branch from fc4edcf to f2e9ed9 Compare September 17, 2026 20:26
dfa1 and others added 3 commits September 17, 2026 22:40
…undary

noClasses().should().dependOnClassesThat().resideInAnyPackage(java.net..,
java.nio.channels.., javax.net..) over the module's target/classes --
the layer-1 dcz codec (Rfc9842Frame, the header types, Sfv,
Rfc9842Negotiation) is meant to be pure framing/parsing/hashing with no
socket of its own, with the actual HTTP client/server confined to the
test-only demo package. Verified the rule actually fails by temporarily
importing java.net.URI into DictionaryIdHeader, then reverted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The only existing mention of zstd-rfc9842 was a one-line pointer at the
demo classes -- no Maven coordinate, no code showing the actual public
API (Rfc9842Frame.wrap/unwrap, AvailableDictionaryHeader,
UseAsDictionaryHeader, Rfc9842Negotiation). Adds a server/client
quickstart in the same style as the top-level Quickstart section, and
notes the sans-io boundary the new ArchUnit rule enforces.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The README's RFC 9842 section carried the how-to walkthrough, the type
reference, and the sans-io rationale all in one place -- everything the
Diátaxis-organized docs/ set exists to split apart, and rfc9842 had zero
coverage there. Moves the server/client code to a how-to.md recipe, the
type table and Maven coordinate to reference.md, and the sans-io/one-type
rationale to explanation.md; README keeps a short paragraph pointing into
both.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 merged commit d570ff3 into main Sep 18, 2026
1 check passed
@dfa1
dfa1 deleted the rfc9842-dcz-codec branch September 18, 2026 05:39
dfa1 added a commit that referenced this pull request Sep 18, 2026
The Unreleased rfc9842 entry covered the module's introduction but not
what #124 added on top: the ArchUnit rule enforcing no java.net/
java.nio.channels/javax.net dependency, and the how-to/reference/
explanation docs.

Co-Authored-By: Claude Sonnet 5 <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.

Rfc9842ClientDemo.decodeDcz and PerfTestDemo.decodeDcz are byte-for-byte duplicated

1 participant