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.
What
Removes ~670 net lines of adversarially-verified dead code accumulated over the last months of fast iteration. Sourced from a multi-agent audit (12 finders over every subsystem + cross-cutting lenses; each candidate finding then attacked by an independent skeptic checking call sites, git history, and the published API surface — 7 of 29 candidates were refuted and are not in this PR).
Removed
Superseded migration scaffolding
src/core/platform-descriptor/deleted entirely. Its capability table was an identity mapping kept alive only as a "frozen oracle" for parity tests of the completed ADR-0009 migration. The two dependent parity tests now assert an inline platform→bucket table; the one silent production dependency (plugin.tsimporting theCapabilityBuckettype) is inlined as a 4-literal union.rotatecommand duplicate incommands/system/runtime— unreachable since chore: remove deprecatedrotatecommand alias (and audit remaining command-name shims) at next minor #1277 removed the CLI alias. The published SDK back-compat wrapper inagent-device-client.tsis untouched (it delegates toorientationindependently and stays until next major).Test-only seams & dead flexibility (each verified to have zero production callers)
CommandFacet.extraDaemonWriters+ merge loop; registry introspection exports (listDescriptorDispatchCommandNames/listCapabilityCheckedCommandNames, inlined into their tests);MaestroEngineOptions.timingoverride; backend capability allow-list (BACKEND_CAPABILITY_NAMES/allowNamedBackendCapabilities, always[]); screenshot-diffmaxRegions;clearFirston both the TS and Swift sides of the runner wire contract.— dropped after review: theCloudWebDriverSupportLevel'partial'partiallevel and its notes are lease-response capability metadata for genuinely limited operations (Appium page-source snapshots, upload-then-install), not dead code. Reverted to main's state unchanged.Deprecated surface (breaking, see below)
--session-locked/--session-lock-conflictsaliases across 4 layers;resolveLockModecollapses to a single override path. Both flags now fail withUnknown flag: --session-locked. Use --session-lock reject|strip instead.via the existingformatUnknownFlagMessagemechanism.replay export --format— a single-value enum (maestro) with an unreachable "unsupported format" branch; export always emits Maestro YAML.Lease*Payloadtypes from./contracts— zero consumers, duplicatedDaemonRequestMeta; their runtime validators were already removed in refactor: remove production-unused exports #1203.Pass-throughs & duplication collapsed
withRetry/RetryOptions(field-renaming adapter overretryWithPolicy, one caller, silently dropped policy defaults);default-cloud-artifact-provider.ts(single-caller interface wrapper, now inline at the daemon-runtime call site); connect-profile client-id hashing (3 identical sha256 helpers → onebuildConnectClientId, per-profile field lists preserved so hash outputs are byte-identical); sharedscripts/lib/walk-files.tsfor the two strip-types guard scripts;cloneValue→structuredClone;fill-diagnosticsmoved from sharedsrc/platforms/intoandroid/(its only consumer — the "cross-platform" framing was fiction).Breaking changes
Pre-1.0, all previously deprecated or dead:
--session-locked/--session-lock-conflicts→ hard migration error pointing at--session-lockreplay export --formatremoved (maestrowas the only legal value; behavior unchanged)LeaseAllocatePayload/LeaseHeartbeatPayload/LeaseReleasePayloadtypes dropped from the./contractssubpathCHANGELOG entries added for all three.
Verification
lint·typecheck·check:layering(877 files OK) ·check:production-exports·check:fallow(76 changed files, no issues) ·check:mcp-metadata·build·check:bundle-owner-files· unit suite (unit-core+android-adb; two runs hit the known contention-timeout flake in daemon spawn tests — changing failure set, timeout-only, all pass in isolation) · smoke 14/14 ·test:integration:progress:check(flag partition: 0 unclassified, 65/65 covered) ·format:check.The Swift edit (
clearFirstremoval inRunnerTests+Models.swift/RunnerTests+TextEntry.swift) is verified:pnpm build:xcuitest:ios— TEST BUILD SUCCEEDED (Xcode 26.2).Post-review updates: rebased onto
main@317469f35; #1363/#1364's tightened fallow gates required two follow-up fixes (dropped a consumer-lessAndroidFillVerificationNodere-export;resolveSnapshotForRefnow reusesrequireSnapshotSessioninstead of inlining the same authorized-frame block). CHANGELOG gained theLease*Payloadbreaking entry.Deliberately not in this PR
runCli()decomposition (cli.ts:86-476) — real altitude problem, but a refactor deserving its own reviewBoundOf<T>for the 6 pass-throughbindXCommandsfamilies (selector/interaction must stay hand-written — 11/17 entries reshape signatures){command,positionals,flags}shape (~90 lines) — scheduled for next major, warning already in place