Skip to content

After an interrupted vendored Maven run no command removes the jars it left: vendor --revert says "Nothing vendored to revert", rollback and repair leave them, and vendor --check fails with "restore .socket/vendor/state.json from version control" for a ledger that never existed #2383

Backlog

Description

[agent] Found by the architecture refactor routine on main at cfc870f.

The problem

A vendored run writes its artifacts first and commits the lockfiles and the ledger once, at the end. A run that stops before that commit (Ctrl-C, a cancelled CI job, a kill) leaves artifacts no ledger entry names. For nine of the ten ecosystem fixtures that is harmless: the artifacts are .socket/vendor/<eco>/<uuid>/ directories, and the orphan sweep that vendor --revert, rollback, remove and scan --prune share deletes them (CLI commands/vendor_orphans.rs: "uuid dirs under .socket/vendor/<eco>/ that no ledger entry owns (a hand-edited state file, an interrupted run, …)").

Maven's tree, .socket/vendor/maven2/<group>/<artifact>/<version>-socket.<hex8>/, is not a uuid directory, and no sweep knows it. After an interrupted Maven run:

  • socket-patch vendor --check exits 1 with vendor_ledger_missing: "JVM artifacts exist without a vendor ledger entry; restore .socket/vendor/state.json from version control". On a first run that file has never existed, in version control or anywhere else.
  • socket-patch vendor --revert prints "Nothing vendored to revert." and exits 0. The jars stay.
  • socket-patch rollback reports both packages "already original", removes their records from the manifest and exits 0. The jars stay, and now vendor has nothing to finish ("The manifest has no patches; nothing to vendor.").
  • socket-patch repair prints "Nothing to clean up."

From there every vendor --check fails with the same sentence, and the only way out is rm -rf .socket/vendor. Before the rollback, the one command that helps is the one the user interrupted: vendor again, and then vendor --revert.

The window is the whole time the run writes jars. In the fixture that is the eleven file operations before the commit journal: vendor --check fails this way after a stop at any of them, and vendor --revert leaves files behind after ten (the first leaves a stage file alone). The build itself is not affected: pom.xml is untouched until the commit.

vendor --check decides by one rule, "a JVM tree exists and the ledger has no JVM entry" (CLI commands/vendor.rs, lines 1360 to 1376), and gives it one cause, a lost ledger. The group commit's own description of an interrupted run promises the other reading: "the artifacts the run wrote are orphans no ledger entry names (the next run re-vendors over them, --revert's sweep deletes them)" (core utils/group_commit.rs, the crash semantics).

Evidence

The Maven project of crates/socket-patch-cli/tests/vendor_ecosystem_fixtures (two patched dependencies), the binary built from main, and the suite's vendor-service fixture. The run is interrupted with SIGINT as it is about to rename the second package's jar into place. SIGTERM and an abrupt exit at the same point leave the same six files and the same answers.

$ socket-patch vendor            # interrupted
$ find .socket/vendor -type f
.socket/vendor/maven2/org/fx/alpha/1.0.0-socket.11111111/alpha-1.0.0-socket.11111111.jar
.socket/vendor/maven2/org/fx/alpha/1.0.0-socket.11111111/alpha-1.0.0-socket.11111111.jar.sha1
.socket/vendor/maven2/org/fx/alpha/1.0.0-socket.11111111/alpha-1.0.0-socket.11111111.pom
.socket/vendor/maven2/org/fx/alpha/1.0.0-socket.11111111/alpha-1.0.0-socket.11111111.pom.sha1
.socket/vendor/maven2/org/fx/alpha/1.0.0-socket.11111111/socket-patch.vendor.json
.socket/vendor/maven2/org/fx/beta/1.0.0-socket.22222222/.socket-stage-beta-1.0.0-socket.22222222.jar-ab11499f-…

$ socket-patch vendor --check    # exit 1
Error (vendor_ledger_missing): JVM artifacts exist without a vendor ledger entry; restore .socket/vendor/state.json from version control

$ socket-patch vendor --revert   # exit 0
Nothing vendored to revert.

$ socket-patch rollback --yes    # exit 0
Rolled back 2 packages:
  pkg:maven/org.fx/alpha@1.0.0 (already original)
  pkg:maven/org.fx/beta@1.0.0 (already original)
Removed 2 patches from manifest.

$ socket-patch repair --offline  # exit 0
No patches in manifest; nothing to download.
Nothing to clean up.

$ socket-patch vendor --check    # exit 1
Error (vendor_ledger_missing): JVM artifacts exist without a vendor ledger entry; restore .socket/vendor/state.json from version control

$ find .socket/vendor -type f | wc -l
6

The way out that works, from the same interrupted tree: socket-patch vendor (exit 0, "Vendored 2 packages."), then socket-patch vendor --revert (exit 0, "Reverted 2 vendored packages."), which leaves no file under .socket/vendor/.

Every point of the run, every ecosystem

A preloaded shim counts the renames, unlinks and directory removals the binary makes under the project and stops the process before the k-th one. For each of the ten fixtures and each k, the same command was then run again, and vendor, vendor --revert, vendor --check and vex were run over a copy of the stopped tree.

Command stopped File operations, ten fixtures Re-run reaches the unstopped tree A project file names a missing artifact vex attests an unwired package
vendor 142 all (Maven: the files, yes; see below) never never
vendor --revert 384 all never never
rollback 424 all never never
remove <purl> 136 all (stopped while freeing blobs, the second run answers "not found") never never

So the lockfiles, the ledger and the journal hold at every point. What remains are leftovers: the stage files of #2337 at 219 of those points, and this Maven tree. vendor --revert over a stopped vendor returns the pristine files for nine fixtures at every point, and for Maven at one of the eleven points before the journal.

One smaller thing on the way out that works. A vendor re-run over the stopped tree does not record the directories the stopped run had already made (seven jvm_created_dir records fewer per entry), so the vendor --revert after it leaves an empty .mvn/ in the project. An unstopped vendor and vendor --revert leave none.

Not run: Gradle, sbt and scala-cli, whose trees (.socket/vendor/gradle, .socket/vendor/coursier) are in the same list vendor --check reads (LEDGER_OWNED_PATHS) and are written by the same planner; a reactor; scan --mode vendored; scan --prune over the stopped tree (it needs a patch API).

Planned fix

The orphan sweep learns the JVM trees: a version directory under an owned tree that no ledger entry records and no project file names (the pom, the Gradle settings script, the Coursier index) is an interrupted run's, and vendor --revert, rollback, remove and scan --prune delete it as they delete an orphaned uuid directory, with the same event.

vendor --check then tells the two causes apart. A tree some project file still names keeps vendor_ledger_missing and its remedy. A tree nothing names is reported as left by an interrupted run, with the remedy that works: socket-patch vendor to finish it, or socket-patch vendor --revert to remove it.


Generated by Claude Code

Activity

  1. added
    bug
    arch-audit
    on Nov 30, 2026
  2. added a commit that references this issue on Nov 30, 2026
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-auditbugpriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions