Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,17 @@ test('commandless longpress response omits internal interaction diagnostics', ()
).toEqual({ completedSteps: 1 });
});

function selectorResult(readiness?: { polls: number; waitedMs: number }): PressCommandResult {
function selectorResult(): PressCommandResult {
return {
kind: 'selector',
point: { x: 10, y: 20 },
target: { kind: 'selector', selector: 'label=Continue' },
node: { ref: 'e1', index: 0, type: 'Button', label: 'Continue' },
selectorChain: ['label=Continue'],
warning: 'earlier warning',
...(readiness ? { readiness } : {}),
};
}

const WAITED_SELECTOR_RESULT = selectorResult({ polls: 3, waitedMs: 400 });

test.each([false, true])('selector-touch observation after retirement=%s', async (retired) => {
const sessionStore = makeSessionStore();
const address = 'cwd:selector-touch-response:default';
Expand Down Expand Up @@ -252,25 +249,14 @@ test.each([
},
);

test('the response builder reports the resolved wait and keeps the prior warning', () => {
const { responseData, result } = buildInteractionResponseData({
source: { kind: 'runtime', result: WAITED_SELECTOR_RESULT },
referenceFrame: undefined,
staleRefsWarning: 'stale refs',
});

expect(responseData.readiness).toEqual({ polls: 3, waitedMs: 400 });
expect(responseData.warning).toBe('earlier warning stale refs');
expect(result.readiness).toBeUndefined();
});

test('the response builder omits readiness when nothing waited', () => {
test('the response builder keeps the prior warning', () => {
const { responseData } = buildInteractionResponseData({
source: { kind: 'runtime', result: selectorResult() },
referenceFrame: undefined,
staleRefsWarning: 'stale refs',
});

expect('readiness' in responseData).toBe(false);
expect(responseData.warning).toBe('earlier warning stale refs');
});

test('an already retired coordinate touch skips its frame probe without a warning', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ export function buildInteractionResponseData(params: {
visualization.warning = warning;
responseData.warning = warning;
}
if ('readiness' in result && result.readiness) responseData.readiness = result.readiness;
return { result: visualization, responseData, ...recordedTargetCapture(result) };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,6 @@ test('native replay failure metadata keeps machine fields and daemon-owned paths
expect(response.error.details).not.toHaveProperty('reas<var:MODE>');
});

test('a replay divergence carries the readiness evidence of an exhausted target wait', () => {
const readiness = { polls: 11, waitedMs: 2_004, end: 'expired' };
const response = buildReplayDivergenceFailureResponseFromDescriptor({
error: {
code: 'COMMAND_FAILED',
message: 'Selector did not match',
details: { reason: 'selector_not_found', readiness },
},
actionLabel: 'press label=Continue',
action: 'press',
positionals: ['label=Continue'],
step: 3,
replayPath: '/tmp/flows/checkout.ad',
artifactPaths: [],
divergence: {},
scrubVars: [],
});

expect(response.ok).toBe(false);
if (response.ok) return;
expect(response.error.code).toBe('REPLAY_DIVERGENCE');
expect(response.error.details).toMatchObject({ reason: 'selector_not_found', readiness });
});

// #2997: the Android platform states `open --test-ime` because it sees one dispatched
// session-open. On this surface that advice is unactionable — a flow caller never runs
// `open` — so the cause's hint is replaced off the typed reason, never off the message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function readStringDetail(
}

const SAFE_CAUSE_DETAIL_KEYS = [
'readiness',
'reason',
'recovery',
'retriable',
Expand Down
20 changes: 0 additions & 20 deletions src/mcp/__tests__/command-tools-readiness.test.ts

This file was deleted.

Loading