Repository navigation
fix(adb): report an unparsed push checksum as unverified - #6010
Merged
Merged
Conversation
A zero-exit sha256sum whose output held no recognizable digest produced device_sha256: null with device_digest_source: "device_sha256sum" and dropped the not-device-side-verified limitation. The push receipt now takes one tagged device digest, so the source can only name sha256sum when a digest was parsed; unrecognized output reports "unavailable", the unverified limitation, and the raw command output. The sha256sum parser moves to AdbShellOutput and accepts GNU's escaped-name prefix. Fixes #5924 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Low impact] The PR appears safe to merge; no actionable issues were found. Summary
Acknowledged scope: Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Push completes] --> B[Run device sha256sum]
B --> C{Command succeeds?}
C -->|No| D[Unavailable digest]
C -->|Yes| E{Digest parses?}
E -->|No| F[Unavailable digest, limitation, raw output]
E -->|Yes| G{Matches local digest?}
G -->|Yes| H[Verified push receipt]
G -->|No| I[Changed-artifact error with receipt]
Reviews (1) · Last reviewed commit: "fix(adb): derive push digest source from..." · Reviewed by Greptile |
3 tasks done
13 tasks done
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.
What broke: after a successful
push_adb_file, asha256sumthat exited 0 with no recognizable digest produceddevice_sha256: nullwithdevice_digest_source: "device_sha256sum"and dropped the "not device-side verified" limitation.Fix: the push receipt takes one tagged device digest (digest + source together), derived from a single
sha256sumparser, so unparsed output reports"unavailable", the unverified limitation, and the raw command output.Risk: low; ADB push receipt only, output schema unchanged. GNU-escaped (
\-prefixed) checksum lines now verify instead of being treated as unrecognized.Summary
Fixes #5924.
push_adb_filenow reportsdevice_digest_source: "device_sha256sum"only when a device digest was actually parsed. A zero-exitsha256sumwith empty or unrecognizable output is reported like a missing command:device_sha256: null,device_digest_source: "unavailable", and a limitation stating the transfer is not device-side verified. The unrecognized output is kept inraw_result.device_sha256sum.Problem and expected behavior
pushFilebuilt its receipt from two independent arguments: the regex match (ornull) and a hard-coded"device_sha256sum"source on every zero-exit path. Any successful exit therefore claimedsha256sumas the digest source, even with no digest parsed, and skipped the unverified-transfer limitation that the nonzero-exit branch adds. Expected: a successful exit alone does not establish that a checksum was obtained or compared (issue #5924).Change and scope
src/adb/AdbProvider.ts: the receipt takes a taggedAdbDeviceDigest({device_sha256: string, source: "device_sha256sum"}or{device_sha256: null, source: "unavailable", reason}). Source, digest and the unverified limitation can no longer disagree. The unparsed branch keeps the command's stdout/stderr asrawResult, following the existingstart_adb_activitypattern.src/adb/AdbShellOutput.ts:parseSha256sumOutputowns thesha256sum FILEline format alongside the other shell-output parsers. It requires the<digest> <space|*>separator and accepts GNU's leading backslash, which marks an escaped echoed name; the digest itself is never escaped. This replaces the inline/^([a-f0-9]{64})\s/regex.docs/adb-device-analysis.md: documents the unavailable outcome.device_sha256nullable +device_digest_sourceenum) is unchanged. I kept it that way rather than making it a discriminated union, which would change the published JSON Schema.digest_status). Install has no digest. Push is the only device-side digest reader.Ordinary fix within existing boundaries; scope decision not applicable.
Contract and boundary impact
AdbShellOutputparser →pushFilereceipt).raw_resultwithdevice_sha256sum.stdout/stderrand the unverified limitation.Expected effects (these belong to the existing
push_adb_fileoperation; this PR adds none):Evidence and regression coverage
src/adb/AdbProvider.test.ts"derives the push digest source from …" is a table through the productionAdbProviderwith a simulated adb executable. Cases: valid line, GNU-escaped line, empty stdout, malformed line (63 hex chars), nonzero exit (127). It asserts digest/source, the unverified limitation, andrawResult. It replaces the single-case "pushes a file and verifies the device-side digest" test.6d356b843the new table failed for escaped, empty and malformed (3 failed, 2 passed). The issue's repro test throughAdbDeviceAnalysisServiceon this branch: valid, empty and missing pass.escapednow reports a verified digest (device_sha256sum) instead of the issue's expectedunavailable, by design (see Change).{"device_sha256":null,"device_digest_source":"unavailable","limitations":[…,"The device's sha256sum output contained no recognizable digest, so the transfer is not device-side verified"]}.sha256sumoutput was not observed directly; the parser accepts its documented<digest> <name>form.For evidence-bearing changes:
Validation performed
npm run test:local -- src/adb/*.test.ts src/application/adb/*.test.ts src/contracts/toolEffects.test.ts: 8 files, 201 tests passednpm run check:fast: passednpm run format:check: passednpm run docs:check: passedCompatibility, safety, and release
device_sha256as unverified are unaffected.raw_resultholds at most the existing 1 KiB capture ofsha256sumoutput for the caller-selected device path.Author readiness
Human owner: @kaoru0822-kitauji
Before merge
type(scope): outcome.🤖 Generated with Claude Code