Skip to content

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

Merged
thymikee merged 4 commits into
mainfrom
refactor/test-colocation-media-platforms
Oct 15, 2026
Merged

thymikee merged 4 commits into
mainfrom
refactor/test-colocation-media-platforms

Conversation

@thymikee

@thymikee thymikee commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

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

Old New Module under test
platform-web __tests__/agent-browser-boundary-faults agent-browser-provider-boundary-faults agent-browser-provider.ts
platform-web __tests__/agent-browser-dispatch-disclosure agent-browser-provider-dispatch-disclosure agent-browser-provider.ts
platform-web __tests__/agent-browser-record-refresh agent-browser-provider-record-refresh agent-browser-provider.ts (its header already says "agent-browser-provider's owned-process record gate")
platform-web __tests__/agent-browser-record-retention agent-browser-provider-record-retention agent-browser-provider.ts
platform-android __tests__/dispatch-disclosure __tests__/index-dispatch-disclosure package entry (drives several android modules against the contracts table)
platform-android recording/failed-finish recording/runtime-failed-finish recording/runtime.ts (bindAndroidScreenRecordingRuntime)
host-kit internal/durable-file internal/atomic-file-durable internal/atomic-file.ts (publishDurableFileSync)
kernel presented-surface record-presented-surface record.ts (readPresentedSurfaceFact)
provider-webdriver webdriver-mutation-resend webdriver-interactor-mutation-resend webdriver-interactor.ts
provider-webdriver provider-profile-fields split → browserstack-profile-fields, aws-device-farm-profile-fields, index-profile-fields browserstack.ts, aws-device-farm.ts, index.ts (BUNDLED_CLOUD_WEBDRIVER_PROVIDERS)
platform-vega __tests__/plugin src/index.test.ts index.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)

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 15 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.25 MB 5.25 MB 0 B
Package (unpacked) 5.25 MB 5.25 MB 0 B
Package (download) 1.58 MB 1.58 MB +4 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.6 ms 28.3 ms -0.3 ms
CLI --help 83.3 ms 83.5 ms +0.2 ms

thymikee and others added 4 commits October 15, 2026 14:42
…ver and vega tests for the module they test

Pure renames; the only content changes are the vega test's self-import
(now relative) and the dispatch-disclosure driver path that names the web test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…module it covers

browserstack-profile-fields, aws-device-farm-profile-fields and
index-profile-fields each sit beside their module; the shared
consumedProfileFields helper joins the package's profile-fields fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sure driver never reaches

A temporary spy on the mocked cleanupManagedAgentBrowserOrphansForProviderStartup
recorded zero calls across all eight cases, so the mock and its hoisted spy did nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e entry

The driver exercises input-actions, text-input, touch-helper and the adb
executor against the contracts table, so it takes the package entry's name.
The owning-path strings in the contracts fixture follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the refactor/test-colocation-media-platforms branch from 8d26a35 to ab774b6 Compare October 15, 2026 12:42
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at ab774b6. The test moves look correct, and I found nothing that needs a change. Not blocking: the removed mock of cleanupManagedAgentBrowserOrphansForProviderStartup in agent-browser-provider-dispatch-disclosure.test.ts means the real orphan cleanup could now run if a case sets openWebSessionNames and the managed install exists, so you may want to confirm the test helper never sets it, or take or leave this. I did not run the tests or the guards locally, and I did not check that the removed mock was unreachable. CI has not finished: the queued Repo Guards, Coverage, Integration and Smoke jobs have not failed, and they need to go green before merge. There are no conflicts.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 15, 2026
@thymikee
thymikee merged commit 35c21b6 into main Oct 15, 2026
18 of 19 checks passed
@thymikee
thymikee deleted the refactor/test-colocation-media-platforms branch October 15, 2026 13:57
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-15 15:29 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant