Skip to content

Commit ecba420

Browse files
committed
fix(command-runtime): leave truncation unknown for an unlisted producer
A capture from a producer this host has no registry row for was upgraded to 'not truncated', as main's truncation table also did. Only a producer that states it observes truncation now earns that upgrade.
1 parent 4015fc5 commit ecba420

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎packages/command-runtime/src/commands/capture/runtime/snapshot.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ test('runtime snapshot upgrades an absent truncation flag only for producers tha
8787
}
8888
});
8989

90+
test('runtime snapshot leaves truncation unknown for a producer this host does not list', async () => {
91+
// A plugin built against another release can name a producer this host has no registry row for.
92+
const producer = 'future-ios-tree' as IosSnapshotProducer;
93+
const device = createSnapshotOnlyDevice({
94+
snapshot: { nodes: [], backend: 'xctest', producer, createdAt: 1 },
95+
});
96+
97+
const result = await device.capture.snapshot({ session: 'default' });
98+
99+
assert.equal(result.truncated, undefined);
100+
});
101+
90102
test('runtime snapshot recognizes equivalent bounds and still updates its baseline', async () => {
91103
let stored: Parameters<CommandSessionStore['set']>[0] | undefined;
92104
let rect = { x: 10, y: 20, width: 100, height: 40 };

‎packages/command-runtime/src/commands/capture/runtime/snapshot.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ function snapshotAppFields(capture: SnapshotCapture): {
254254
function snapshotTruncationForResult(snapshot: SnapshotState): boolean | undefined {
255255
if (snapshot.truncated !== undefined) return snapshot.truncated;
256256
if (snapshot.backend !== 'xctest' || snapshot.producer === undefined) return false;
257-
return snapshotProducerFacts(snapshot.producer)?.truncation === 'unavailable' ? undefined : false;
257+
// A producer this host does not list cannot vouch for truncation, so it stays unknown too.
258+
return snapshotProducerFacts(snapshot.producer)?.truncation === 'available' ? false : undefined;
258259
}
259260

260261
function buildSnapshotWarnings(params: {

0 commit comments

Comments
 (0)