Repository navigation
Load manifest hashes as lowercase so every verify site agrees (#707) - #1163
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A manifest whose beforeHash/afterHash are spelled in uppercase hex passed blob download (which compares case-insensitively) but then failed apply and rollback verification, which compare the computed lowercase git-sha256 with ==. The same bytes were reported as a hash mismatch. Lowercase both hashes when a PatchFileInfo is deserialized, so every comparison site, blob name and vendored pin sees one spelling. A manifest written back after load carries the lowercase spelling. Fixes #707. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
The coverage job failed on e2e_vendored_production: tests/common is compiled twice into that binary, so its oracle selftests ran twice in one process and clobbered each other's PID-named /tmp scratch files. This is the same change as #1162 (per-test tempfile::tempdir()), so the flake stops blocking this PR; it no-ops once #1162 merges. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] I ported #1162's change (a per-test Generated by Claude Code |
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b920a55. Configure here.
|
Burn-down agent: labeled Ready for review at b920a55.
Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #707
Summary
PatchFileInfo'sbeforeHash/afterHashare now lowercased when a manifest is deserialized. Every consumer then sees one spelling: agent-mode apply and rollback verification, blob names and vendored pins. Before this change, a manifest that spelled its hashes in uppercase passed blob download, which compares case-insensitively, and then failed apply and rollback verification. Those compare the computed lowercase git-sha256 with==, so they reportedHashMismatchfor bytes that matched.Why
doc/07-infra-agent.mdC41: the hash case rule is decided separately at each comparison site. This PR takes the issue's recommended fix, "normalize at the boundary", which sets the rule once at load instead of adding a case-insensitive helper at every site.arch-refactor/*oragent/fix-*PRs also change (see the refactor register's Queue).What changed
crates/socket-patch-core/src/manifest/schema.rs:#[serde(deserialize_with = "deserialize_hash")]on both hash fields, plus a doc comment that states the rule.api::blob_fetcher::blob_hash_matches(Remove --download-mode and the diff download path (#792) #1049, Resolve the org once per run and route every API call through it (#648) #1041) and the vendoredeq_ignore_ascii_casesites. They stay correct, and they become plain==in a follow-up.Also included
b920a55 ports #1162's fix for the oracle selftest temp-path collision, which failed this PR's
coveragejob (e2e_vendored_production). It is test-only and becomes a no-op once #1162 merges.Deleted
Nothing in production. The diff is +18 production lines (including the doc comment) and +112 test lines for #707. The comparison helpers this rule makes redundant are in files that open PRs change (see above).
Behavior
Test evidence
manifest::schema::tests::test_patch_file_info_loads_hashes_lowercaseandtest_uppercase_manifest_hashes_apply_and_roll_back, which reads a manifest from disk, then runs verify, apply, rollback-verify and rollback for the lowercase and uppercase spellings.main's rule, with the attribute removed:upper=true: VerifyResult { status: HashMismatch, current_hash: "e5c1…", expected_hash: "E5C1…" }. 2 failed.manifest::schema.cargo test -p socket-patch-core --lib: 5788 passed. The 4 failures are the known root-only sandbox tests that also fail onmain(copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_…,pypi_requirements::wire_failure_rolls_back_…).cargo test -p socket-patch-cli --all-features --test e2e_vendored_production: 49 passed, 13 ignored (production).cargo clippy --workspace --all-features -- -D warnings: clean.Risk
Low. One serde attribute on the load path. API-emitted manifests are already lowercase, so they are unaffected.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FkC1KYiCBhfqT5US5QMvSD
Generated by Claude Code