Repository navigation
Build tests/apply fixtures through apply_fixture (#1941) - #1944
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Nine suites of the apply test binary wrote their own manifest, blob, npm package, gem and event-lookup helpers beside apply_fixture's. They now call apply_fixture (one_file/hashed_file, write_manifest, stage_blob, install_npm_pkg, install_gem, write_gem_patch, link_dir) and common::envelope::event_for. stage_blob writes through common::write_blob. The four gem runners share apply_fixture::run_gem, so gem_stale_bundler_plugin's child now gets the BUNDLE_* scrub the others had. The fallback-home human test moves next to its --json twin and reuses its fixture. apply_invariants compares .socket/ snapshots instead of a digest plus two byte checks. The explicit SOCKET_TELEMETRY_DISABLED=1 pairs, which hermetic::command forces, are gone. Assisted-by: Claude Code:claude-opus-5-5
Gem suites that pin --cwd run their child from the runner's directory again, so a crawler reading the process cwd still fails them. apply_invariants runs apply through apply_fixture::run_apply, the --cwd remedy test stages its blob with stage_blob, and the gem --check fixture derives its specifications dir from install_gem's path. bun_global_store and lockfile_only_skip build their records through one index_js_patches helper. apply_network passes bytes to one_file instead of precomputed hashes. Stale module docs updated. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
There was a problem hiding this comment.
✅ 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 e89dde2. Configure here.
|
[agent] This PR doesn't cause it:
I've re-run the failed jobs once. If it is still red, the 403 is coming from the hosted service and needs someone with access to patch.socket.dev to look. Generated by Claude Code |
|
[burn-down agent] Labeled Ready for review at e89dde2.
Generated by Claude Code |
Final review briefWhat it does. Test-only refactor of the Risk: low. Only test code changes. The Look here
Verified
Changes I made: none. Open questions (non-blocking)
Auto-merge is armed, so approving sends this PR straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed e89dde25d2df9c54179e7fb3067a32ccbb00eecf. Checked common apply fixtures/runners and preserved offline, scope, per-copy and installed-tree assertions. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1941
Summary
Nine suites of the
applytest binary each wrote their own manifest, blob, npm-package, gem and event-lookup helpers besideapply_fixture's (register row T51, Part 5 of the living document). They now build every fixture throughapply_fixture, and the event-by-purl lookup lives incommon/envelope.rs. The PR changes only tests; there is no product code in it.Changes
apply_fixture.rshashed_file(one_filefrom hashes) andindex_js_patches(onepackage/index.jsrecord per purl).link_dirmoved here from the two global-store suites.run_gem:run_with_env's env plus theBUNDLE_*scrub.run_gem_applyis built on it.stage_blobwrites throughcommon::write_blob.common/envelope.rs: newevent_for(envelope, purl), replacing 4 identical privateeventfns.apply_network.rs:write_npm_package,write_root_package_json,write_manifest_with_patchand 8 hand-staged blobs.apply_invariants.rs:MANIFEST_JSON, two hand-formatted manifests,dir_hash+collect_files(the file already hadsnapshot_dir), and its privaterun_apply.bun_global_store.rs,pnpm_global_virtual_store.rs:link_dir,write_manifest,event.cargo_lock_source.rs,check_verifies_installed_tree.rs,lockfile_only_skip.rs:write_manifest/record/projectwriters,install_npm_pkg,run_apply,run_cargo_apply,store_after_blob,event.gem_stale_bundler_plugin.rs,in_process_gem_config_warning.rs,in_process_gem_fallback_home.rs: their hand-formatted rack manifests and runners.apply_render.rsintoin_process_gem_fallback_home.rs, where it reuses that file's fixture. Its assertions are unchanged.Extra::Bundlescrub, as the issue asks.SOCKET_TELEMETRY_DISABLED=1pairs dropped:hermetic::commandforces that value already.apply_network's=0opt-in stays.apply_does_not_mutate_socket_dir_offlineandapply_does_not_mutate_socket_dir_when_no_packages_matchnow compare.socket/path→bytes snapshots. They used to compare a digest and then re-check two files ("belt-and-suspenders against a dir_hash blind spot"); the snapshot has no such blind spot. Red→green: writing one byte into the sentinel after the run fails the test at the snapshot assert.Size
git diff --stat: 13 files, +410 / −1,045, all of it test code. Production lines: 0.Behavior change
None in the product. In the tests:
jvm_env::isolate_cli(stand-inHOME), as everyrun_with_envchild already does.apply_invariants' children get the same isolation throughrun_apply.exportedAtare now the fixture's..socket/blobs/dir now get an empty one./code-review high
It reported 10 findings; I fixed 9:
--cwd(config_warning,fallback_home) run from the runner's dir again.apply_invariantsuses the sharedrun_apply.store_after_blobwas replaced bystage_blob.install_gem's path.write_patchescopies were merged intoindex_js_patches.apply_networkusesone_file.I did not fix one: "
run_gemcopiesrun_bin_with_env's body to insert the scrub." The fix would add anextrasparameter tocommon::run_bin_with_env, which has 100+ callers across binaries. That belongs to T55/#1089, not this PR.Not done from the issue: step 3's single manifest writer (
write_manifeston top ofcommon::write_minimal_manifest). That writer takes one purl and has 100+ callers in other binaries, so giving it a records parameter goes beyond this binary. Onlystage_blobwas unified.Verification
cargo test -p socket-patch-cli --test apply: 157 passed.vlt_hosted_common/prebuilt_commonare untouched, and CI's clippy does not lint tests.CI
79 of 81 checks and Bugbot are green.
hosted-e2e(and theci-okaggregate) is red:e2e_hosted_production::bun_hosted_install_proofgets a 403 from the livepatch.socket.devforminimist-1.2.2.tgz, on 3 attempts in each of two runs. That test binary is not in this diff, and the same check passed on #1939 at 15:12Z.Risk
Low: tests only.
https://claude.ai/code/session_011f9aeSfw2PKstyBdKzjUFz
Generated by Claude Code