Skip to content

Bench: cover Gradle hosted mode (gradle/hosted, gradle/rescan) - #925

Open
Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
bench/refresh
Open

Mikola Lysenko (mikolalysenko) wants to merge 2 commits into
mainfrom
bench/refresh

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

What main changed. #646 (0685ba8c) added full Gradle support, including hosted mode. scan now crawls Gradle's modules-2/files-2.1 cache under GRADLE_USER_HOME and pins the suffixed versions in gradle.lockfile. It wires the build through an owned settings script and index under .socket/gradle/. The suite had no Gradle scenario: maven/* only covers the pom.xml + ~/.m2 path.

Suite changes

  • Added gradle/hosted and gradle/rescan. The project is a single-project Groovy-DSL build with dependencyLocking: 1000 locked artifacts, 25 of them patched direct deps. Its cache lives under the fixture's GRADLE_USER_HOME, with jar and pom in separate sha1 hash dirs. The scenarios expect these rewrites: .socket/gradle/{.gitattributes,hosted-index.tsv,socket-patch.hosted.settings.gradle}, gradle.lockfile and settings.gradle. The only allowed warning is redirect_gradle_detached_configs_unguarded, which the planner always emits.
  • The grant's indexUrl is https://patch.socket.dev/..., not the mock. The Gradle planner refuses non-https repositories (redirect_gradle_override_invalid), and a scan never fetches the index. The artifact URL still points at the mock.
  • Refactor, no behavior change. maven and gradle now share the Maven-coordinate generator, the pom writer and the maven2 grant builder. The maven fixture bytes are unchanged: I built maven/hosted with the old and new bench binaries and diff -r showed them identical.
  • README: lists gradle and GRADLE_USER_HOME.

Validation (all runs against the main CLI 9c43dfc9, on a 4 vCPU Xeon @ 2.10GHz)

  • cargo fmt -p socket-patch-bench, cargo clippy -p socket-patch-bench --all-features --all-targets -- -D warnings and cargo test -p socket-patch-bench (29 passed) are all clean.
  • run -f '^gradle/' --runs 3: gradle/hosted 170.5 ms (0.17 ms/pkg), gradle/rescan 259.2 ms. Both validate with 53 requests each.
  • A/A compare -f '^gradle/' -f '^maven/' (head binary vs a copy of itself): no regressions. gradle/hosted -1.1%, gradle/rescan +4.5%, maven/hosted -1.6%, maven/rescan +1.7%.
  • strace -f -e trace=execve on the serve gradle/hosted command: the CLI spawns nothing; the only execves are the shell, env and socket-patch itself. The rewritten gradle.lockfile carries <v>-socket.<uuid8> pins, and settings.gradle gains the apply from: line.

Time budget: compare grows by about 2 × 0.4 s per pair. A full compare took about 13 min on this runner both before and after, so the change is within noise. Nothing was removed.

🤖 Generated with Claude Code

https://claude.ai/code/session_014cKiDSpASodTewYpmHqEnG


Generated by Claude Code


Note

Low Risk
Primarily benchmark fixtures and digest helper consolidation; Maven fixture output is explicitly parity-checked, with no intended runtime behavior change in core.

Overview
Adds Gradle to the socket-patch bench suite (gradle/hosted and gradle/rescan) so hosted-mode rewrites—.socket/gradle/*, gradle.lockfile, settings.gradle—and crawling of GRADLE_USER_HOME’s modules-2/files-2.1 cache are covered in CI. The Gradle fixture uses dependency locking (~1000 artifacts, ~25 patched), sets GRADLE_USER_HOME on the fixture tree, and uses an https patch-registry indexUrl (Gradle’s planner rejects non-https repos) while artifact URLs still hit the mock.

Maven and Gradle fixtures now share Maven-coordinate generation, POM writing, and maven2 grant construction (jvm_universe, jvm_pom, jvm_patch); Maven bytes are intended to stay identical. README lists gradle and documents isolated GRADLE_USER_HOME in the harness env.

In socket-patch-core, SHA-1/SHA-256 hashing in Gradle cache, JVM jar patching, and Maven sidecars is routed through utils::digest::{sha1_hex_of, sha256_hex_of} (refactor only).

Reviewed by Cursor Bugbot for commit bb74cac. Configure here.


Generated by Claude Code

#646 gave Gradle builds a hosted mode: scan crawls Gradle's
modules-2/files-2.1 cache, pins suffixed versions in gradle.lockfile
and wires the build through an owned settings script and index under
.socket/gradle/. None of that was benchmarked; the maven scenarios
only reach the pom.xml + ~/.m2 path.

The gradle fixture is a single-project Groovy build with dependency
locking (1000 locked artifacts, 25 patched direct deps), its cache
under the fixture's GRADLE_USER_HOME with jar and pom in separate
sha1 dirs. The Maven-coordinate generator, pom writer and maven2
grant builder are shared with the maven fixture, whose bytes are
unchanged. The grant's indexUrl is https because the Gradle planner
refuses anything else; scan never fetches it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mikolalysenko Mikola Lysenko (mikolalysenko) added the bench socket-patch scan benchmark suite label Oct 6, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

main has failed socket-patch-core's lib tests since Gradle support
(#646) and the digest helpers (#865) both landed. The guard test
production_digests_go_through_the_helpers flags three files #646 added
that still hash inline: crawlers/gradle_cache.rs, patch/jvm_jar.rs and
patch/sidecars/maven.rs. That breaks test, test-release and coverage on
every open PR.

Each inline sha1/sha256 call now goes through sha1_hex_of or
sha256_hex_of, which compute the same lowercase hex. Behaviour is
unchanged.

Assisted-by: Claude Code:claude-opus-5-5
(cherry picked from commit 659ac2c)
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] Bench: coverage failed on 9b5c5491 because of main, not this PR.

utils::digest::tests::production_digests_go_through_the_helpers fails because #865 (digest helpers) and #646 (Gradle) crossed. Gradle added inline digests in crawlers/gradle_cache.rs, patch/jvm_jar.rs and patch/sidecars/maven.rs. The same test is red in main's CI on 9c43dfc9.

The fix is open as #878. I cherry-picked its single commit here (659ac2c2, with -x) so this PR can go green. It becomes a no-op once #878 merges. Locally, cargo test -p socket-patch-core --lib digest (21 passed) and cargo clippy -p socket-patch-core --lib -D warnings are both clean.


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bb74cac. Configure here.

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 6, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Burn-down agent: labeled Ready for review.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bench socket-patch scan benchmark suite Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants