fix(adb): preserve existing bugreport archives (#2221)

* fix(adb): preserve existing bugreport archives

* fix(adb): retain bugreports after publication failure

Record acquired archive facts before publishing, preserve the staging archive when the exclusive copy fails, and keep retained evidence out of automatic cleanup. Reuse the same observation through publication and digest failures.

Add a real-filesystem ENOSPC regression covering error projection, existing evidence, subsequent collection and provider shutdown. Verified 96 focused tests, static checks and docs on macOS with simulated ADB; no real-device verification.

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Lucien
2026-10-13 00:25:17 +08:00
committed by GitHub
co-authored by morluto
parent 85c5477930
commit d80b55e11b
5 changed files with 509 additions and 100 deletions
+4 -4
View File
@@ -1086,10 +1086,10 @@ it("rejects mistyped intent extras before touching the device", async () => {
it("collects a device bugreport archive with its digest", async () => {
const { binary, root } = await writeAdbStub(
(root) => `if [ "$1" = "version" ]; then ${VERSION_BLOCK}; exit 0; fi
() => `if [ "$1" = "version" ]; then ${VERSION_BLOCK}; exit 0; fi
if [ "$1" = "-s" ] && [ "$3" = "bugreport" ]; then
printf 'bugreport-bytes' > "${join(root, "bugreport test.zip")}"
printf 'Bug report copied to ${join(root, "bugreport test.zip")}\\n'
printf 'bugreport-bytes' > "$4/bugreport test.zip"
printf 'Bug report copied to %s/bugreport test.zip\\n' "$4"
exit 0
fi
exit 1`,
@@ -1103,7 +1103,7 @@ exit 1`,
local_path: join(root, "bugreport test.zip"),
bytes: 15,
sha256: digest,
adb_reported_path: join(root, "bugreport test.zip"),
adb_reported_path: expect.stringContaining(".rea-bugreport-"),
});
});