Skip to content

Bench: serve yarn classic tarballs; allow NuGet stale-cache warning - #1422

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
bench/refresh
Oct 12, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
bench/refresh

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

What main changed

Two merged changes in f3c6313a..17793173 broke three scenarios' validation on main:

Both are correct new behavior. Neither is a CLI bug.

Suite changes

  • Updated, npm fixtures: artifact_bytes is now a real, deterministic npm .tgz (package/package.json with the installed copy's dependencies, so nothing new needs locking, plus package/index.js; fixed mtimes and modes). A shared serve_artifacts helper serves it for both vlt (sha512 preflight, as before) and yarn classic (the Fix fragmentless yarn classic hosted pins (#558) #1328 fetch). yarn-classic/hosted now expects 187 requests (127 + 60 tarballs). yarn-classic/rescan stays at 127, because its pins are already in place.
  • Updated, nuget fixture: allows redirect_nuget_stale_global_package. A freshly restored project really does hold the unpatched copies, and NuGet would restore them ahead of the Socket source, so the warning is right.
  • Deps: adds tar and flate2 to the bench crate. Both are already workspace-pinned, so Cargo.lock only gains the bench package's two dependency lines.
  • Added or removed scenarios: none.

Validation

  • 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.
  • A full run on main 17793173 validates 45/45 scenarios (it was 41/45 without this PR).
  • A/A compare (head vs. a copy of head, 8 pairs) on yarn-classic/*, nuget/* and vlt/* shows no regressions; every row is ≈.
  • strace -f -e trace=execve on yarn-classic/hosted: the CLI spawns nothing.
  • A base binary from before Fix fragmentless yarn classic hosted pins (#558) #1328 still validates yarn-classic/* (it just doesn't fetch the tarballs), so the CI gate's A/B keeps working across the change.

Time budget

No new scenarios. yarn-classic/hosted takes about 0.27 s more per run. That's the CLI regression tracked in the linked issue, not the fixture. Fixture build time is unchanged within noise.

Related

The daily bench run found confirmed regressions in this range. They are filed separately and this PR doesn't fix them: yarn-classic (#1328), golang (#1403) and nuget.

🤖 Generated with Claude Code

https://claude.ai/code/session_01La9tujwhm1nYeFya6EL1DF


Generated by Claude Code


Note

Low Risk
Changes are limited to benchmark fixture mocks and expected warnings; no production CLI or scan logic is modified.

Overview
Updates the socket-patch-bench harness so validation matches recent CLI behavior: yarn classic hosted pins now fetch served patch tarballs, and NuGet hosted scans warn when unpatched copies already sit in the global package cache.

npm fixtures: Patched-package mock artifacts are no longer placeholder bytes—they are deterministic gzip .tgz archives with package/package.json (shared via manifest_json) and package/index.js, so sha512 checks and tarball package.json reads behave like production. A shared serve_artifacts registers those bytes at each grant URL for both yarn classic and vlt (replacing the vlt-only inline loop).

NuGet fixture: The scenario now allows the redirect_nuget_stale_global_package warning, which matches a restored project that still has unpatched packages under ~/.nuget/packages.

Dependencies: Adds workspace tar and flate2 to socket-patch-bench only.

Reviewed by Cursor Bugbot for commit a05f705. Configure here.


Generated by Claude Code

yarn classic's hosted pin now downloads each served tarball, checks it
against the grant's sha512 and reads its package.json before pinning
(#1328: #558 sha1 fragment, #591 unlocked-dep refusal). The mock did
not serve those URLs, so yarn-classic/hosted and /rescan failed
validation with 60 unexpected GETs. The fixture now serves a real,
deterministic .tgz per patched package (package/package.json with the
installed copy's dependencies, so nothing needs locking); vlt's
preflight shares the same bytes.

The restored nuget fixture keeps every patched package's unpatched
copy in ~/.nuget/packages, which NuGet would restore ahead of the
Socket source. Since #1344 (#352) the scan warns
redirect_nuget_stale_global_package for each one, which is correct for
a freshly restored project, so the scenario now allows that code.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01La9tujwhm1nYeFya6EL1DF
@mikolalysenko Mikola Lysenko (mikolalysenko) added the bench socket-patch scan benchmark suite label Oct 12, 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.

✅ 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 a05f705. Configure here.

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

Copy link
Copy Markdown
Collaborator Author

Ready for review (burn-down agent)


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Final review brief

What it does: Bench-harness-only fix. Since #1328, yarn classic's hosted pin downloads each served tarball and reads its package.json, and since #1344 a hosted NuGet scan warns redirect_nuget_stale_global_package; the bench mock didn't serve the tarballs or allow the warning, so 4 scenarios validated as INVALID on main. This serves real, deterministic npm tarballs for yarn classic and vlt, and allows the NuGet warning.

Risk: low. Only crates/socket-patch-bench changes; no CLI or core code. The two new deps (tar, flate2) are already workspace-pinned, so Cargo.lock only gains two dependency lines.

Look here:

  • npm.rs#L239: artifact_bytes now builds a real .tgz (fixed mtime/mode; gzip header mtime defaults to 0, so bytes are deterministic and the grant's sha512 stays stable)
  • npm.rs#L264: shared serve_artifacts, now used by yarn classic (L579) as well as vlt (L862)
  • other.rs#L719: NuGet fixture allows the stale-global-package warning

Verified: read the full diff. The vlt preflight sha512 (sri_of(&artifact_bytes(p))) and the served bytes still come from the same function, so they can't drift. cargo test -p socket-patch-bench passes locally (29/29). CI ci-ok and clippy are green on a05f705. Bugbot reviewed this head with no findings. No unresolved threads, and CHANGELOG.md is untouched.

Changes I made: none.

Open questions: none.

Auto-merge is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

Merged via the queue into main with commit cc841a1 Oct 12, 2026
54 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the bench/refresh branch October 12, 2026 16:11
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