Skip to content

Commit 941018e

Browse files
committed
test: exercise publication membership through the production buildSnapshotState
External review final pass: the fixture previously bypassed buildSnapshotState via a local helper. Now calls the production interface with snapshotInteractiveOnly, makes the interactive fixture a bare hittable Button (no label/identifier/value) so its survival proves the interactive branch, and records non-vacuity: with collectIosStructuralIdentifierSuppression disabled, the suppression test fails ('promo-banner' published) and only it. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RtLCcpyJVLCqf4qFbq7Mh7
1 parent 3ee2602 commit 941018e

1 file changed

Lines changed: 28 additions & 18 deletions

File tree

‎src/daemon/snapshot-presentation/ios/publication-membership.test.ts‎

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
import { expect, test } from 'vitest';
2-
import { attachRefs, type RawSnapshotNode } from '@agent-device/kernel/snapshot';
3-
import { presentIosInteractiveSnapshot } from './index.ts';
2+
import type { RawSnapshotNode } from '@agent-device/kernel/snapshot';
3+
import { buildSnapshotState } from '../../handlers/snapshot-capture.ts';
44

55
// End-to-end publication-membership contract for the acquire/present design (#1797, external
6-
// review pass 4 finding 1). Runner presentation owns ELIGIBILITY (which nodes may appear at
7-
// all); this daemon compaction layer owns PUBLICATION membership (what agents actually see).
8-
// The four semantic-content cases pin the declared policy:
9-
// - label content -> published (any type: a labeled image is meaningful content)
10-
// - value content -> published
11-
// - interactive -> published
6+
// review pass 4 finding 1), exercised through the PRODUCTION interface: buildSnapshotState owns
7+
// the real ordering of normalization, group pruning, scope, iOS compaction, occlusion
8+
// annotation, and refs. Runner presentation owns ELIGIBILITY (which nodes may appear at all);
9+
// this pipeline owns PUBLICATION membership (what agents actually see).
10+
//
11+
// The semantic-content cases pin the declared policy:
12+
// - label content -> published (any type: a labeled image is meaningful content)
13+
// - value content -> published
14+
// - interactive-only -> published (a bare hittable Button with NO label/identifier/value,
15+
// so its survival proves the interactive branch, not content)
1216
// - identifier-only STRUCTURAL `Other` (non-hittable, no label/value) -> ELIGIBLE but
1317
// SUPPRESSED at publication, deliberately: this is the React Native testID-wrapper shape
14-
// (see collectIosStructuralIdentifierSuppression in noise.ts), which would otherwise spam
15-
// agent output with non-actionable wrappers. Identifier-only nodes of other shapes are NOT
16-
// covered by that suppression and must survive.
18+
// (collectIosStructuralIdentifierSuppression in noise.ts), which would otherwise spam agent
19+
// output with non-actionable wrappers. Identifier-only nodes outside that shape survive.
20+
//
21+
// Non-vacuity (regression-test rule): with the collectIosStructuralIdentifierSuppression call
22+
// disabled in noise.ts, the suppression test below FAILS ('promo-banner' is published); it
23+
// passes only because the production suppression fires.
1724
function publish(nodes: RawSnapshotNode[]) {
18-
return attachRefs(presentIosInteractiveSnapshot(nodes));
25+
return buildSnapshotState({ nodes, backend: 'xctest' }, { snapshotInteractiveOnly: true }).nodes;
1926
}
2027

2128
const screen: RawSnapshotNode[] = [
@@ -44,23 +51,26 @@ const screen: RawSnapshotNode[] = [
4451
identifier: 'promo-banner',
4552
rect: { x: 110, y: 130, width: 180, height: 44 },
4653
},
54+
// Interactive-only: no label, no identifier, no value — survival proves the interactive branch.
4755
{
4856
index: 4,
4957
depth: 1,
5058
parentIndex: 0,
5159
type: 'Button',
52-
label: 'Pay $42.00',
5360
hittable: true,
5461
rect: { x: 16, y: 696, width: 370, height: 56 },
5562
},
5663
];
5764

58-
test('publication keeps label content, value content, and interactive nodes', () => {
65+
test('publication keeps label content, value content, and bare interactive nodes', () => {
5966
const published = publish(screen);
60-
const labels = published.map((node) => node.label ?? node.value ?? node.identifier);
61-
expect(labels).toContain('Red sneakers product photo');
62-
expect(labels).toContain('3 items');
63-
expect(labels).toContain('Pay $42.00');
67+
expect(published.some((node) => node.label === 'Red sneakers product photo')).toBe(true);
68+
expect(published.some((node) => node.value === '3 items')).toBe(true);
69+
expect(
70+
published.some(
71+
(node) => node.type === 'Button' && !node.label && !node.identifier && !node.value,
72+
),
73+
).toBe(true);
6474
});
6575

6676
test('publication suppresses identifier-only structural Other wrappers, by declared policy', () => {

0 commit comments

Comments
 (0)