fix(android): retire recording evidence stranded by a re-adopted device id - #2564
fix(android): retire recording evidence stranded by a re-adopted device id#2564thymikee wants to merge 2 commits into
Conversation
…ce id Android `record start` refused forever with "native recovery evidence already exists" once an emulator was re-adopted under a new serial: the device-side marker names the device identity that wrote it, reconciliation retired evidence only when that identity matched, and the leftover classified as neither recoverable nor retireable — an `UNKNOWN` internal error whose hint asked for a bug report, while `record stop` owned nothing to clear. Start reconciliation now retires evidence whose recording is terminal or whose device identity the transport can no longer address, and only after every artifact it names is proven released: a committed recorder through process inspect, an uncommitted pending artifact against the recorders running on the device. A recorder still writing is never deleted; the refusal names the writer in `details.writer`. Remaining refusals — unreadable evidence, the other transport mode, and an open recording this identity owns — are typed errors carrying the marker path and the command that clears it. Closes #2550
Size Report
Startup median (7 runs, lower is better):
|
|
The pending-artifact cleanup at start-reconciliation.ts:108 can delete a recording that is still being written. findRunning drops uncertain process inspections, so a failed /proc read for a live recorder can produce an empty list; reconciliation then removes its artifact and recovery marker. Preserve that uncertainty and refuse cleanup when ownership cannot be established, with a regression covering an inconclusive inspection. The reported device scenarios and green checks do not cover this case. Reviewed 4468260. |
The writer probe filtered candidate processes down to the ones it could prove were recorders, so a caller that read an empty list as "nothing writes this path" removed an artifact from under a recorder whose /proc entries could not be read, along with the marker that named it. A process table it could not read at all threw a bare Error, which reached callers as an unclassified failure. The transport answers a writer search with `clear`, `found`, or `uncertain`. Only `clear` proves an artifact is free: start retirement refuses with `native_recording_recorder_unproven` and owned cleanup keeps the evidence pending, so both wait for a conclusive answer instead of deleting on doubt.
|
Fixed in 200ad13. The transport probe now answers Regressions: |
Summary
Android
record startrefused forever once an emulator was re-adopted under a new serial. Thedevice-side marker names the device identity that wrote it, and reconciliation retired evidence only
when that identity matched, so a marker left by an earlier session on the same AVD blocked every later
recording with
Android screenrecord native recovery evidence already exists— surfaced asUNKNOWNwhose hint asked for a bug report — while
record stopowned nothing that could clear it.Reconciliation now retires evidence that is terminal or names an unreachable device identity, after
proving every artifact it names is released: committed recorders through process inspect, an
uncommitted pending artifact against the recorders running on the device. Nothing is deleted under a
live recorder — the refusal is
DEVICE_IN_USEwithdetails.writernamingnamed-recorderorother-recorder. Unreadable evidence, the other transport mode, and an open recording this identityowns stay refused, now as typed errors naming the marker path and the command that clears it.
Reconciliation moved to
start-reconciliation.ts, marker persistence tomanifest-store.ts.14 files. Closes #2550.
Residual risk: evidence under an unreachable identity can name artifacts nobody ever pulled; retiring
it removes them, since no reachable session can recover them. Marker removal is not compare-and-delete.
Validation
Commits
44682608bcand200ad13429.pnpm check:affected --runpassed on each: format, lint,typecheck, layering, fallow, build, vitest-related, unit, provider-integration.
200ad13429answers a review finding that an inconclusive writer probe could be read as "path isfree" and delete a live artifact: the transport now reports
clear | found | uncertain, and bothretirement and owned cleanup retain evidence on
uncertain. Both regressions were confirmed to failwhen that branch is reverted to the doubt-as-proof reading.
Live on
emulator-5554(Pixel 7 CI, Android 16) at44682608bc:deviceId: emulator-9999→record start --scope devicesucceeded and retiredit; previously this was the reported refusal;
emulator-5554→DEVICE_IN_USE,retriable: false,reason: native_recovery_evidence_open, hint names the owning session; marker retained;screenrecordwas writing →DEVICE_IN_USE,reason: native_recording_artifact_claimed,writer: other-recorder; marker and artifact retained,and the retry after that recorder ended succeeded and removed the orphan artifact.
Sessions closed and device markers cleaned. Coverage stays CI-authoritative.