fix(test): unbreak main — give four get edge-case fixtures a real file for #158's guardrail - #168
Merged
Mikola Lysenko (mikolalysenko) merged 2 commits intoAug 13, 2026
Conversation
…rd passes 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 an exit-1 failure ("patch has no applicable files") instead of a silent `applied:1`. But #158 only touched get.rs and left four tests in get_edge_cases_e2e.rs carrying stale `"files": {}` patch-view fixtures that still assert the `get` succeeds (exit 0). Those four now fail on main: - 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 Their real concern is selection / paid-token / drift-warning / manifest-replacement logic, not "a patch with zero files" — the empty map was only a lazy stand-in. Give each view fixture one recordable net-new file (all-zero `beforeHash`, real git-blob `afterHash` via the shared `common::git_sha256` oracle, matching base64 `blobContent`), modeled on the passing `get_invariants::patch_response_json` fixture, so `files_for_manifest` is non-empty and the guard is satisfied. Every existing assertion (found==1, selected UUID, drift warning, `updated` reporting + `oldUuid`, manifest move) is unchanged. The guardrail in get.rs is untouched. get_edge_cases_e2e now 22/22; lib (350) and get_invariants / get_update_summary (15) unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
enabled auto-merge (squash)
August 13, 2026 17:43
…ardrail Same root cause as this PR's get_edge_cases_e2e fixes: #158's guardrail (empty applicable-files map -> "patch has no applicable files", exit 1) broke get_emits_patch_fetched_telemetry_on_uuid_lookup_success, whose mock patch-view used "files": {} while asserting a successful get. Give it a recordable new-file entry (afterHash = git-blob sha256 of the decoded blob) so the success + telemetry assertions hold; guardrail untouched. Verified with a full `cargo test --workspace --no-fail-fast` pass that these two binaries held the only 5 casualties, now all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wenxin Jiang (Wenxin-Jiang)
approved these changes
Aug 13, 2026
Mikola Lysenko (mikolalysenko)
merged commit Aug 13, 2026
b109645
into
main
100 of 101 checks passed
Mikola Lysenko (mikolalysenko)
deleted the
fix/get-edge-cases-empty-files-fixtures
branch
August 13, 2026 18:36
Mikola Lysenko (mikolalysenko)
added a commit
that referenced
this pull request
Aug 13, 2026
…ile for #158's empty-record guard)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_manifestmap is empty is now reported as a failure (patch has no applicable files, exit 1) instead of a silentapplied:1. That guardrail is correct and stays.But #158 only edited
crates/socket-patch-cli/src/commands/get.rsand did not update four tests incrates/socket-patch-cli/tests/get_edge_cases_e2e.rswhose mock patch-view fixtures use"files": {}and assert thegetsucceeds (exit 0). Those four now fail on current main (4f58eec):get_with_id_flag_selects_specific_patchget_uuid_returns_paid_patch_with_token_succeedsget_on_vendored_purl_warns_about_uuid_driftget_uuid_replacing_existing_manifest_entry_reports_updatedcargo test -p socket-patch-cli --test get_edge_cases_e2ewas 18 passed / 4 failed on main. These four are the entire breakage — the CItest,coverage, andtest-releasejobs 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-zerobeforeHash, a real git-blobafterHashcomputed via the sharedcommon::git_sha256oracle, matching base64blobContent), modeled on the passingget_invariants::patch_response_jsonfixture. This makesfiles_for_manifestnon-empty so the guard passes. Introduced via one smallsingle_file_view()helper reused by all four. Every existing assertion is unchanged (found == 1, the selected UUID, the drift warning naming both UUIDs, theupdatedaction +oldUuid, the manifest actually moving to the new UUID).get.rsand 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-cliclean.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_e2etests on main after PR #158 made empty patchfilesmaps fail with "patch has no applicable files" instead of succeeding silently.Adds a shared
single_file_view()helper that returns one net-new file (beforeHashall zeros, matchingafterHash/ base64 blob viacommon::git_sha256), aligned with the passingget_invariantsfixture. Four mock patch-view responses swap"files": {}forsingle_file_view()sofiles_for_manifestis non-empty under--save-only. Productionget.rsand the guardrail are unchanged; assertions still target--idselection, paid-token fetch, vendored UUID drift warnings, and manifestupdated/oldUuidbehavior.Reviewed by Cursor Bugbot for commit 73c16dd. Configure here.