Skip to content

Commit 98321a2

Browse files
committed
test(ios): reject a snapshot quality state outside the declared vocabulary
The acquisition assertion only rejected 'sparse' and unexempt 'recovered', so a verdict with any other state (renamed enum, diverged runner) fell through both branches and certified depth facts off a tree the lane never classified. The state set is now pinned to the kernel-declared SNAPSHOT_QUALITY_STATES, with a negative test for states outside it.
1 parent ffd575a commit 98321a2

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎test/integration/ios-simulator-e2e-snapshot-acquisition.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ test('a sparse capture is rejected whatever strategy it names', () => {
7474
);
7575
});
7676

77+
test('a verdict with a state outside the declared vocabulary is rejected', () => {
78+
// The kernel declares ['healthy', 'recovered', 'sparse'] and the runner's allCases is pinned to
79+
// the same fixture; a verdict outside that set means the two sides diverged, and certifying
80+
// depth facts off a tree the lane cannot classify is the same meaningless-green defect as
81+
// ruling a sparse capture healthy.
82+
for (const state of ['unknown', 'degraded', undefined]) {
83+
assert.throws(
84+
() =>
85+
assertSimulatorSnapshotAcquisition(
86+
capture({ ...(state === undefined ? {} : { state }), backend: 'tree' }),
87+
'regular depth-1 snapshot',
88+
),
89+
/state outside the declared vocabulary/,
90+
);
91+
}
92+
});
93+
7794
test('a capture that declares its hittability evidence missing is rejected', () => {
7895
assert.throws(
7996
() =>

‎test/integration/ios-simulator-e2e/live-snapshot-depth-frontier.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import assert from 'node:assert/strict';
22

3+
import { SNAPSHOT_QUALITY_STATES } from '@agent-device/kernel/snapshot';
4+
35
import {
46
assertWaitText,
57
type LiveSnapshotNode as SnapshotNode,
@@ -150,14 +152,20 @@ const PRE_SELECTED_REASON_CODES: ReadonlySet<unknown> = new Set(['deferred', 're
150152
* served nothing: `sparse` means no backend served the screen, and `recovered` with a code other
151153
* than the two pre-selected ones means the strategy the presented depth semantics belong to failed
152154
* mid-capture and another answered (#1569 — two strategies are not comparable views of one screen).
153-
* Either one fails here with the response that proved it.
155+
* Either one fails here with the response that proved it. A verdict whose state is outside the
156+
* kernel-declared `SNAPSHOT_QUALITY_STATES` exhausts nothing and fails too — the lane must not
157+
* certify a tree whose acquisition it does not classify.
154158
*/
155159
export function assertSimulatorSnapshotAcquisition(
156160
result: { json?: any },
157161
description: string,
158162
): void {
159163
const quality = result.json?.data?.snapshotQuality;
160164
if (quality !== undefined) {
165+
assert.ok(
166+
(SNAPSHOT_QUALITY_STATES as readonly unknown[]).includes(quality.state),
167+
`${description} disclosed a quality state outside the declared vocabulary: ${JSON.stringify(result)}`,
168+
);
161169
assert.notEqual(
162170
quality.state,
163171
'sparse',

0 commit comments

Comments
 (0)