You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build every tests/apply fixture through apply_fixture: 9 suites in the apply binary re-write the manifest, blob, package and event-lookup helpers it already has #1941
[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.
Kind: refactor. Register ID: T51. Follows the closed tracking issue #824 (shared CLI test helpers), scoped to one test binary.
Problem
tests/apply/apply_fixture.rs (L28-L94) has run_apply, patch_record, one_file, write_manifest, stage_blob, install_npm_pkg, write_root_package_json, install_gem and write_gem_patch. Other modules of the sameapply test binary write their own:
the rack@3.1.0 gem patch three more times: gem_stale_bundler_plugin.rs L40-L69,````````` in_process_gem_config_warning.rs L38-L76,`````````` in_process_gem_fallback_home.rs L32-L91,``````````` plus a fourth fallback-home fixture in apply_render.rs L304-L403;````````````
the event-by-purl lookup, identical, in bun_global_store.rs L124-L131,````````````` pnpm_global_virtual_store.rs L116-L123,`````````````` lockfile_only_skip.rs L150-L157,``````````````` cargo_lock_source.rs L137-L144 (common/envelope.rs has no by-purl finder);
link_dir identical in bun_global_store.rs L22-L37 and pnpm_global_virtual_store.rs L23-L38;
Drift: exportedAt 2024 vs common::write_minimal_manifest's 2026; index.js vs package/index.js; three gem copies hand-format the JSON; gem_stale_bundler_plugin.rs L75-L90```````````````` spawns without the Extra::Bundle scrub every other gem runner applies, so an ambient `BUNDLE_*` reaches that child. `apply_fixture::write_manifest` and `common::write_minimal_manifest` (common/mod.rs L320-L386) are themselves two writers for one shape.
Proposed change
Make apply_fixture the only fixture module of the apply binary: delete the local copies above and call its helpers; move the fallback-home human test from apply_render into in_process_gem_fallback_home.
Add event_for(&Value, purl) -> &Value to common/envelope.rs and link_dir to apply_fixture.
Implement apply_fixture::write_manifest/stage_blob on top of common::write_minimal_manifest/write_blob (add a records parameter there) so there is one manifest writer.
Drop the redundant telemetry env pairs.
Size
~11 files in tests/apply/ plus common/envelope.rs; roughly −450/+60 lines. No product code.
Acceptance criteria
cargo test -p socket-patch-cli --test apply passes with the same test count.
No fn write_manifest, fn stage_blob, fn event( or fn link_dir outside apply_fixture.rs / common/ in tests/apply/.
gem_stale_bundler_plugin's child gets the Extra::Bundle scrub.
[agent] Claiming this for the architecture refactor routine (highest-scoring structural item with free files: ~9 duplicated fixture writers in one test binary, risk L). Branch: arch-refactor/1941-apply-fixture. Claim-ID: 2026-11-01T16:56:10Z-384c6e
Activity
mikolalysenko commentedon Nov 1, 2026
[agent] Triage: priority:p3 (test-only refactor inside the
applytest binary). No open PR covers it; follows the closed tracking issue #824.Generated by Claude Code
mikolalysenko commentedon Nov 1, 2026
[agent] Claiming this for the architecture refactor routine (highest-scoring structural item with free files: ~9 duplicated fixture writers in one test binary, risk L). Branch: arch-refactor/1941-apply-fixture. Claim-ID: 2026-11-01T16:56:10Z-384c6e
Generated by Claude Code