Skip to content

Commit 0416358

Browse files
mikolalysenkoclaude
andcommitted
test(e2e_vex_build): poetry vendored capstone asserts the manifest-free ledger
The poetry vendored capstone (added in #251, written before its rebase onto #247) still asserted `scan --vendor` writes `.socket/manifest.json`. Since #247 vendored mode is manifest-free (CLI_CONTRACT `scan --vendor`): the run writes only `.socket/vendor/**`, and each ledger entry is `detached: true` with the patch record embedded. The assertion therefore failed on every Poetry release in the CI matrix the first time the leg actually ran (#253). Assert the contract instead: no manifest is written, and the ledger entry for the vendored uuid is detached and embeds its record. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 9fa534d commit 0416358

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

  • crates/socket-patch-cli/tests/e2e_vex_build

‎crates/socket-patch-cli/tests/e2e_vex_build/poetry.rs‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
//! written, the same-run VEX attests from the lock's sha256 pin); vendored
1010
//! = `scan --vendor --vendor-source build --vex` over the pristine
1111
//! install (the patched wheel is committed under
12-
//! `.socket/vendor/pypi/<uuid>/`, the lock is rewired to it, manifest +
13-
//! ledger are written);
12+
//! `.socket/vendor/pypi/<uuid>/`, the lock is rewired to it, and only the
13+
//! ledger is written — vendored mode is manifest-free, so the ledger
14+
//! entry is detached and embeds the patch record);
1415
//! 3. a FRESH checkout of only the committable files (`pyproject.toml`,
1516
//! `poetry.lock`, `.socket/`) is installed by the real `poetry install`
1617
//! and the imported `six` is proven to be the PATCHED bytes (vendored
@@ -924,8 +925,25 @@ fn poetry_vendored_fresh_install_then_manifestless_vex() {
924925
lock.contains(&wheel_sha),
925926
"the lock pins the committed wheel:\n{lock}"
926927
);
927-
assert!(project.join(".socket/manifest.json").is_file());
928-
assert!(project.join(".socket/vendor/state.json").is_file());
928+
// Vendored mode is manifest-free (v5.0, CLI_CONTRACT `scan --vendor`):
929+
// the ledger entry is detached and embeds the patch record, and
930+
// `.socket/manifest.json` is never written.
931+
assert!(
932+
!project.join(".socket/manifest.json").exists(),
933+
"vendored scan wrote a manifest: {env}"
934+
);
935+
let ledger: Value = serde_json::from_slice(
936+
&std::fs::read(project.join(".socket/vendor/state.json")).expect("vendor ledger written"),
937+
)
938+
.unwrap();
939+
let entry = ledger["entries"]
940+
.as_object()
941+
.into_iter()
942+
.flat_map(|m| m.values())
943+
.find(|e| e["uuid"] == VENDORED_UUID)
944+
.unwrap_or_else(|| panic!("no ledger entry for {VENDORED_UUID}: {ledger:#}"));
945+
assert_eq!(entry["detached"], true, "{ledger:#}");
946+
assert_eq!(entry["record"]["uuid"], VENDORED_UUID, "{ledger:#}");
929947
let doc: Value = serde_json::from_slice(&std::fs::read(&embedded).unwrap()).unwrap();
930948
assert_attested(
931949
&doc,

0 commit comments

Comments
 (0)