Skip to content

fix: align dedup example with upstream end-of-stream semantics - #22

Merged
wrossmorrow merged 1 commit into
mainfrom
fix/dedup-example-alignment
Oct 28, 2026
Merged

wrossmorrow merged 1 commit into
mainfrom
fix/dedup-example-alignment

Conversation

@wrossmorrow-pi-bot

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the example-alignment review: resolves the remaining drift for the
dedup example processor (Milestone 4 tail), while leaving the echo/digest
differences noted during the review alone.

Drift found & fixed in DedupRequestProcessor

Comparing the Java example against the Go SDK's
examples/dedup.go revealed two drifts:

  1. Missing method gating. The Go dedup only applies to PUT, POST, and
    PATCH requests (dedupable). The Java version deduped regardless of method
    (as long as a digest header was present).
  2. Wrong decision phase. The Java version only performed the in-flight
    check/add during the request-headers phase, but the digest is only attached
    at end-of-stream phases (request body phase for requests with bodies — the
    primary dedup use case, i.e. PUT/POST/PATCH). The Go version decides at the
    end-of-stream phases. As a result, for bodied requests the in-flight cache
    could never be populated, and the 409 duplicate path could not fire.

Fix

Rewrote DedupRequestProcessor to mirror the upstream Go semantics:

  • Gate on method (PUT, POST, PATCH).
  • Compute the request digest at end-of-stream phases and decide
    (cache / cancel-with-409) there.
  • Add the x-extproc-request-digest header at end-of-stream.
  • Clear the in-flight entry when the stream completes (response phases).

Verification

  • ./gradlew clean build — BUILD SUCCESSFUL (spotless + tests).
  • Smoke-tested via the LoadGen against a server running the dedup processor
    (exchanges completed without errors).

Out of scope (left as-is per your direction)

  • echo example: minor path-matching (startsWith("/echo") vs regex
    /echo/.*) and response-shape differences.
  • digest example: extra x-extproc-response-digest header added in Java that
    the Go example does not add.

Closes the remaining Milestone 4 example-alignment item for dedup.

@wrossmorrow wrossmorrow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

YOLO

@wrossmorrow
wrossmorrow merged commit 8f39edb into main Oct 28, 2026
3 checks passed
@wrossmorrow
wrossmorrow deleted the fix/dedup-example-alignment branch October 28, 2026 17:29
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