Skip to content

Commit e736fdd

Browse files
committed
fix(android): warn about the 180s record limit only when the last chunk ended early
stopOwnedChunks OR-ed every chunk's already-exited result, and rotation always ends every earlier chunk before record stop, so every chunked recording got the 'stopped before record stop' truncation warning. Only the active (last) chunk exiting before stop means the video ends early; recovery already judged that from chunks.at(-1).
1 parent 5fb2860 commit e736fdd

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- Fixed (android): a chunked `record stop` (recordings over 170 s) no longer warns that screenrecord
6+
stopped before record stop at the 180 s limit. Rotation always ends every earlier chunk before
7+
stop, so the warning now fires only when the last chunk's recorder had already exited.
58
- Fixed: an iOS snapshot whose XCTest query-sweep tier cannot read the screen no longer ends the
69
runner process. On a live React Native feed (Bluesky Home, images re-rendering) the AX server
710
rejects each of the sweep's 19 element-type queries with `kAXErrorIllegalArgument`, and XCTest

‎packages/platform-android/src/recording/chunks.test.ts‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,52 @@ test('returns secondary client paths, split/180s warnings, and skips chunked tou
6666
}
6767
});
6868

69+
async function finishedWarning(params: {
70+
rotate: boolean;
71+
exitedBeforeStop: readonly string[];
72+
}): Promise<string | undefined> {
73+
vi.useFakeTimers();
74+
try {
75+
let nextPid = 41;
76+
const exited = new Set(params.exitedBeforeStop);
77+
const runtime = await start({
78+
start: async () => recordingProcess(String(++nextPid)),
79+
inspect: async ({ pid }: { pid: string }) => (exited.has(pid) ? 'missing' : 'owned-alive'),
80+
stop: async ({ pid }: { pid: string }) => {
81+
if (exited.has(pid)) return 'already-missing' as const;
82+
exited.add(pid);
83+
return 'stopped' as const;
84+
},
85+
});
86+
const started = await runtime.screenRecordingStart(recordingInput());
87+
const handle = started.pendingHandle.transfer();
88+
if (params.rotate) await vi.advanceTimersByTimeAsync(170_000);
89+
const finishing = handle.finish();
90+
await vi.advanceTimersByTimeAsync(1_000);
91+
const outcome = await finishing;
92+
expect(outcome.status).toBe('completed');
93+
return outcome.status === 'completed' ? outcome.result.warning : undefined;
94+
} finally {
95+
vi.useRealTimers();
96+
}
97+
}
98+
99+
test('omits the 180s limit warning when only a rotated-out chunk exited before record stop', async () => {
100+
// Rotation stops chunk 42, so it is already missing at record stop; chunk 43 is still recording.
101+
const warning = await finishedWarning({ rotate: true, exitedBeforeStop: [] });
102+
expect(warning).toContain('split into multiple MP4 chunks');
103+
expect(warning).not.toContain('likely after reaching the 180s platform limit');
104+
});
105+
106+
test('warns about the 180s limit when the last chunk exited before record stop', async () => {
107+
await expect(finishedWarning({ rotate: false, exitedBeforeStop: ['42'] })).resolves.toContain(
108+
'likely after reaching the 180s platform limit',
109+
);
110+
await expect(finishedWarning({ rotate: true, exitedBeforeStop: ['43'] })).resolves.toContain(
111+
'likely after reaching the 180s platform limit',
112+
);
113+
});
114+
69115
test('continues through every owned chunk after a stop or removal failure', async () => {
70116
const chunks = [
71117
{

‎packages/platform-android/src/recording/chunks.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,27 @@ function validProcessIdentity(
8080
);
8181
}
8282

83+
/**
84+
* Resolves whether the active (last) chunk's recorder had already exited, i.e. the video ends before
85+
* record stop. Earlier chunks always end before stop because rotation replaced them.
86+
*/
8387
export async function stopOwnedChunks(
8488
transport: Transport,
8589
chunks: readonly NativeChunk[],
8690
): Promise<boolean> {
87-
let reachedLimit = false;
91+
const active = chunks.at(-1);
92+
let activeAlreadyExited = false;
8893
let failure: unknown;
8994
for (const chunk of [...chunks].reverse()) {
9095
try {
91-
reachedLimit = (await stopChunk(transport, chunk)) || reachedLimit;
96+
const alreadyExited = await stopChunk(transport, chunk);
97+
if (chunk === active) activeAlreadyExited = alreadyExited;
9298
} catch (error) {
9399
failure ??= error;
94100
}
95101
}
96102
if (failure) throw failure;
97-
return reachedLimit;
103+
return activeAlreadyExited;
98104
}
99105

100106
export async function waitForStableArtifacts(

0 commit comments

Comments
 (0)