Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/socket-patch-core/src/vendor/composer_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,16 @@ pub async fn vendor_composer<'a>(
let marker = VendorMarker::new("composer", &base_purl, record, vendored_at);
write_marker_or_warn(&uuid_dir, &marker, &mut warnings).await;

let entry = VendorEntry {
let file_inventory = match super::verify::compute_dir_inventory(&copy_dir).await {
Ok(inventory) => inventory,
Err(error) => {
let _ = remove_tree(&uuid_dir).await;
prune_empty_vendor_dirs(&copy_dir).await;
return refused("vendor_inventory_unavailable", error);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inventory failure leaves lock rewritten

High Severity

compute_dir_inventory runs after composer.lock is already rewritten. On failure the uuid tree is deleted and the run refuses, but the lock is not restored. composer install then follows a path dist that no longer exists, and there is no ledger row for --revert. Cargo and golang inventory the copy before any lock or manifest edit.

Fix in Cursor Fix in Web

Triggered by learned rule: Vendor failure must leave project byte-untouched: unstage artifacts on post-pack errors

Reviewed by Cursor Bugbot for commit cf4d89f. Configure here.

};

let mut entry = VendorEntry {
ecosystem: "composer".to_string(),
base_purl,
uuid: record.uuid.clone(),
Expand Down Expand Up @@ -466,6 +475,7 @@ pub async fn vendor_composer<'a>(
pdm: None,
pipenv: None,
};
entry.artifact.file_inventory = Some(file_inventory);

done(result, Some(entry), warnings)
}
Expand Down
Loading