Skip to content

vendor --force documents a missing-file tolerance and a mismatch warning that no vendored backend implements #923

Description

[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: discussion #560 register.

Kind: refactor (dead parameters + stale help/contract text; no behavior change). Source: new finding (extends review 5.2, which noted three backends ignoring _sources/_force); register E65.

Problem (verified on 9c43dfc)

Since vendored acquisition became service-only, every vendored backend threads force: bool and sources: &PatchSources down to a sink that discards both. Every sink is underscore-named:

All other uses of force and sources under vendor/ are pass-throughs to these sinks.

The user-facing documentation still describes the removed behavior:

  • The vendor --force help (commands/vendor.rs#L71-L84) and the contract's flag row (CLI_CONTRACT.md#L89) say it "tolerate[s] missing patch-target files in the stage". The only live effect of force is the CLI's variant-probe bypass (#L2060, #L2503).
  • Both texts, and the error-code table (CLI_CONTRACT.md#L1234), promise a vendor_content_mismatch_overwritten warning. No production code emits it; the string appears only in that doc comment and in tests that assert its absence. The test docs of mismatched_install_does_not_change_the_server_artifact (in_process_vendor.rs) and scan_vendor_annotates_mismatched_baseline_and_vendors_anyway (scan_vendor_e2e.rs) still describe it, while the assertions check vendor_prebuilt_downloaded.
  • The repo's own test vendor_uses_server_artifact_when_installed_file_is_missing already pins that vendor and vendor --force behave the same with a missing target. The core test vendor_force_still_skips_missing_files (npm_lock.rs) claims "vendor --force keeps its missing-file tolerance" but passes for the same reason.

Proof (executed twice on 9c43dfc): a throwaway copy of vendor_force_still_skips_missing_files run with force in [false, true], with the installed index.js deleted, gave identical results: success=true entry=true warnings=["vendor_prebuilt_downloaded"] both times.

Symptoms / impact

  • Users and CI scripts set --force / SOCKET_FORCE for vendoring expecting a tolerance that doesn't exist (and isn't needed).
  • Decision Decide: give SOCKET_FORCE per-command names so forcing a self-update doesn't also force apply and vendor #615 (split SOCKET_FORCE per command) argues from "every vendor with missing-file tolerance on"; in vendor mode the variable only bypasses the variant probe.
  • 9 backend signatures carry two dead parameters, which also keeps the CLI building a PatchSources for vendoring (vendored_backend/mod.rs#L71-L83)`` only to discard it.

Proposed change

  • Delete the force and sources parameters from every vendored backend entry point and sink listed above, from test_support's wrappers and from ApplyRequest's vendoring path. Keep force only where the CLI's variant probe reads it.
  • Rewrite the --force help and CLI_CONTRACT.md#L89 to "bypass the installed-variant probe for multi-release ecosystems". Mark vendor_content_mismatch_overwritten in the error-code table as no longer emitted; keep the row so that consumers matching on it aren't surprised.
  • Rename vendor_force_still_skips_missing_files to state what it now pins: vendoring ignores the installed copy. Fix the two stale test doc comments.

Size and scope

About −60 production lines across ~15 files in vendor/, plus the CLI vendor.rs/vendored_backend call sites and two doc rows. Out of scope: PackageSource / installed_dir (#800), PatchSources::mem_blobs (#746) and the env-var naming decision (#615).

Acceptance criteria

  • grep -rn "_force\|_sources" crates/socket-patch-core/src/vendor finds no parameters.
  • vendor_uses_server_artifact_when_installed_file_is_missing and every vendored backend suite stay green.
  • The --force help, CLI_CONTRACT.md and docs/ describe only the variant-probe bypass.

Dependencies

Best landed after or with #800 (the same signatures). Informs #615.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions