mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
* chore: baseline-free production-exports cleanup (#1276) Classify and burn down the 32 baseline-tolerated unused production exports. - Live seams: annotate with @internal JSDoc visibility tags (test hooks, introspection helpers, public install-source constant) so fallow no longer treats them as dead production exports. - Wrappers: collapse re-export wrappers in commands/index.ts (ref/selector) and daemon/lease-context.ts (buildLeaseDiagnosticsContext); update all importers to pull directly from the source module. - Stale baseline entry: remove the non-existent resetAndroidMultiTouchHelperInstallCache entry. - Empty fallow-baselines/production-unused-exports.json so check:production-exports now fails loudly on any new dead export. Fixes #1276 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore: address review feedback on production-exports cleanup (#1276) - CONTRIBUTING.md: document that intentional non-production exports should use JSDoc @internal with a short justification, treated as a reviewed baseline entry. - isPlatform: fix JSDoc tag to "@internal" and remove conflicting "public" wording. - ARCHIVE_EXTENSIONS: re-export from src/sdk/install-source.ts so the public install-source subpath has a real consumer story for the constant. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore: make production-exports check truly baseline-free (#1276) - Drop --baseline from pnpm check:production-exports and remove the check:production-exports:baseline generation script. - Delete fallow-baselines/production-unused-exports.json. - Update CONTRIBUTING.md to describe the baseline-free behavior and remove references to reviewed baseline entries for production unused exports. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
13b3d4fc88
commit
8246362999
+9
-11
@@ -59,21 +59,19 @@ intentionally accepting a finding.
|
||||
Code quality (production exports): `pnpm check:production-exports` runs Fallow's native
|
||||
production graph, which excludes test/story/dev files, and fails when a new export has no
|
||||
production consumer. This includes the test-only-export bug class that shipped in #1199's first
|
||||
revision, while also catching exports that are unreachable from every graph. Fallow's
|
||||
revision, while also catching exports that are unreachable from every graph. It is intentionally
|
||||
baseline-free: there is no grandfather file, so a new unused production export fails loudly. Fallow's
|
||||
`ignoreExportsUsedInFile` option in the gate's inherited config keeps exports with a real
|
||||
same-file consumer out of this report without weakening the general Fallow audit. The checked-in
|
||||
native baseline lives at `fallow-baselines/production-unused-exports.json`.
|
||||
same-file consumer out of this report without weakening the general Fallow audit.
|
||||
|
||||
Fix a finding by wiring the export into production or removing the unnecessary export/code. For
|
||||
an intentional test seam, explain why beside the declaration and keep the reviewed entry in the
|
||||
production-export baseline. An inline
|
||||
an intentional test seam or other non-production consumer, add a JSDoc `@internal` tag with a short
|
||||
justification beside the declaration. An inline
|
||||
`// fallow-ignore-next-line unused-export` is not suitable here: the general test-inclusive graph
|
||||
sees the test consumer and correctly reports that suppression as stale. Run
|
||||
`pnpm check:production-exports:baseline` only for a deliberate reviewed baseline migration or to
|
||||
remove stale entries; additions accept new production-unreachable exports and should be rare.
|
||||
Production usage reached only through dynamic property access remains invisible to a static
|
||||
import graph, so register those exports in `.fallowrc.json` `ignoreExports` instead (as with the
|
||||
daemon route handlers loaded through `typeof import()`).
|
||||
sees the test consumer and correctly reports that suppression as stale. Production usage reached
|
||||
only through dynamic property access remains invisible to a static import graph, so register those
|
||||
exports in `.fallowrc.json` `ignoreExports` instead (as with the daemon route handlers loaded
|
||||
through `typeof import()`).
|
||||
|
||||
Optional device selectors for tests:
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"unused_files": [],
|
||||
"unused_exports": [
|
||||
"src/cli/parser/args.ts:parseArgs",
|
||||
"src/cli/parser/command-suggestions.ts:listCommandAliasSuggestionEntries",
|
||||
"src/cloud-webdriver/aws-device-farm.ts:getAwsDeviceFarmWebDriverCapabilities",
|
||||
"src/cloud-webdriver/aws-device-farm.ts:createAwsDeviceFarmWebDriverRuntime",
|
||||
"src/cloud-webdriver/browserstack.ts:getBrowserStackWebDriverCapabilities",
|
||||
"src/cloud-webdriver/browserstack.ts:createBrowserStackWebDriverRuntime",
|
||||
"src/commands/command-metadata.ts:listCommandMetadataNames",
|
||||
"src/commands/command-surface.ts:listExecutableCommandNames",
|
||||
"src/commands/index.ts:ref",
|
||||
"src/commands/index.ts:selector",
|
||||
"src/commands/index.ts:commands",
|
||||
"src/commands/interaction/runtime/selector-read.ts:selector",
|
||||
"src/commands/interaction/runtime/selector-read.ts:ref",
|
||||
"src/core/command-descriptor/registry.ts:listDescriptorCatalogCommandNames",
|
||||
"src/core/command-descriptor/registry.ts:listDescriptorDispatchCommandNames",
|
||||
"src/core/command-descriptor/registry.ts:listCapabilityCheckedCommandNames",
|
||||
"src/core/command-descriptor/registry.ts:listCommandResponseDataTransforms",
|
||||
"src/core/dispatch.ts:listRegisteredDispatchCommandNames",
|
||||
"src/core/platform-plugin/plugin.ts:registeredPlatforms",
|
||||
"src/daemon/lease-context.ts:buildLeaseDiagnosticsContext",
|
||||
"src/kernel/device.ts:isPlatform",
|
||||
"src/platforms/android/ime-helper.ts:resetAndroidImeHelperInstallCache",
|
||||
"src/platforms/android/ime-lifecycle.ts:resetAndroidTestImeActivationCacheForTests",
|
||||
"src/platforms/android/ime-lifecycle.ts:setAndroidTestImeActiveForTests",
|
||||
"src/platforms/android/multitouch-helper.ts:resetAndroidMultiTouchHelperInstallCache",
|
||||
"src/platforms/android/snapshot-helper-install.ts:resetAndroidSnapshotHelperInstallCache",
|
||||
"src/platforms/android/snapshot-helper-session.ts:resetAndroidSnapshotHelperSessions",
|
||||
"src/platforms/apple/core/runner/runner-recycle-ledger.ts:resetRunnerRecycleLedgerForTests",
|
||||
"src/platforms/apple/core/runner/runner-transport.ts:clearDeviceTunnelIpCache",
|
||||
"src/platforms/install-source.ts:ARCHIVE_EXTENSIONS",
|
||||
"src/platforms/linux/linux-env.ts:resetInputToolCache",
|
||||
"src/provider-device-runtime.ts:setActiveProviderDeviceRuntimes",
|
||||
"src/utils/ttl-memo.ts:resetAllProcessMemosForTests"
|
||||
],
|
||||
"unused_types": [],
|
||||
"private_type_leaks": [],
|
||||
"unused_dependencies": [],
|
||||
"unused_dev_dependencies": [],
|
||||
"circular_dependencies": [],
|
||||
"re_export_cycles": [],
|
||||
"unused_optional_dependencies": [],
|
||||
"unused_enum_members": [],
|
||||
"unused_class_members": [],
|
||||
"unresolved_imports": [],
|
||||
"unlisted_dependencies": [],
|
||||
"duplicate_exports": [],
|
||||
"type_only_dependencies": [],
|
||||
"test_only_dependencies": [],
|
||||
"boundary_violations": [],
|
||||
"boundary_coverage_violations": [],
|
||||
"boundary_call_violations": [],
|
||||
"policy_violations": [],
|
||||
"stale_suppressions": [],
|
||||
"unused_catalog_entries": [],
|
||||
"empty_catalog_groups": [],
|
||||
"unresolved_catalog_references": [],
|
||||
"unused_dependency_overrides": [],
|
||||
"misconfigured_dependency_overrides": []
|
||||
}
|
||||
+1
-2
@@ -119,8 +119,7 @@
|
||||
"check:affected": "node --experimental-strip-types scripts/check-affected/run.ts",
|
||||
"check:affected:test": "node --experimental-strip-types --test scripts/check-affected/model.test.ts scripts/check-affected/run.test.ts",
|
||||
"check:layering": "node --experimental-strip-types --test scripts/layering/model.test.ts && node --experimental-strip-types scripts/layering/check.ts",
|
||||
"check:production-exports": "fallow dead-code --config fallow-production-exports.json --production --unused-exports --baseline fallow-baselines/production-unused-exports.json --fail-on-issues",
|
||||
"check:production-exports:baseline": "fallow dead-code --config fallow-production-exports.json --production --unused-exports --save-baseline fallow-baselines/production-unused-exports.json --summary",
|
||||
"check:production-exports": "fallow dead-code --config fallow-production-exports.json --production --unused-exports --fail-on-issues",
|
||||
"check:bundle-owner-files": "node --experimental-strip-types scripts/check-bundle-owner-files.ts",
|
||||
"check:quick": "pnpm lint && pnpm typecheck",
|
||||
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
|
||||
|
||||
@@ -38,6 +38,9 @@ type FinalizeArgsOptions = ParseArgsOptions & {
|
||||
defaultFlags?: Partial<CliFlags>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal High-level argv parser used by unit tests and build scripts.
|
||||
*/
|
||||
export function parseArgs(argv: string[], options?: FinalizeArgsOptions): ParsedArgs {
|
||||
return finalizeParsedArgs(parseRawArgs(argv), options);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ const COMMAND_ALIAS_SUGGESTIONS: Record<string, CommandAliasSuggestion> = {
|
||||
'close-session': { command: 'close', example: 'close' },
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Exposes the curated suggestion map for drift/parity tests.
|
||||
*/
|
||||
export function listCommandAliasSuggestionEntries(): Array<[string, CommandAliasSuggestion]> {
|
||||
return Object.entries(COMMAND_ALIAS_SUGGESTIONS);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ export type AwsDeviceFarmWebDriverRuntimeOptions = {
|
||||
prepareSession?: CloudWebDriverRuntimeOptions['prepareSession'];
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal AWS Device Farm capability builder used by integration tests.
|
||||
*/
|
||||
export function getAwsDeviceFarmWebDriverCapabilities(
|
||||
platform: CloudWebDriverPlatform,
|
||||
): CloudWebDriverProviderCapabilities {
|
||||
@@ -110,6 +113,9 @@ export function getAwsDeviceFarmWebDriverCapabilities(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal AWS Device Farm runtime factory used by integration tests.
|
||||
*/
|
||||
export function createAwsDeviceFarmWebDriverRuntime(
|
||||
options: AwsDeviceFarmWebDriverRuntimeOptions,
|
||||
): ProviderDeviceRuntime {
|
||||
|
||||
@@ -77,6 +77,9 @@ export type BrowserStackCapabilitiesOptions = {
|
||||
configured?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal BrowserStack capability builder used by integration tests.
|
||||
*/
|
||||
export function getBrowserStackWebDriverCapabilities(
|
||||
platform: CloudWebDriverPlatform,
|
||||
): CloudWebDriverProviderCapabilities {
|
||||
@@ -87,6 +90,9 @@ export function getBrowserStackWebDriverCapabilities(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal BrowserStack runtime factory used by integration tests.
|
||||
*/
|
||||
export function createBrowserStackWebDriverRuntime(
|
||||
options: BrowserStackWebDriverRuntimeOptions,
|
||||
): ProviderDeviceRuntime {
|
||||
|
||||
@@ -26,6 +26,9 @@ export function listMcpCommandMetadata(): AnyCommandMetadata[] {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by command surface parity tests.
|
||||
*/
|
||||
export function listCommandMetadataNames(): CommandName[] {
|
||||
return [...commandMetadataMap.keys()].sort();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ export async function runCommand(
|
||||
return await getCommandDefinition(name).invoke(client, input);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by command surface parity tests.
|
||||
*/
|
||||
export function listExecutableCommandNames(): CommandName[] {
|
||||
return [...commandMap.keys()].sort();
|
||||
}
|
||||
|
||||
@@ -44,8 +44,6 @@ import {
|
||||
type SystemCommands,
|
||||
} from './system/runtime/index.ts';
|
||||
|
||||
export { ref, selector } from './interaction/runtime/selector-read.ts';
|
||||
|
||||
export type {
|
||||
BoundRuntimeCommand,
|
||||
CommandResult,
|
||||
@@ -77,6 +75,9 @@ export type BoundAgentDeviceCommands = {
|
||||
observability: BoundObservabilityCommands;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Runtime command catalog used by parity/type tests.
|
||||
*/
|
||||
export const commands: AgentDeviceCommands = {
|
||||
capture: captureCommands,
|
||||
selectors: selectorCommands,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
localCommandPolicy,
|
||||
type CommandSessionStore,
|
||||
} from '../../../../../runtime.ts';
|
||||
import { ref } from '../../../../index.ts';
|
||||
import { ref } from '../../selector-read.ts';
|
||||
import { makeSnapshotState } from '../../../../../__tests__/test-utils/index.ts';
|
||||
|
||||
export function selectorSnapshot(): SnapshotState {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import { ref, selector } from '../../index.ts';
|
||||
import { ref, selector } from './selector-read.ts';
|
||||
import { AppError } from '../../../kernel/errors.ts';
|
||||
import {
|
||||
createInteractionDevice,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import { commands, selector } from '../../index.ts';
|
||||
import { commands } from '../../index.ts';
|
||||
import { selector } from './selector-read.ts';
|
||||
import { createInteractionDevice, selectorSnapshot } from './__tests__/test-utils/index.ts';
|
||||
|
||||
test('runtime interaction commands are available from the command namespace', async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { AgentDeviceBackend } from '../../../backend.ts';
|
||||
import { ref, selector } from '../../index.ts';
|
||||
import { ref, selector } from './selector-read.ts';
|
||||
import { createLocalArtifactAdapter } from '../../../io.ts';
|
||||
import {
|
||||
createAgentDevice,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { BackendSnapshotOptions } from '../../../backend.ts';
|
||||
import { ref, selector } from '../../index.ts';
|
||||
import { ref, selector } from './selector-read.ts';
|
||||
import { resolveActionableTouchResolution } from '../../../core/interaction-targeting.ts';
|
||||
import { tryResolveRefNode } from './resolution.ts';
|
||||
import { makeSnapshotState } from '../../../__tests__/test-utils/index.ts';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
localCommandPolicy,
|
||||
type CommandSessionStore,
|
||||
} from '../../../runtime.ts';
|
||||
import { ref, selector } from '../../index.ts';
|
||||
import { ref, selector } from './selector-read.ts';
|
||||
import { makeSnapshotState } from '../../../__tests__/test-utils/index.ts';
|
||||
import { createSelectorDevice, selectorReadSnapshot } from './__tests__/test-utils/index.ts';
|
||||
|
||||
|
||||
@@ -152,10 +152,16 @@ export type IsSelectorCommandOptions = CommandContext &
|
||||
target: SelectorTarget;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Target helper used by tests/examples; runtime callers compose `ElementTarget` directly.
|
||||
*/
|
||||
export function selector(expression: string): SelectorTarget {
|
||||
return { kind: 'selector', selector: expression };
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Target helper used by tests/examples; runtime callers compose `ElementTarget` directly.
|
||||
*/
|
||||
export function ref(refInput: string, options: { fallbackLabel?: string } = {}): RefTarget {
|
||||
return {
|
||||
kind: 'ref',
|
||||
|
||||
@@ -1159,6 +1159,9 @@ export const commandDescriptors = RAW_COMMAND_DESCRIPTORS.map((descriptor) => {
|
||||
/** The literal union of every registered command name. */
|
||||
export type Command = (typeof commandDescriptors)[number]['name'];
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by parity tests.
|
||||
*/
|
||||
export function listDescriptorCatalogCommandNames<Group extends CommandCatalogGroup>(
|
||||
group: Group,
|
||||
): Array<DescriptorCommandNameForCatalogGroup<Group>> {
|
||||
@@ -1181,6 +1184,9 @@ export function listDescriptorCatalogEntries<Group extends CommandCatalogGroup>(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by parity tests.
|
||||
*/
|
||||
export function listDescriptorDispatchCommandNames(): DescriptorDispatchCommandName[] {
|
||||
return commandDescriptors
|
||||
.filter((descriptor) => 'dispatch' in descriptor && descriptor.dispatch !== undefined)
|
||||
@@ -1195,6 +1201,9 @@ export function listMcpExposedCommandNames(): DescriptorCliCommandName[] {
|
||||
.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by parity tests.
|
||||
*/
|
||||
export function listCapabilityCheckedCommandNames(): DescriptorCliCommandName[] {
|
||||
return commandDescriptors
|
||||
.filter((descriptor) => isCapabilityCheckedCliCommand(descriptor))
|
||||
@@ -1282,6 +1291,9 @@ export function resolveCommandResponseDataTransform(
|
||||
return RESPONSE_DATA_TRANSFORM_BY_COMMAND.get(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by parity tests.
|
||||
*/
|
||||
export function listCommandResponseDataTransforms(): Array<{
|
||||
command: string;
|
||||
transform: CommandResponseDataTransform;
|
||||
|
||||
@@ -188,6 +188,9 @@ const DISPATCH_HANDLERS: Record<DispatchCommand, DispatchHandler> = {
|
||||
read: ({ device, positionals, context }) => handleReadCommand(device, positionals, context),
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal Introspection helper used by parity tests.
|
||||
*/
|
||||
export function listRegisteredDispatchCommandNames(): string[] {
|
||||
return Object.keys(DISPATCH_HANDLERS).sort();
|
||||
}
|
||||
|
||||
@@ -208,6 +208,9 @@ export function leaseScopeToConnectionMetadata(
|
||||
return Object.keys(connection).length > 0 ? connection : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Lease diagnostics seam exposed for unit tests.
|
||||
*/
|
||||
export function buildLeaseDiagnosticsContext(
|
||||
leaseScope: LeaseScope | undefined,
|
||||
): LeaseDiagnosticsContext | undefined {
|
||||
|
||||
@@ -185,7 +185,10 @@ export function tryGetPlugin(platform: Platform): PlatformPlugin | undefined {
|
||||
return registry.get(platform);
|
||||
}
|
||||
|
||||
/** The leaf platforms that currently carry a plugin, in registration order. */
|
||||
/**
|
||||
* @internal The leaf platforms that currently carry a plugin, in registration order.
|
||||
* Exposed for parity tests.
|
||||
*/
|
||||
export function registeredPlatforms(): Platform[] {
|
||||
return [...registry.keys()];
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import {
|
||||
buildLeaseDiagnosticsContext,
|
||||
buildSessionLeaseFromRequest,
|
||||
resolveRunnerLogicalLeaseContext,
|
||||
resolveRequestOrSessionLeaseScope,
|
||||
type SessionLease,
|
||||
} from '../lease-context.ts';
|
||||
import { buildLeaseDiagnosticsContext } from '../../core/lease-scope.ts';
|
||||
import type { DaemonRequest } from '../types.ts';
|
||||
|
||||
test('buildSessionLeaseFromRequest captures complete request lease scope', () => {
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
type ReplayTargetGuardDenotation,
|
||||
} from '../../../replay/target-identity-node.ts';
|
||||
import { makeSnapshotState } from '../../../__tests__/test-utils/index.ts';
|
||||
import { ref as interactionRef, selector } from '../../../commands/index.ts';
|
||||
import {
|
||||
ref as interactionRef,
|
||||
selector,
|
||||
} from '../../../commands/interaction/runtime/selector-read.ts';
|
||||
import { createInteractionDevice } from '../../../commands/interaction/runtime/__tests__/test-utils/index.ts';
|
||||
import { classifyReplayTarget } from '../session-replay-target-classification.ts';
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { RunnerLogicalLeaseContext } from '../core/runner-lease-context.ts'
|
||||
import { stripUndefined } from '../utils/parsing.ts';
|
||||
import {
|
||||
DEFAULT_PROXY_LEASE_TTL_MS,
|
||||
buildLeaseDiagnosticsContext,
|
||||
findMissingProxyLeaseFields,
|
||||
isProxyLeaseScope,
|
||||
leaseScopeFromRequest,
|
||||
@@ -13,12 +12,7 @@ import {
|
||||
type LeaseScope,
|
||||
} from '../core/lease-scope.ts';
|
||||
|
||||
export {
|
||||
DEFAULT_PROXY_LEASE_TTL_MS,
|
||||
buildLeaseDiagnosticsContext,
|
||||
findMissingProxyLeaseFields,
|
||||
isProxyLeaseScope,
|
||||
};
|
||||
export { DEFAULT_PROXY_LEASE_TTL_MS, findMissingProxyLeaseFields, isProxyLeaseScope };
|
||||
export type { LeaseDiagnosticsContext, LeaseScope };
|
||||
|
||||
export type SessionLease = {
|
||||
|
||||
@@ -142,6 +142,9 @@ export function resolveDeviceAppleOs(
|
||||
return 'ios';
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Type guard exposed for unit tests.
|
||||
*/
|
||||
export function isPlatform(value: unknown): value is Platform {
|
||||
// Internal device-platform membership derived from the canonical PLATFORMS tuple.
|
||||
return (PLATFORMS as readonly unknown[]).includes(value);
|
||||
|
||||
@@ -110,6 +110,9 @@ export const ensureAndroidImeHelper = makeEnsureAndroidHelperInstalled<AndroidIm
|
||||
helperLabel: HELPER_LABEL,
|
||||
});
|
||||
|
||||
/**
|
||||
* @internal Test isolation hook for process-global IME helper install cache.
|
||||
*/
|
||||
export function resetAndroidImeHelperInstallCache(): void {
|
||||
installedImeHelpers.clear();
|
||||
}
|
||||
|
||||
@@ -405,10 +405,16 @@ export async function listAndroidAdbSerialsQuick(): Promise<string[]> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Test isolation hook for the active test-IME device set.
|
||||
*/
|
||||
export function resetAndroidTestImeActivationCacheForTests(): void {
|
||||
activeTestImeDevices.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Test seam to force the active test-IME state for a device.
|
||||
*/
|
||||
export function setAndroidTestImeActiveForTests(device: DeviceInfo, active: boolean): void {
|
||||
const key = getAndroidImeHelperDeviceKey(device);
|
||||
if (active) {
|
||||
|
||||
@@ -29,7 +29,9 @@ export function forgetAndroidSnapshotHelperInstall(options: {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests reset the process-global install memo so cases do not share helper state.
|
||||
/**
|
||||
* @internal Test isolation hook for process-global snapshot helper install cache.
|
||||
*/
|
||||
export function resetAndroidSnapshotHelperInstallCache(): void {
|
||||
installedSnapshotHelpers.clear();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,9 @@ export function resolveAndroidSnapshotHelperSessionRequestTimeoutMs(params: {
|
||||
);
|
||||
}
|
||||
|
||||
// Tests stop persistent helper processes so cases cannot leak sessions into each other.
|
||||
/**
|
||||
* @internal Test isolation hook for persistent snapshot helper sessions.
|
||||
*/
|
||||
export async function resetAndroidSnapshotHelperSessions(): Promise<void> {
|
||||
await Promise.all(
|
||||
[...sessions.keys()].map((deviceKey) => stopAndroidSnapshotHelperSession(deviceKey)),
|
||||
|
||||
@@ -98,7 +98,9 @@ export function buildRunnerRecycleBudgetExhaustedError(
|
||||
);
|
||||
}
|
||||
|
||||
// Test isolation requires clearing process-global recycle accounting between cases.
|
||||
/**
|
||||
* @internal Test isolation hook for process-global runner recycle accounting.
|
||||
*/
|
||||
export function resetRunnerRecycleLedgerForTests(): void {
|
||||
ledger.clear();
|
||||
}
|
||||
|
||||
@@ -423,7 +423,9 @@ function invalidateDeviceTunnelIpCache(deviceId: string): void {
|
||||
deviceTunnelIpCache.delete(deviceId);
|
||||
}
|
||||
|
||||
// Test isolation requires clearing the process-global device tunnel cache between cases.
|
||||
/**
|
||||
* @internal Test isolation hook for the process-global device tunnel IP cache.
|
||||
*/
|
||||
export function clearDeviceTunnelIpCache(): void {
|
||||
deviceTunnelIpCache.clear();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ export type MaterializedInstallable = {
|
||||
|
||||
const INTERNAL_ARCHIVE_EXTENSIONS = ['.zip', '.tar', '.tar.gz', '.tgz'] as const;
|
||||
|
||||
/**
|
||||
* @public Archive extensions accepted by install-source resolution.
|
||||
*/
|
||||
export const ARCHIVE_EXTENSIONS = Object.freeze([...INTERNAL_ARCHIVE_EXTENSIONS] as const);
|
||||
const MAX_INSTALL_SOURCE_SEARCH_DEPTH = 5;
|
||||
const DEFAULT_SOURCE_DOWNLOAD_TIMEOUT_MS = 120_000;
|
||||
|
||||
@@ -55,7 +55,9 @@ export async function ensureInputTool(): Promise<{
|
||||
);
|
||||
}
|
||||
|
||||
/** Reset cached tool (for testing). */
|
||||
/**
|
||||
* @internal Test isolation hook for the cached Linux input tool.
|
||||
*/
|
||||
export function resetInputToolCache(): void {
|
||||
cachedInputTool = null;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,9 @@ export type ProviderDeviceRuntimeRequestProviders = {
|
||||
let activeProviderDeviceRuntimes: ProviderDeviceRuntime[] = [];
|
||||
const providerDeviceRuntimeScope = new AsyncLocalStorage<ProviderDeviceRuntime[]>();
|
||||
|
||||
/**
|
||||
* @internal Test isolation hook for the active provider runtime scope.
|
||||
*/
|
||||
export function setActiveProviderDeviceRuntimes(runtimes: ProviderDeviceRuntime[]): void {
|
||||
activeProviderDeviceRuntimes = [...runtimes];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export {
|
||||
ARCHIVE_EXTENSIONS,
|
||||
isTrustedInstallSourceUrl,
|
||||
validateDownloadSourceUrl,
|
||||
} from '../platforms/install-source.ts';
|
||||
|
||||
@@ -74,6 +74,10 @@ export function createTtlMemo<Key, Value>(options: TtlMemoOptions = {}): TtlMemo
|
||||
return memo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test isolation hook for process-global TTL memos.
|
||||
* @internal
|
||||
*/
|
||||
export function resetAllProcessMemosForTests(): void {
|
||||
for (const reset of processMemoResets) {
|
||||
reset();
|
||||
|
||||
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts';
|
||||
import type { SnapshotState } from '../../../src/kernel/snapshot.ts';
|
||||
import { ref } from '../../../src/commands/index.ts';
|
||||
import { ref } from '../../../src/commands/interaction/runtime/selector-read.ts';
|
||||
import { scenarioName } from './coverage-manifest.ts';
|
||||
import { buildInteractionResponseData } from '../../../src/daemon/handlers/interaction-touch-response.ts';
|
||||
import { NATIVE_REF_COVERAGE } from './native-ref.coverage.ts';
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import { ref, selector } from '../../../src/commands/index.ts';
|
||||
import { ref, selector } from '../../../src/commands/interaction/runtime/selector-read.ts';
|
||||
import { drawerWithVisibleTwinSnapshot } from './fixtures.ts';
|
||||
import { createContractDevice } from './runtime-harness.ts';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts';
|
||||
import type { Point } from '../../../src/kernel/snapshot.ts';
|
||||
import { ref } from '../../../src/commands/index.ts';
|
||||
import { ref } from '../../../src/commands/interaction/runtime/selector-read.ts';
|
||||
import { assertRpcOk } from '../provider-scenarios/assertions.ts';
|
||||
import { scenarioName, scenarioNames } from './coverage-manifest.ts';
|
||||
import { RUNTIME_REF_COVERAGE } from './runtime-ref.coverage.ts';
|
||||
|
||||
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { InteractionGuarantee } from '../../../src/contracts/interaction-guarantees.ts';
|
||||
import type { Point } from '../../../src/kernel/snapshot.ts';
|
||||
import { selector } from '../../../src/commands/index.ts';
|
||||
import { selector } from '../../../src/commands/interaction/runtime/selector-read.ts';
|
||||
import { assertRpcOk } from '../provider-scenarios/assertions.ts';
|
||||
import { scenarioName, scenarioNames } from './coverage-manifest.ts';
|
||||
import { RUNTIME_SELECTOR_COVERAGE } from './runtime-selector.coverage.ts';
|
||||
|
||||
Reference in New Issue
Block a user