Skip to content

Run the Bun and vlt vendored preflights as one vendor_preflight with one per-purl refusal map #1839

Closed

Description

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor. Register ID: T05.

Problem

Every vendored caller runs the Bun preflight and the vlt preflight back to back, then checks each purl against both refusal types with its own glue code:

Both refusal types are {code: &'static str, detail: String}. The two modules (bun_preflight.rs,````` vlt_preflight.rs) duplicate several pieces:

  • the npm-only scope check;
  • selection_pairs;
  • the vendor_state_unreadable mapping;
  • the vlt_routes probe, which bun runs to opt out and vlt runs again to opt in.

Bun also exposes three one-line forwarders (bun_vendor_preflight, _with_ledger, _pairs). It has an Option<LedgerLoad> lazy-load mode, and its only caller (get.rs L2326) loads the ledger itself on the next line anyway. The callers also disagree on the root:

  • get runs Bun on project_root() but vlt on cwd;
  • agent_download runs both on cwd;
  • vendor_flow loads the ledger at cwd.

Proposed change

  • Add one vendor_preflight(cwd, pairs, ledger) -> HashMap<purl, (code, detail)>. Bun's project-level verdict is expanded per purl after its exemptions.
  • Collapse the three Bun forwarders and the lazy-load mode.
  • Each caller does one lookup per purl.
  • Pick one root, following the #745 rule (the ledger and lock at project_root()).

Size

6 files. About −150 / +60 lines.

Acceptance criteria

  • Every Bun/vlt refusal code, and its envelope and exit code, is unchanged.
  • The bun_preflight/vlt_preflight unit tests and the e2e_vendor_bun_build/e2e_redirect_vlt_build suites stay green.

Activity

  1. added
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
    on Oct 29, 2026
  2. mikolalysenko commented on Nov 7, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Janitor: closing as completed. #2015 (merged as 26e39db5) did this refactor:

    • bun_preflight.rs and vlt_preflight.rs are gone from origin/main (c2be8547).
    • One per-purl map, socket_patch_core::vendor::refusals::vendor_refusals (crates/socket-patch-core/src/vendor/refusals.rs:79), replaces both preflights.
    • Every vendored caller uses it: agent_download.rs:779 (also serves get), scan/vendor_flow.rs:293 and vendor.rs:3374.

    Reopen if any part of the acceptance criteria is still missing.


    Generated by Claude Code

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:p1refactorStructural 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