Skip to content

refactor(browserstack): extract the v2 provider plugin - #4579

Open
thymikee wants to merge 8 commits into
0.22from
fix/a1-extraction-unused-import-20261116
Open

thymikee wants to merge 8 commits into
0.22from
fix/a1-extraction-unused-import-20261116

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Extract BrowserStack into private @agent-device/browserstack for #3309. Preserve shared WebDriver behavior. Install with agent-device plugins add @agent-device/browserstack before connecting.

Head 589c8d3f38f46ed60cd41d0e1fb4ccb5c0fea640 targets 0.22 at 2408a3702d487c9bad93776eba5fd71383351e8f, after #4578 merged. Actual layer: 80 files/2142 gross lines; default-main: 419 files/12879 gross, including integration changes.

Validation

Earlier b41/854 failed typecheck/Numeric Ranges and R11. The private build-config owner removes the tsdown declaration edge and boundary escapes. Intermediate8f8 omitted project declarations; current root/SDK/consumer references supply them. At 589, type-only Rolldown and its lock importer are devDependencies. Fresh independent source recheck found no actionable repair/interactions findings. Fallow944 passed.

Current iOS smoke failed: attempt1 reached General but Back was unconfirmed; attempts2–3 failed destination waits. Completed trace diagnosis found no proven source cause. Selected-node geometry/ref generation/native hit identity are missing. Apple aggregate propagates this failure. No base-pass or infrastructure waiver exists.

Pinned pnpm11.17/Node26.8.1 frozen install, full-repository format, root and four consumer builds passed. At clean589, the requested packed checker passed: isolated installation, strict exports, typed rejection and fixture-backed CLI connect. Scratch tarballs were removed. Broad local tests/typecheck/lint/gates remain deferred to CI.

Rank thread resolved. Sentinel589 has no visible findings; lockfile and one out-of-diff finding were omitted. Size589 succeeded, with verified digest; this proves Size only.

Real packed BrowserStack/video-log evidence remains open. Keep private:true until placeholder/trusted publisher and usable publication are verified. Planned0.22 guidance stays per maintainer decision.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.10 MB 6.08 MB -15.6 kB
Package (unpacked) 6.10 MB 6.08 MB -15.6 kB
Package (download) 1.85 MB 1.85 MB -4.9 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.6 ms 23.1 ms -0.5 ms
CLI --help 45.3 ms 47.1 ms +1.8 ms

@thymikee
thymikee added this pull request to stack #4580 November 16, 2026 08:40

@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.

1 issue found across 66 files

You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="website/docs/docs/browserstack.md">

<violation number="1" location="website/docs/docs/browserstack.md:11">
P1: `plugins add` fetches this package from npm, but `provider-browserstack` remains `private: true` and the release publisher rejects private tarballs, so this PR cannot publish what the guide tells users to install. Gate this instruction until a supported package source is available.</violation>
</file>

Reply with feedback, questions, or to request a fix.

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

## Install the plugin

```bash
agent-device plugins add @agent-device/browserstack

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.

P1: plugins add fetches this package from npm, but provider-browserstack remains private: true and the release publisher rejects private tarballs, so this PR cannot publish what the guide tells users to install. Gate this instruction until a supported package source is available.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At website/docs/docs/browserstack.md, line 11:

<comment>`plugins add` fetches this package from npm, but `provider-browserstack` remains `private: true` and the release publisher rejects private tarballs, so this PR cannot publish what the guide tells users to install. Gate this instruction until a supported package source is available.</comment>

<file context>
@@ -3,7 +3,17 @@ title: BrowserStack
+## Install the plugin
+
+```bash
+agent-device plugins add @agent-device/browserstack
+```
+
</file context>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is retained as a publication prerequisite, rather than a temporary code workaround. The maintainer explicitly directed us to keep planned 0.22 install guidance and avoid temporary availability hardening. The package remains private; its placeholder, trusted publisher and usable publication must be verified separately. No claim is made that the package is already available, and the source repair at b41e2fe does not waive that release work.

Comment thread website/docs/docs/browserstack.md Resolved
@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

1 new finding away from what changed since 94489a2 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (38e815742740).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of 94489a20 · 16.11.2026 11:11 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

The changes are the same as on 09f643a, so this is that review, not a new one. Comment @apex-sentinel-staging review to review again.

No open findings.

Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

Reviewed with this repository's own Sentinel configuration (ef19edc2a540).

Review of 09f643af · 16.11.2026 10:52 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

Reviewed with this repository's own Sentinel configuration (ef19edc2a540).

Review of 85438c3d · 16.11.2026 10:19 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

1 new finding away from what changed since b41e2fe not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (ef19edc2a540).

Review of b41e2fec · 16.11.2026 10:11 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (ef19edc2a540).

Review of 5bc427f1 · 16.11.2026 08:47 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/provider-browserstack/src/index.ts:3 Public options type requires both credential keys the code documents as optional
Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

Reviewed with this repository's own Sentinel configuration (b96eb82b1b2a).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 1 new finding on 5bc427f. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

I found two problems at 5bc427f to fix before merge.

The provider scenario suite does not compile on this head. The diff removed the RunHostCommand type import from cloud-webdriver-provider-adapters.test.ts, but FakeAwsHostCommand.run still uses it. CI reports TS2304 there, so Lint, Typecheck & Package and Numeric Ranges fail. Please restore the type import.

The PR body says the packed-plugin check and the live run were not done. This change is device-facing: lease allocation and session creation now go through the plugin registry instead of the bundled provider list. Nothing yet shows that the bundled dist loads from AGENT_DEVICE_HOME and drives a real App Automate session. Please run node scripts/check-provider-plugin.mjs packages/provider-browserstack on the packed package. Please also record one live session at this head with the packed tarball: plugins add, connect browserstack, open, snapshot, close, and artifacts that return a BrowserStack video or log URL.

The open inline threads still apply: private package cannot be published (merging removes bundled support before the package can install), README plugin never passed, and loose smoke server, state directory wording, changeset daemon stop and credentials type, which are lower priority. The publishConfig.exports thread does not apply: publishConfig.exports replaces exports at publish, so the packed package advertises only . and ./agent-device, both built by tsdown, the same as provider-testmu. You can resolve it.

Not blocking, take or leave: the factory in provider-browserstack/src/index.ts is a near copy of the TestMu one with the variable names changed, and tmp-dir.fixtures.ts is now the eighth copy of mkdtempForTest. Could the credential overlay and fingerprint variable derivation live in @agent-device/provider-webdriver/plugin as one helper keyed by an option-to-variable map? Also, a user with a saved BrowserStack connection and no plugin installed gets 'remote command requires daemonBaseUrl' from connection-runtime.ts instead of the plugin-not-installed error, because the capability lookup falls back to remote-provider. I traced this but did not run it. Raising the plugin error from that one lookup when the profile's provider has a catalog declaration would fix it. Last, sameOsVersion in plugin.ts can join the existing webdriver-utils.ts export block.

The Fallow audit and the import-direction check also fail on this head. Fallow reports new exports, dependency and clone findings that overlap the new package and the copied factory. The import-direction check fails on the new provider-browserstack zone. I did not read their full logs, and I did not isolate the Coverage failure. The unused readRemoteConnectionState lint error in src/__tests__/cloud-connect-profile.test.ts comes from the base commit, not this diff.

Before merge, please restore the import, clear the Fallow and import-direction failures, and add the packed check and live session evidence. The package also needs to be publishable before or with this merge. There are no conflicts.

@thymikee
thymikee force-pushed the fix/a1-extraction-unused-import-20261116 branch from 5bc427f to b41e2fe Compare November 16, 2026 10:02

@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.

All reported issues were addressed across 13 files (changes from recent commits).

You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

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

Comment thread scripts/layering/model.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. The review of 5bc427f (#4579 (comment)) is partly addressed: the README example, the smoke-test 404 path, and the daemon stop --state-dir step in the docs and changeset are fixed at 09f643a. One problem remains, and the check below fails on this head.

Repo Guards fails in "Check import-direction DAG" (R11, package-boundaries.test.ts:837): @agent-device/build-config depends on rolldown, but the root package.json does not declare it. The new package comes from this PR, so the failure is related to the change. The later Repo Guards steps, including Fallow, were skipped, so I cannot tell whether the earlier Fallow findings are cleared.

This change is device-facing: BrowserStack lease allocation and session creation now go through the v2 plugin registry and the plugin's tsdown dist, and the bundled provider is removed. The last commits changed the built artifact again (shared build config, a second connection-verification entry, new publishConfig exports) in package.json. I see no packed check and no live session recorded. Without them, nothing shows that the packed dist loads from AGENT_DEVICE_HOME and drives a real App Automate session. Please run node scripts/check-provider-plugin.mjs packages/provider-browserstack on the packed tarball at the final head and post the output. Please also record one live session with that tarball: plugins add <tarball>, daemon stop --state-dir <path>, connect browserstack with the exact device, OS and app, then open, snapshot, close, and the artifacts output that returns a BrowserStack video or log URL. A run from the workspace source does not count.

Not blocking, take or leave: ./connection-verification (and ./package.json) in publishConfig.exports plus the second tsdown entry exist only for a vi.mock target in src/cli/commands/connection-browserstack.test.ts; the earlier review found the packed package correctly exposed only . and ./agent-device, so keeping that subpath in the workspace exports only, or mocking the plugin's connection.verify in that test, would keep the public surface small.

Does this extraction need a new workspace package, a new external dependency (rolldown) and a new layering rank? Could the BrowserStack tsdown config keep the shape of provider-testmu's at the base? If the Fallow clone finding needs a shared owner, could @agent-device/build-config land as its own PR that migrates every copy of the UNRESOLVED_IMPORT policy (maestro, replay, tv-cdp, root, proxy, the three providers) and declares rolldown 1.2.5 in the root dependency set in the same change? This PR would then only consume it. Either way, R11 needs the root range to match, or build-config must type its options without a new external dependency.

Open threads: the thread on the package staying private: true while the docs and changeset tell users to plugins add @agent-device/browserstack still stands (#4579 (comment)); the package must be publishable before or with the merge. These threads do not apply and can be resolved: the optional username/accessKey typing is already fixed (#4579 (comment)), and the build-config rank thread is moot because the failing gate is the rolldown range, not the rank (#4579 (comment)). The remaining threads are fixed at this head: #4579 (comment), #4579 (comment), #4579 (comment), #4579 (comment), #4579 (comment).

The large diff stat includes the rebase onto #4578; I reviewed only this PR's own commits.

Before merge: declare rolldown 1.2.5 in the root dependency set (or drop build-config from this PR), get Repo Guards and Fallow green, make the package publishable, then post the packed check and the live packed-tarball session.

Base automatically changed from fix/a1-test-isolation-unused-import-20261116 to 0.22 November 16, 2026 11:11
…rowserstack plugin

Move the BrowserStack provider modules and tests out of provider-webdriver into
packages/provider-browserstack, packaged like the TestMu plugin (bundled ESM,
type-only agent-device/plugins, ./agent-device export, version 2 factory).
provider-webdriver keeps the shared engine and its ./plugin surface. Core no
longer registers BrowserStack; connect browserstack without the plugin fails
with the existing plugin-not-installed error naming plugins add
@agent-device/browserstack. The package stays private until its npm placeholder
and trusted publisher exist.
Document plugins add @agent-device/browserstack in the BrowserStack, device
cloud and plugins guides, the README and the plugin package README, and add a
changeset.
@thymikee
thymikee force-pushed the fix/a1-extraction-unused-import-20261116 branch from 09f643a to 94489a2 Compare November 16, 2026 11:11
@thymikee

thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member Author

The actionable root-range finding is fixed in 589c8d3. Rolldown is used only by an erased type import, so its declaration and lockfile importer now use devDependencies. The existing root runtime dependency assertion, real InputOptions type, composite project and strict bundler callback are unchanged. The fresh independent source recheck found no actionable issues in the two-field repair and its affected interactions.

At that exact clean head, pinned pnpm11.17/Node26.8.1 frozen install and build succeeded. The requested command also exited 0:

node scripts/check-provider-plugin.mjs packages/provider-browserstack
Packed @agent-device/browserstack: isolated install, host-recognized errors, and CLI connect passed.

It packed the current checkout, installed core and plugin in isolated directories, checked the strict export map and absence of core/peer dependencies in the plugin installation, and exercised credential rejection plus connect against the local HTTP fixture. This is packed-contract evidence, not a live BrowserStack session. The checker removes its scratch tarballs after completion; no retained live-artifact provenance is claimed.

The rank concern is resolved with its source rationale. The real App Automate session, video/log artifact evidence and placeholder/trusted-publisher prerequisites remain open. No temporary unavailable-package guidance was added. Hosted checks at older heads remain attributed to those heads; fresh CI is pending.

@thymikee

Copy link
Copy Markdown
Member Author

The rolldown R11 fix from the earlier review (09f643a) is now in place. One problem from that review remains at 589c8d3, and the posted evidence is still short of what it needs.

The BrowserStack help, docs tell users to run plugins add @agent-device/browserstack (https://github.com/callstack/agent-device/blob/589c8d3/website/docs/docs/browserstack.md#L11). But packages/provider-browserstack/package.json is still private: true, so scripts/release-workspace.mjs never publishes it. This PR also removes the bundled BrowserStack provider from provider-webdriver. After a 0.22 release from this branch, a user who follows the help gets an npm 404, and BrowserStack support is gone. Please make every surface that says plugins add @agent-device/browserstack name a package the release publisher ships. Dropping private: true does this once the npm placeholder and trusted publisher exist, the same as testmu and revyl. If that is not ready, please record a maintainer-approved merge hold on 0.22. The reply citing a maintainer decision to keep the guidance does not make the package publishable.

The open review thread on the same point still applies: #4579 (comment)

For validation, please post one live BrowserStack App Automate session driven by the packed tarball at the final head. It should show plugins add <packed .tgz> into a fresh AGENT_DEVICE_HOME, daemon stop --state-dir <path>, and connect browserstack with the exact device, OS version and bs:// app. Then it should show open <app>, snapshot with a real tree, close, and the artifacts output with a BrowserStack video or log URL. A run from workspace source does not count, and the posted packed-contract checker output uses the local HTTP fixture. I did not rerun that checker.

Smoke Tests (ios) and the aggregate Smoke Tests fail on local-simulator Settings navigation. This diff does not touch that path, so they look unrelated, but I had no failure excerpt or base run to confirm. There are no conflicts. Before merge, the package must be publishable (or the hold recorded) and the live session must be posted.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant