Skip to content

feat: add Java dynamic dedup agent#180

Open
officialasishkumar wants to merge 4 commits intokeploy:mainfrom
officialasishkumar:codex/java-dynamic-dedup
Open

feat: add Java dynamic dedup agent#180
officialasishkumar wants to merge 4 commits intokeploy:mainfrom
officialasishkumar:codex/java-dynamic-dedup

Conversation

@officialasishkumar
Copy link
Copy Markdown
Member

Related Issue

  • NA

Closes: NA

Describe the changes you've made

Adds Java dynamic dedup support to the SDK using the same Enterprise control/data socket protocol as Go, adapted to Java with JaCoCo TCP server mode.

  • Adds a fast background KeployDedupAgent that listens on /tmp/coverage_control.sock.
  • Handles per-testcase START <test-set>/<test-id> by resetting JaCoCo counters.
  • Handles matching END <test-set>/<test-id> by dumping/resetting JaCoCo execution data, analyzing app classes, sending {id, executedLinesByFile} to /tmp/coverage_data.sock, and ACKing Enterprise.
  • Starts the dedup agent from both the Java agent premain and Spring servlet middleware.
  • Replaces the old servlet dedup/YAML rewrite code with a pass-through filter plus dedup agent lifecycle.
  • Caches scanned class bytes and prioritizes KEPLOY_JAVA_CLASS_DIRS, target/classes, and build/classes/java/main for replay speed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How did you test your code changes?

  • mvn -B -DskipTests package
  • mvn -B -DskipTests -Dgpg.skip=true install -pl keploy-sdk -am
  • Docker Java 8 artifact build: maven:3.9.9-eclipse-temurin-8 mvn -B -DskipTests -Dgpg.skip=true package -pl keploy-sdk -am
  • Docker Java 21 full reactor build: maven:3.9.9-eclipse-temurin-21 mvn -B -DskipTests package
  • Live native socket handshake with the sample app: verified START, END, ACK, and app-only JSON coverage payload.
  • Live Docker Java 8 socket handshake with /tmp shared: verified ACK and app-only JSON coverage payload.
  • Live restricted Docker check with read-only rootfs, dropped capabilities, and no-new-privileges: verified ACK and app-only JSON coverage payload when the Enterprise data socket is writable.

No unit tests were added by request; validation is build, runtime socket, Docker, and CI sample coverage.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

Java dedup requires the application to run with JaCoCo in TCP server mode. The default endpoint is 127.0.0.1:36320, overrideable with KEPLOY_JACOCO_HOST and KEPLOY_JACOCO_PORT or JVM properties.

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas and used java doc.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Screenshots (if any)

NA

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar marked this pull request as ready for review April 23, 2026 16:41
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