refactor(tests): colocate platform-web, android, host-kit, kernel, webdriver and vega tests

Merged
TH
14h ago
+71-78

Summary

Colocation renames for the small packages (platform-web, platform-android, host-kit, kernel, provider-webdriver, platform-vega). Every renamed test is now named for the module it exercises and sits beside it. No fixture export is touched here (those come in later PRs), so the fixture decision table is empty.

The rule thread's colocation baseline and R83 list are not on main yet. This PR only shrinks what the seed will contain: 11 offenders removed (web 4, android 2, host-kit 1, kernel 1, webdriver 2, vega 1).

Commits

  1. refactor(tests): name platform-web, android, host-kit, kernel, webdriver and vega tests… — pure git mv. Content changes: the vega test's self-import @agent-device/platform-vega → ./index.ts, and the web driver's owning-path string in contracts/src/dispatch-disclosure.fixtures.ts.
  2. refactor(webdriver): split the profile-field declaration test… — provider-profile-fields.test.ts covered three modules, so it became one file per module; the shared consumedProfileFields helper joined profile-fields.fixtures.ts.
  3. test(web): drop the provider-startup cleanup mock the dispatch-disclosure driver never reaches — per coordinator decision: a temporary spy on the mocked cleanupManagedAgentBrowserOrphansForProviderStartup recorded 0 calls across all 8 cases (the real function was never reachable), so the mock and its hoisted spy are deleted. 8/8 still pass.
  4. refactor(android): name the dispatch-disclosure driver for the package entry — dispatch-disclosure.test.ts → index-dispatch-disclosure.test.ts (it drives input-actions, text-input, touch-helper and the adb executor); both owning-path strings in the contracts fixture follow in the same commit.

Renames

OldNewModule under test
platform-web __tests__/agent-browser-boundary-faultsagent-browser-provider-boundary-faultsagent-browser-provider.ts
platform-web __tests__/agent-browser-dispatch-disclosureagent-browser-provider-dispatch-disclosureagent-browser-provider.ts
platform-web __tests__/agent-browser-record-refreshagent-browser-provider-record-refreshagent-browser-provider.ts (its header already says "agent-browser-provider's owned-process record gate")
platform-web __tests__/agent-browser-record-retentionagent-browser-provider-record-retentionagent-browser-provider.ts
platform-android __tests__/dispatch-disclosure__tests__/index-dispatch-disclosurepackage entry (drives several android modules against the contracts table)
platform-android recording/failed-finishrecording/runtime-failed-finishrecording/runtime.ts (bindAndroidScreenRecordingRuntime)
host-kit internal/durable-fileinternal/atomic-file-durableinternal/atomic-file.ts (publishDurableFileSync)
kernel presented-surfacerecord-presented-surfacerecord.ts (readPresentedSurfaceFact)
provider-webdriver webdriver-mutation-resendwebdriver-interactor-mutation-resendwebdriver-interactor.ts
provider-webdriver provider-profile-fieldssplit → browserstack-profile-fields, aws-device-farm-profile-fields, index-profile-fieldsbrowserstack.ts, aws-device-farm.ts, index.ts (BUNDLED_CLOUD_WEBDRIVER_PROVIDERS)
platform-vega __tests__/pluginsrc/index.test.tsindex.ts (vegaPlugin)

Vega note: index.test.ts is a new file for the module that defines vegaPlugin, not an addition to a legacy aggregation. If the reviewer would rather not have an index.test.ts, say so and I'll pick another module; plugin is not a module in that package.

Test-count parity (vitest --reporter=json, passed/total)

BeforeAfter
web agent-browser-boundary-faults 4/4agent-browser-provider-boundary-faults 4/4
web agent-browser-dispatch-disclosure 8/8agent-browser-provider-dispatch-disclosure 8/8
web agent-browser-record-refresh 12/12agent-browser-provider-record-refresh 12/12
web agent-browser-record-retention 3/3agent-browser-provider-record-retention 3/3
android dispatch-disclosure 20/20index-dispatch-disclosure 20/20
android failed-finish 1/1runtime-failed-finish 1/1
host-kit durable-file 6/6atomic-file-durable 6/6
kernel presented-surface 6/6record-presented-surface 6/6
webdriver webdriver-mutation-resend 25/25webdriver-interactor-mutation-resend 25/25
webdriver provider-profile-fields 3/3browserstack-… 1/1 + aws-device-farm-… 1/1 + index-… 1/1
vega plugin 2/2index.test.ts 2/2
Total 90/90 in 11 filesTotal 90/90 in 13 files

Selection: every moved file lives under packages/*/src/**, which the unit-core include covers (vitest.config.ts). pnpm check:affected --run selected and passed 25 files including all of the renamed ones; check:gate-manifest is unchanged.

vi.mock effectiveness

The three moved tests with vi.mock stay in their directories, so the mocked relative paths are unchanged. I still broke each path once (temporarily, reverted):

  • agent-browser-provider-record-refresh (mocks ../agent-browser-process-record.ts): 8 failed | 4 passed.
  • agent-browser-provider-record-retention (mocks ../agent-browser-process-record.ts): 2 failed | 1 passed.
  • agent-browser-provider-dispatch-disclosure: its mock was dead (0 calls) and is removed in commit 3.

Surface

  • Package exports counts before → after: unchanged for every package (0 subpaths added or removed).
  • Colocation offenders (my recompute matches the coordinator's count): web 4→0, host-kit 1→0, kernel 1→0, vega 1→0, webdriver 2→0, android 3→1 (the remaining one is input-ownership, handed to the contracts worker).

Reported, not changed

  • platform-android/src/__tests__/input-ownership.test.ts tests the contracts module android-input-ownership; per the coordinator it moves to packages/contracts via the selectors/contracts worker, not here.

Gates

Run on the final head (all exit 0): pnpm check:quick, check:layering, check:fallow, check:gate-manifest, check:affected --run (all exit 0), plus pnpm format (clean tree).

🤖 Generated with Claude Code