Files
Michał Pierzchała edbd96ea30 refactor(contracts): additive capability facts pilot on touch family (#2420)
* refactor(contracts): make touch capability facts additive

The touch family's facts builder took one required cell per operation, so an
operation only one owner implements still cost a hand-written denial in every
other owner. The builder now takes the family's denial once, as `unsupported`,
and every operation cell is optional: an owner names what it implements and
omission reports that denial verbatim, with the reason and hint the owner would
otherwise have repeated per cell.

Omission stays a classified refusal, never an unclassified cell and never an
implied success: `unsupported` is required, so a call that leaves the family
blank does not compile. Facts are unchanged for every owner, so the per-platform
admission assertions hold untouched.

Refs #2412

* fix(contracts): keep tap/longPress/fill required in touch facts

Making every touch cell optional dropped the compile-time guard on the
three operations every owner implements, with nothing replacing it: an
owner could silently drop `tap` and nothing would fail. Only the truly
per-owner cells (tapRef, hover, hoverRef, fillRef, tapElementSelector)
need `unsupported` as their default.

Restoring the required fields caught a real regression this refactor
introduced: platform-web's touch facts had silently lost their explicit
`longPress: readinessUnavailable` cell, so longPress reported the
family's `unsupported` fallback instead of the owner's own readiness
reason. Restored it, and fixed the other now-required-field call sites
(the fully-unavailable owner fixtures, and the screenshot-runtime-fixture
test double, which had also silently lost its longPress/fill distinction).

Refs #2412

* fix(coverage): repoint hover evidence off the retired runtime.ts source line

The touch family's additive-facts refactor dropped every owner's explicit
hover: unavailable cell in favor of the family-level unsupported fallback,
so the coverage manifests' literal-substring checks against
packages/platform-apple/src/runtime.ts and packages/platform-linux/src/runtime.ts
broke: that source line no longer exists.

Point the macOS, iOS, tvOS, and Linux hover rows at new tests that assert the
typed unavailable denial directly against each owner's bound facts, instead of
re-adding a hand-written denial line the refactor was meant to retire.

Refs #2412

* test(coverage): point hover evidence at the typed-denial tests in the declaration table
2026-09-09 22:16:45 +02:00

89 lines
3.7 KiB
TypeScript

import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
import {
defineAndroidContractEvidence,
type AndroidContractEvidence,
} from '../android-emulator-e2e/contract-evidence.ts';
/** A named test in this repository: the file that owns it and the test's own name. */
export type RepositoryEvidence = {
path: string;
test: string;
};
const C = PUBLIC_COMMANDS;
// Tracking issues for the known-gap rows each platform still carries.
export const MACOS_COVERAGE_GAP_ISSUE = 1916;
export const TVOS_COVERAGE_GAP_ISSUE = 1914;
export const WEB_COVERAGE_GAP_ISSUE = 1900;
export const LINUX_COVERAGE_GAP_ISSUE = 1915;
// Android contract evidence that only the coverage declarations cite. Evidence shared with a
// production test module keeps living next to that module and is imported by declarations.ts.
export const ANDROID_APPLICATION_LIFECYCLE_CONTRACT_EVIDENCE: AndroidContractEvidence =
defineAndroidContractEvidence(
'packages/platform-android/src/runtime.test.ts',
[C.prepare],
'classifies the Android %s lifecycle denominator against the legacy dispatch cell',
);
export const ANDROID_HOVER_RUNTIME_CONTRACT_EVIDENCE: AndroidContractEvidence =
defineAndroidContractEvidence(
'packages/platform-android/src/runtime.test.ts',
[C.hover],
'classifies the Android %s runtime denominator',
);
export const ANDROID_TV_REMOTE_RUNTIME_CONTRACT_EVIDENCE: AndroidContractEvidence =
defineAndroidContractEvidence(
'packages/platform-android/src/runtime.test.ts',
[C.tvRemote],
'classifies Android %s back/home/orientation/keyboard facts through the shared touch gate',
);
export const ANDROID_VIEWPORT_RUNTIME_CONTRACT_EVIDENCE: AndroidContractEvidence =
defineAndroidContractEvidence(
'src/daemon/__tests__/viewport-runtime.test.ts',
[C.viewport],
'rejects an unavailable exact-owner fact before binding',
);
export const TVOS_REMOTE_TEST_NAME =
'Provider-backed integration tvOS remote flow maps navigation commands to runner remote presses';
export const TVOS_REMOTE_EVIDENCE: RepositoryEvidence = {
path: 'test/integration/provider-scenarios/tvos-remote.test.ts',
test: TVOS_REMOTE_TEST_NAME,
};
export const TVOS_AUDIO_EVIDENCE: RepositoryEvidence = {
path: 'packages/platform-apple/src/runtime.test.ts',
test: 'tvOS audio capture availability follows the exact host-owned runtime fact',
};
export const APPLE_HOVER_DENIAL_EVIDENCE: RepositoryEvidence = {
path: 'packages/platform-apple/src/runtime.test.ts',
test: 'hover has no Apple interactor route on macOS, iOS, or tvOS; the touch family reports its typed denial',
};
export const WEB_SMOKE_TEST_NAME = 'live web platform e2e smoke';
export const WEB_SMOKE_EVIDENCE: RepositoryEvidence = {
path: 'test/integration/smoke-web-platform.test.ts',
test: WEB_SMOKE_TEST_NAME,
};
export const LINUX_REPLAY_EVIDENCE: RepositoryEvidence = {
path: 'test/integration/replays/linux/01-desktop-smoke.ad',
test: '# Smoke test for Linux desktop automation on CI.',
};
export const LINUX_COMMAND_EVIDENCE: RepositoryEvidence = {
path: 'test/integration/linux-e2e/live-runner.ts',
test: 'runLinuxCommandEvidence',
};
export const LINUX_PROVIDER_EVIDENCE: RepositoryEvidence = {
path: 'test/integration/provider-scenarios/linux-desktop.test.ts',
test: 'Provider-backed integration Linux desktop flow uses semantic desktop and input providers',
};
export const LINUX_RUNTIME_EVIDENCE: RepositoryEvidence = {
path: 'packages/platform-linux/src/runtime.test.ts',
test: 'classifies the Linux $name lifecycle denominator against the legacy dispatch cell',
};
export const LINUX_HOVER_DENIAL_EVIDENCE: RepositoryEvidence = {
path: 'packages/platform-linux/src/runtime.test.ts',
test: 'hover has no Linux interactor route; the touch family reports its typed denial',
};