Skip to content

refactor: remove obsolete vendoring machinery and duplicate crate code - #1279

Merged
Mikola Lysenko (mikolalysenko) merged 5 commits into
mainfrom
refactor/crate-bloat-cleanup
Oct 9, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 5 commits into
mainfrom
refactor/crate-bloat-cleanup

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

Vendoring still carried local-build fallback machinery after acquisition became service-only, including impossible result branches and unused inputs threaded through multiple backends. The crates also repeated archive validation, restore helpers, ledger initializers, and test setup.

Remove 2,133 net Rust lines across 73 files (1,410 added / 3,543 deleted). Public entry-point signatures, ledger serialization, refusal diagnostics, and artifact integrity checks are preserved.

  • Replace custom service-result enums, aliases, and conversion wrappers with Result; remove unused local-build arguments, request fields, and impossible branches.
  • Delete dormant archive-validation modes and the unused Gradle removal helper; exercise the real extractors in the retained malformed-archive and layout tests.
  • Share ledger construction, fifteen vendoring fixture adapters, upstream restore helpers, staging cleanup, XML attribute parsing, and benchmark setup.
  • Simplify CLI dispatch and preview logic, ecosystem matching, and Node serialization; remove stale fallback documentation. Consolidate four duplicate service-configuration tests into the retained stricter cases, preserving their assertions and independent safety oracles.

Validation against current main (a8e9397fe):

  • 8,143 tests passed: 7,020 core/CLI unit tests, 1,030 CLI integration tests, 50 upstream restore golden tests, 29 benchmark tests, and 14 Node smoke tests against a rebuilt addon.
  • CLI integration coverage includes get, vendoring, repair, rollback, and VEX/lockfile behavior.
  • cargo check --locked --workspace --all-targets --all-features passed.
  • CI lint command cargo clippy --locked --workspace --all-features -- -D warnings passed.
  • Changed-file rustfmt checks and git diff --check passed.

CHANGELOG.md is untouched.


Note

Medium Risk
Vendoring no longer falls back to local builds when prebuilts are missing, which changes runtime behavior for --vendor-source=auto users; hosted get release narrowing moved earlier but should be equivalent.

Overview
Large cleanup that makes vendoring acquisition service-only and deletes duplicated helpers across the Rust workspace (~2k net lines removed).

Vendoring backends (cargo, composer, gem, golang, npm dir/tarball, maven, nuget, etc.) no longer thread local-install / patch-apply fallbacks: custom ServiceAttempt enums become Result, ServicePolicy drops auto vs service branching, and VendorServiceConfig::service_enabled() only checks offline + API client. Staging paths like stage_patch_dir and materialise_patched_copy require a verified prebuilt artifact or refuse.

Shared construction and restore plumbing: VendorEntry::new replaces hand-built ledger structs in production and tests; benchmark fixtures get one fixture() in mod.rs; upstream restore helpers (by_uuid, read_or_refuse, refuse_all_in) move to upstream/mod.rs; Ivy parsing reuses formats::xml::attr; cleanup_failed_stage is centralized in vendor/common.

CLI behavior tweaks: get runs filter_to_installed_releases once for hosted and agent dry-run previews (removing the duplicate hosted block); vendor dispatch simplifies ecosystem/service checks and nuget/maven source passing. Minor ecosystem parsing/display simplifications and removal of unused Gradle remove_apply_line.

Reviewed by Cursor Bugbot for commit 2b43a69. Configure here.


Generated by Claude Code

Replace service-only result wrappers with Result, remove dead local-build parameters and impossible branches, and share ledger construction and vendoring fixtures. Preserve public entry-point signatures, refusal diagnostics, extraction checks, and independent test oracles.
@mikolalysenko Mikola Lysenko (mikolalysenko) changed the title refactor: remove crate bloat and obsolete vendoring machinery refactor: remove obsolete vendoring machinery and duplicate crate code Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 14:58

@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.

Comment thread crates/socket-patch-core/src/vendor/service_fetch.rs
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) removed this pull request from the merge queue due to a manual request Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 9, 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 2b43a69. Configure here.

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

Copy link
Copy Markdown
Collaborator Author

Ready for review (burn-down agent).


Generated by Claude Code

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) removed this pull request from the merge queue due to a manual request Oct 9, 2026
Resolve conflicts with #1026 (credential redaction) and #1283 (Bun
restore user registry config):

- vendor/{cargo,composer_lock,gem,golang,npm_common,npm_dir,pypi,
  service_fetch}.rs: keep this branch's Result-based service fast paths
  and route the vendor_prebuilt_downloaded advisory through main's single
  VerifiedArchive::downloaded_warning builder.
- patch/redirect/upstream/bun_lockb.rs: keep by_uuid/refuse_all_in from
  upstream/mod.rs (where this branch moved them) and import main's
  BunConfigOrder from upstream/npm.rs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit dcdc104 Oct 9, 2026
53 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the refactor/crate-bloat-cleanup branch October 9, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants