mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
d237bc555d
* chore: remove verified dead code and migration scaffolding Multi-agent audit of accumulated waste, every finding adversarially verified against call sites, git history, and the published surface before removal. Net -710 lines. - delete src/core/platform-descriptor/ (superseded ADR-0009 migration scaffold; parity tests now assert an inline table) - remove test-only seams: registry introspection exports, CommandFacet.extraDaemonWriters, MaestroEngineOptions.timing - remove dead flexibility: backend capability allow-list, screenshot-diff maxRegions, CloudWebDriverSupportLevel 'partial', clearFirst on the TS+Swift runner wire contract - remove dead deprecated surface: --session-locked / --session-lock-conflicts aliases (hard migration error now points at --session-lock), replay export --format single-value enum, unused Lease*Payload contract types, runtime-layer rotate duplicate - collapse pass-throughs/duplication: withRetry adapter, default-cloud-artifact-provider, connect-profile client-id hashing (3x sha256 impls -> one helper, byte-identical output), shared scripts walker, cloneValue -> structuredClone, fill-diagnostics moved into android/ BREAKING CHANGE: --session-locked and --session-lock-conflicts now fail with a migration error pointing at --session-lock; replay export --format is removed (Maestro was the only value); Lease*Payload types are dropped from the ./contracts subpath. * chore: satisfy fallow gates tightened by #1363/#1364 after rebase - drop the consumer-less AndroidFillVerificationNode re-export - reuse requireSnapshotSession in resolveSnapshotForRef instead of inlining the same authorized-frame resolution (fallow clone group); the helper's return type now guarantees the session it already throws for * chore: address review — keep cloud-webdriver partial capability metadata The partial/supported/unsupported levels and their notes are part of the lease-response capability contract for genuinely limited operations (Appium page-source snapshots, upload-then-install), not dead scaffolding. Restore them and the asserting tests unchanged from main. Also add the missing CHANGELOG entry for the Lease*Payload type removal from agent-device/contracts.
35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { COMMAND_OWNER_FILES } from '../src/core/command-descriptor/owner-files.ts';
|
|
import { getDaemonRouteOwnerFiles } from '../src/daemon/route-owner-files.ts';
|
|
import { walkFiles } from './lib/walk-files.ts';
|
|
|
|
const repoRoot = path.resolve(import.meta.dirname, '..');
|
|
const distRoot = path.join(repoRoot, 'dist', 'src');
|
|
const ownerPaths = new Set([
|
|
...Object.values(COMMAND_OWNER_FILES).flat(),
|
|
...Object.values(getDaemonRouteOwnerFiles()),
|
|
]);
|
|
const forbiddenMetadata = new Set(['ownerFiles', ...ownerPaths]);
|
|
|
|
const bundleFiles = walkFiles(distRoot).filter((file) => file.endsWith('.js'));
|
|
if (bundleFiles.length === 0) {
|
|
throw new Error('No dist/src JavaScript files found. Run `pnpm build` first.');
|
|
}
|
|
|
|
const leaks = bundleFiles.flatMap((file) => {
|
|
const content = fs.readFileSync(file, 'utf8');
|
|
return [...forbiddenMetadata]
|
|
.filter((value) => content.includes(value))
|
|
.map((value) => ({ file: path.relative(repoRoot, file), value }));
|
|
});
|
|
|
|
if (leaks.length > 0) {
|
|
const details = leaks.map(({ file, value }) => `- ${value} in ${file}`).join('\n');
|
|
throw new Error(`Owner-file navigation metadata leaked into production bundles:\n${details}`);
|
|
}
|
|
|
|
process.stdout.write(
|
|
`Verified the ownerFiles key and ${ownerPaths.size} owner-file paths are absent from ${bundleFiles.length} production bundles.\n`,
|
|
);
|