Problem
Main is red. Merged PR #158 (5d7eb6f, "fix(get,scan): retain patch-added new files; guard empty patch records") added a correct guardrail: a fetched patch view whose files_for_manifest map is empty is now reported as a failure (patch has no applicable files, exit 1) instead of a silent applied:1. That guardrail is correct and stays.
But #158 only edited crates/socket-patch-cli/src/commands/get.rs and did not update four tests in crates/socket-patch-cli/tests/get_edge_cases_e2e.rs whose mock patch-view fixtures use "files": {} and assert the get succeeds (exit 0). Those four now fail on current main (4f58eec):
get_with_id_flag_selects_specific_patch
get_uuid_returns_paid_patch_with_token_succeeds
get_on_vendored_purl_warns_about_uuid_drift
get_uuid_replacing_existing_manifest_entry_reports_updated
cargo test -p socket-patch-cli --test get_edge_cases_e2e was 18 passed / 4 failed on main. These four are the entire breakage — the CI test, coverage, and test-release jobs all fail on exactly these.
Fix
Fix the stale fixtures, not the guardrail. Each of these tests' real concern is selection / paid-token / drift-warning / manifest-replacement logic — the empty "files": {} was only ever a lazy stand-in, never "a patch with zero files". Each view fixture now carries one recordable net-new file (all-zero beforeHash, a real git-blob afterHash computed via the shared common::git_sha256 oracle, matching base64 blobContent), modeled on the passing get_invariants::patch_response_json fixture. This makes files_for_manifest non-empty so the guard passes. Introduced via one small single_file_view() helper reused by all four. Every existing assertion is unchanged (found == 1, the selected UUID, the drift warning naming both UUIDs, the updated action + oldUuid, the manifest actually moving to the new UUID). get.rs and the guardrail are untouched. The seed manifest's old-UUID "files": {} in the replacement test is deliberately left as-is — it is pre-existing state, never fetched or applied, so the guard does not touch it.
Test
cargo test -p socket-patch-cli --test get_edge_cases_e2e → 22/22 (was 18/4).
cargo test -p socket-patch-cli --lib → 350 passed, unaffected.
cargo test -p socket-patch-cli --test get_invariants --test get_update_summary_e2e → 15 passed, unaffected.
cargo build -p socket-patch-cli clean.
Scope
One file, crates/socket-patch-cli/tests/get_edge_cases_e2e.rs (+29/-4). No production code, no guardrail change, no other suite needed touching.
This PR unbreaks main and should be merged before the other open fix/* PRs. Those PRs carry stale-green CI (they branched before #158 landed the guardrail); once rebased onto current main they will inherit this same 4-test failure until this fix is in.
🤖 Generated with Claude Code
Note
Low Risk
Test-only fixture updates in one e2e file; no production or guardrail changes.
Overview
Restores four failing get_edge_cases_e2e tests on main after PR #158 made empty patch files maps fail with "patch has no applicable files" instead of succeeding silently.
Adds a shared single_file_view() helper that returns one net-new file (beforeHash all zeros, matching afterHash / base64 blob via common::git_sha256), aligned with the passing get_invariants fixture. Four mock patch-view responses swap "files": {} for single_file_view() so files_for_manifest is non-empty under --save-only. Production get.rs and the guardrail are unchanged; assertions still target --id selection, paid-token fetch, vendored UUID drift warnings, and manifest updated / oldUuid behavior.
Reviewed by Cursor Bugbot for commit 73c16dd. Configure here.