Skip to content

feat: add builds/driver for playwright#884

Merged
fengmk2 merged 8 commits intocnpm:masterfrom
akkuman:feat-playwright-driver
Nov 18, 2025
Merged

feat: add builds/driver for playwright#884
fengmk2 merged 8 commits intocnpm:masterfrom
akkuman:feat-playwright-driver

Conversation

@akkuman
Copy link
Contributor

@akkuman akkuman commented Nov 12, 2025

https://playwright-ruby-client.vercel.app/docs/article/guides/download_playwright_driver#directly-download-driver-without-nodejs-installation

https://github.com/microsoft/playwright-python/blob/75ceca04b7f4b29c1c026130696568fca68c9e88/setup.py#L100-L117

https://github.com/playwright-community/playwright-go/blob/56e30d60f8b42785982469eaca6ad969bc2e1946/run.go#L341-L374

close #883

Summary by CodeRabbit

  • New Features

    • Adds a dedicated driver section with per-version, per-architecture driver downloads for recent releases and exposes beta releases under a “next” preview channel.
    • Supports multiple architectures and includes driver ZIP artifacts alongside existing browser builds.
  • Tests

    • Test coverage updated to include driver and driver/next directories and validate driver ZIP entries, filenames, URLs, sizes and dates.

@graphite-app
Copy link

graphite-app bot commented Nov 12, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • MQ - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds Playwright driver artifacts under /builds/driver/ (per-version, per-architecture ZIP entries), duplicates entries under /builds/driver/next/ when beta versions exist, and updates tests to expect the new driver/ directory and its contents.

Changes

Cohort / File(s) Change Summary
PlaywrightBinary adapter
app/common/adapter/binary/PlaywrightBinary.ts
Adds PLAYWRIGHT_DRIVER_ARCHS; inserts driver/ into the /builds/ listing; for recent package versions generates per-architecture playwright-<version>-<arch>.zip items with URL, size -, and date; detects beta versions and duplicates matching entries under /builds/driver/next/.
Tests
test/common/adapter/binary/PlaywrightBinary.test.ts
Updates /builds/ expectations to include driver/; fetches driver/ and driver/next/ contents and validates directory items and ZIP entries (names end with .zip, size -, URL and date present, URL matches Playwright driver ZIP pattern).

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Adapter as PlaywrightBinary
  participant Builds as /builds/

  Client->>Adapter: GET /builds/
  Adapter->>Adapter: fetch package versions (recent 20)
  loop each version
    Adapter->>Adapter: determine isBeta(version)
    loop each arch in PLAYWRIGHT_DRIVER_ARCHS
      Adapter->>Builds: add "playwright-<version>-<arch>.zip" (url, size '-', date)
    end
    alt isBeta
      Adapter->>Builds: also add same items under /builds/driver/next/
    end
  end
  Adapter->>Client: return builds tree (includes driver/ and optional driver/next/)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to:
    • Completeness and correctness of PLAYWRIGHT_DRIVER_ARCHS.
    • Beta detection and placement under /next/.
    • URL formatting/escaping for generated ZIP links.
    • Updated test expectations and coverage for both driver/ and driver/next/.

Possibly related PRs

Suggested reviewers

  • fengmk2
  • elrrrrrrr

Poem

🐰 I dug a tiny driver den to store,
Playwright zips for every arch and more.
Beta hops along into a next/ nest,
Stable sleeps safe where the main builds rest.
A rabbit’s tidy repo — zipped and blessed.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add builds/driver for playwright' accurately reflects the main change: adding a new builds/driver directory structure for Playwright driver artifacts.
Linked Issues check ✅ Passed The code changes implement the primary objective of providing Playwright binary driver artifacts under builds/driver with per-architecture support, directly addressing issue #883's requirement.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the builds/driver feature for Playwright drivers; no unrelated modifications were detected outside the stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @akkuman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Playwright binary adapter by integrating support for Playwright driver builds. It allows for the direct listing and download of specific Playwright driver versions across multiple operating systems and architectures, including a mechanism to handle beta releases. This feature streamlines the process of acquiring Playwright drivers, making them more accessible for various development and testing environments.

Highlights

  • Playwright Driver Builds: This pull request introduces the capability to list and provide download links for Playwright drivers.
  • Multi-Architecture Support: Drivers are now available for various architectures including Windows (x64), macOS (ARM64, x64), and Linux (ARM64, x64).
  • Beta Version Handling: A dedicated 'next/' directory is added within the driver builds to host beta versions of Playwright drivers.
  • Test Coverage: Corresponding unit tests have been updated to ensure the new 'driver/' directory is correctly recognized and listed in the build items.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for mirroring Playwright driver builds. The implementation correctly adds the driver directory, but there's a logic issue in how beta and stable versions are organized into subdirectories. I've provided a suggestion to fix this. Additionally, I've pointed out an opportunity to improve code maintainability by extracting a hardcoded array into a constant. Finally, I've recommended adding more comprehensive tests for the new functionality to ensure it works as expected.

assert.equal(result.items[5].name, 'ffmpeg/');
assert.equal(result.items[6].name, 'winldd/');
assert.equal(result.items[7].name, 'android/');
assert.equal(result.items[8].name, 'driver/');
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this assertion correctly checks for the presence of the driver/ directory, the new functionality for populating this directory and its potential next/ subdirectory is not tested. It would be beneficial to add more tests to verify that:

  • The /builds/driver/ directory contains the correct stable driver files.
  • If beta versions are present in the mock data, the next/ directory is created under /builds/driver/ and contains the beta driver files.
  • The URLs for the driver files are constructed correctly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
test/common/adapter/binary/PlaywrightBinary.test.ts (1)

74-95: Consider adding test coverage for the driver directory.

The test correctly verifies that driver/ appears in the /builds/ listing. However, unlike other directories (chromium, firefox, etc.), the driver directory is not included in the names array and therefore isn't tested for navigation in the loop at lines 96-158.

Consider adding test coverage similar to the existing browser directories to ensure the driver directory structure works correctly, especially for the beta/next subdirectory handling.

app/common/adapter/binary/PlaywrightBinary.ts (1)

420-437: Use consistent string quotes.

Lines 420, 422, and 437 use double quotes ("), while the rest of the file consistently uses single quotes (').

Consider changing to single quotes for consistency:

-      this.dirItems["/builds/driver/"] = []
+      this.dirItems['/builds/driver/'] = []
       if (packageVersions.some(version => version.includes('-beta-'))) {
-        this.dirItems["/builds/driver/"].push({
+        this.dirItems['/builds/driver/'].push({
           name: 'next/',
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95543b1 and bcc1069.

📒 Files selected for processing (2)
  • app/common/adapter/binary/PlaywrightBinary.ts (2 hunks)
  • test/common/adapter/binary/PlaywrightBinary.test.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
test/common/adapter/binary/PlaywrightBinary.test.ts (1)
app/common/adapter/binary/PrismaBinary.ts (1)
  • result (85-144)
🔇 Additional comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

385-391: LGTM!

The driver directory entry is added correctly using the same pattern as browser directories.


432-432: Architecture names verified as correct; no changes needed.

The verification confirms all specified architectures are valid and available from Playwright's official driver repository. While the naming convention does mix underscores (win32_x64) and hyphens (mac-arm64, linux-arm64), this reflects Playwright's own driver artifact naming—not an error in the code.

@fengmk2 fengmk2 requested a review from Copilot November 12, 2025 02:25
@fengmk2 fengmk2 self-assigned this Nov 12, 2025
@fengmk2 fengmk2 added the enhancement New feature or request label Nov 12, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Playwright driver downloads organized by version and architecture. The implementation follows the pattern used in playwright-python and playwright-go projects to expose driver binaries for direct download without requiring Node.js installation.

  • Adds a new /builds/driver/ directory structure with multi-architecture support (Windows x64, macOS ARM64/x64, Linux ARM64/x64)
  • Beta versions are exposed under a next subdirectory for preview access
  • Generates driver listings for the most recent 20 package versions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 14 comments.

File Description
app/common/adapter/binary/PlaywrightBinary.ts Implements driver directory structure with architecture-specific download URLs and beta version handling
test/common/adapter/binary/PlaywrightBinary.test.ts Updates test assertions to account for the new driver directory in builds listing
Comments suppressed due to low confidence (2)

app/common/adapter/binary/PlaywrightBinary.ts:392

  • Avoid automated semicolon insertion (94% of all statements in the enclosing function have an explicit semicolon).
      })

app/common/adapter/binary/PlaywrightBinary.ts:430

  • Avoid automated semicolon insertion (94% of all statements in the enclosing function have an explicit semicolon).
        })

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

16-16: Consider using single quotes for consistency.

The array elements use double quotes, but the project's Prettier configuration specifies singleQuote: true. While the linter should catch this, consider applying the style directly.

Apply this diff:

-const PLAYWRIGHT_DRIVER_ARCHS = ["win32_x64", "mac-arm64", "mac", "linux-arm64", "linux"];
+const PLAYWRIGHT_DRIVER_ARCHS = ['win32_x64', 'mac-arm64', 'mac', 'linux-arm64', 'linux'];

433-453: Consider refactoring for improved code quality.

Several optional improvements to enhance maintainability:

  1. The driverFileName variable is defined but its value is repeated in the loop body. Consider computing it once per version iteration.
  2. The driverURL variable uses let but could be const with a ternary operator.
  3. The beta version check version.includes('-beta-') is called twice and could be cached as isBeta.
  4. String literals should use single quotes for consistency with the project's Prettier configuration.

Apply this diff to address these improvements:

       packageVersions.forEach(version => {
         // https://github.com/playwright-community/playwright-go/blob/56e30d60f8b42785982469eaca6ad969bc2e1946/run.go#L341-L374
+        const isBeta = version.includes('-beta-');
         PLAYWRIGHT_DRIVER_ARCHS.forEach(arch => {
-          const driverFileName = `playwright-${version}-${arch}.zip`
-          let driverURL = DOWNLOAD_HOST + `builds/driver/${driverFileName}`
-          if (version.includes('-beta-')) {
-            driverURL = DOWNLOAD_HOST + `builds/driver/next/${driverFileName}`
-          }
+          const driverFileName = `playwright-${version}-${arch}.zip`;
+          const driverURL = isBeta
+            ? DOWNLOAD_HOST + `builds/driver/next/${driverFileName}`
+            : DOWNLOAD_HOST + `builds/driver/${driverFileName}`;
           const driverItem = {
             name: driverFileName,
             isDir: false,
             url: driverURL,
             size: '-',
             date: version,
-          }
-          this.dirItems["/builds/driver/"].push(driverItem)
-          if (version.includes('-beta-')) {
-            this.dirItems["/builds/driver/next/"].push(driverItem)
+          };
+          this.dirItems['/builds/driver/'].push(driverItem);
+          if (isBeta) {
+            this.dirItems['/builds/driver/next/'].push(driverItem);
           }
         });
       });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cb7586 and bc9e36f.

📒 Files selected for processing (2)
  • app/common/adapter/binary/PlaywrightBinary.ts (3 hunks)
  • test/common/adapter/binary/PlaywrightBinary.test.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/common/adapter/binary/PlaywrightBinary.test.ts
🔇 Additional comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

386-392: LGTM!

The driver directory entry follows the same pattern as the browser directories and integrates cleanly with the existing structure.


420-453: Review comment is incorrect.

The driver logic at lines 420-453 is already covered by existing test cases in test/common/adapter/binary/PlaywrightBinary.test.ts (lines 86-103). The tests verify:

  • Driver directory structure creation (/builds/driver/)
  • Separation of stable and beta versions (/builds/driver/next/)
  • File naming and URL generation with the expected pattern
  • The next/ subdirectory entry creation when beta versions exist

No action is required; the code changes are already tested.

Likely an incorrect or invalid review comment.

@akkuman akkuman force-pushed the feat-playwright-driver branch from 6179697 to e2ddf9f Compare November 12, 2025 03:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

420-432: Add missing semicolon for consistency.

The beta version detection and next/ directory initialization logic is correct. However, the statement on line 430 is missing a trailing semicolon.

Apply this diff:

         this.dirItems['/builds/driver/'].push({
           name: 'next/',
           isDir: true,
           url: '',
           size: '-',
           date: 'next',
-        });
+        });
         this.dirItems['/builds/driver/next/'] = [];
       }

Wait, looking more carefully:

-        });
+        });

Actually on line 430, it shows }); which already has the semicolon closing the push statement. Let me re-examine... The issue is on line 430 the closing should be }); not just }). Let me check the annotated code again:

Line 424-430 shows:

...

If line 430 shows }); then it already has the semicolon. Let me not comment on this unless I'm certain there's an issue.
[scratchpad_end] -->


433-452: Separate beta and stable driver files into correct directories.

Beta driver files are incorrectly being added to both /builds/driver/ and /builds/driver/next/. This means /builds/driver/ contains both stable and beta releases, when it should contain only stable releases.

Expected behavior:

  • /builds/driver/ should contain only stable driver files
  • /builds/driver/next/ should contain only beta driver files

Based on learnings

Apply this diff to properly separate the files:

       packageVersions.forEach(version => {
         PLAYWRIGHT_DRIVER_ARCHS.forEach(arch => {
+          const isBeta = version.includes('-beta-');
           const driverFileName = `playwright-${version}-${arch}.zip`;
-          const driverURL = version.includes('-beta-')
+          const driverURL = isBeta
             ? DOWNLOAD_HOST + `builds/driver/next/playwright-${version}-${arch}.zip`
             : DOWNLOAD_HOST + `builds/driver/playwright-${version}-${arch}.zip`;
           const driverItem = {
             name: driverFileName,
             isDir: false,
             url: driverURL,
             size: '-',
             date: version,
           };
-          this.dirItems['/builds/driver/'].push(driverItem);
-          if (version.includes('-beta-')) {
-            this.dirItems['/builds/driver/next/'].push(driverItem);
-          }
+          const targetDir = isBeta ? '/builds/driver/next/' : '/builds/driver/';
+          this.dirItems[targetDir].push(driverItem);
         });
       });
🧹 Nitpick comments (2)
test/common/adapter/binary/PlaywrightBinary.test.ts (1)

86-107: Fix string quote style for consistency.

The test logic correctly validates driver directory contents, including file names, URLs, and metadata. However, string literals use double quotes instead of single quotes, inconsistent with the project's Prettier configuration (singleQuote: true).

Apply this diff to fix the quote style:

       const driverDirs = [
-        "driver/",
-        "driver/next/"
+        'driver/',
+        'driver/next/',
       ];
       for (const dirname of driverDirs) {
         result = await binary.fetch(`/builds/${dirname}`);
         for (const item of result.items) {
           if (item.isDir) {
-            assert.ok(item.name === "next/");
+            assert.ok(item.name === 'next/');
           } else {
app/common/adapter/binary/PlaywrightBinary.ts (1)

386-392: Add missing semicolon for consistency.

The logic correctly adds the driver/ directory entry to the builds listing. However, the statement is missing a trailing semicolon, which is inconsistent with the coding style used throughout this file.

Apply this diff:

       buildDirs.push({
         name: 'driver/',
         isDir: true,
         url: '',
         size: '-',
         date: nowDateISO,
-      })
+      });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc9e36f and 6179697.

📒 Files selected for processing (2)
  • app/common/adapter/binary/PlaywrightBinary.ts (3 hunks)
  • test/common/adapter/binary/PlaywrightBinary.test.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
test/common/adapter/binary/PlaywrightBinary.test.ts (1)
app/common/adapter/binary/PrismaBinary.ts (1)
  • result (85-144)
🔇 Additional comments (3)
test/common/adapter/binary/PlaywrightBinary.test.ts (2)

74-74: LGTM - Correct item count adjustment.

The expected count properly reflects the addition of the driver/ directory to the builds listing.


83-83: LGTM - Validates new driver directory.

The assertion correctly checks for the presence of the driver/ directory in the builds listing.

app/common/adapter/binary/PlaywrightBinary.ts (1)

16-16: LGTM - Well-defined constant.

The PLAYWRIGHT_DRIVER_ARCHS constant properly extracts the supported architectures, improving maintainability and readability.

@akkuman akkuman force-pushed the feat-playwright-driver branch from e2ddf9f to b32d6e4 Compare November 12, 2025 03:37
@fengmk2 fengmk2 enabled auto-merge November 12, 2025 04:31
@fengmk2
Copy link
Member

fengmk2 commented Nov 12, 2025

@elrrrrrrr 下次部署这个也带上😁

auto-merge was automatically disabled November 12, 2025 05:35

Head branch was pushed to by a user without write access

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
app/common/adapter/binary/PlaywrightBinary.ts (1)

448-450: Verify the intended directory structure for beta drivers.

The current implementation adds all drivers (both stable and beta) to /builds/driver/ (line 448), and additionally adds beta drivers to /builds/driver/next/ (line 450). This means beta drivers appear in both directories.

Previous review comments suggested that beta drivers should only appear in /builds/driver/next/ and stable drivers only in /builds/driver/ (similar to the suggested fix by coderabbitai[bot] and gemini-code-assist[bot]). Those comments were marked as addressed, but the current code doesn't match that structure.

If the current behavior is intentional (all drivers in the main directory, with a filtered beta view in next/), then this is fine. Otherwise, consider whether beta drivers should be exclusive to the next/ directory.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2ddf9f and 806d5e7.

📒 Files selected for processing (2)
  • app/common/adapter/binary/PlaywrightBinary.ts (3 hunks)
  • test/common/adapter/binary/PlaywrightBinary.test.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/common/adapter/binary/PlaywrightBinary.test.ts
🔇 Additional comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

16-17: LGTM!

Good practice extracting the architecture list as a named constant. This improves maintainability and follows the pattern suggested in previous reviews.


387-393: LGTM!

The driver directory entry is properly added to the builds structure, consistent with the existing browser directory entries.

@fengmk2 fengmk2 enabled auto-merge November 12, 2025 05:51
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.19%. Comparing base (0f11e77) to head (de0440a).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #884      +/-   ##
==========================================
- Coverage   95.35%   95.19%   -0.17%     
==========================================
  Files         197      197              
  Lines       23856    23948      +92     
  Branches     2504     2495       -9     
==========================================
+ Hits        22749    22797      +48     
- Misses       1107     1151      +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

auto-merge was automatically disabled November 12, 2025 06:05

Head branch was pushed to by a user without write access

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

437-440: Consider simplifying URL construction to reduce duplication.

The URL construction repeats builds/driver/ in both branches of the ternary. This can be consolidated for better maintainability.

Apply this diff to simplify:

         const isBetaVersion = version.includes('-beta-');
         const driverFileName = `playwright-${version}-${arch}.zip`;
-        const driverURL = isBetaVersion
-          ? DOWNLOAD_HOST + `builds/driver/next/${driverFileName}`
-          : DOWNLOAD_HOST + `builds/driver/${driverFileName}`;
+        const driverPath = `builds/driver/${isBetaVersion ? 'next/' : ''}${driverFileName}`;
+        const driverURL = DOWNLOAD_HOST + driverPath;

422-450: Consider using single quotes for string consistency.

Several string literals use double quotes (e.g., lines 422, 425, 432, 448, 450) while the rest of the file uses single quotes. For consistency with the project's style conventions, consider using single quotes throughout.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 806d5e7 and 310906d.

📒 Files selected for processing (1)
  • app/common/adapter/binary/PlaywrightBinary.ts (3 hunks)
🔇 Additional comments (2)
app/common/adapter/binary/PlaywrightBinary.ts (2)

16-17: LGTM: Architecture constant is well-defined.

The PLAYWRIGHT_DRIVER_ARCHS constant appropriately centralizes the supported architectures and aligns with the Playwright Go reference implementation.


387-393: LGTM: Driver directory entry follows existing pattern.

The driver directory entry is correctly added to buildDirs and follows the same structure as browser directories.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/common/adapter/binary/PlaywrightBinary.ts (1)

16-17: Consider documenting architecture list maintenance.

The architecture list is derived from the Playwright Go implementation. Consider adding a note or TODO to periodically verify this list against Playwright's official supported platforms, especially when upgrading to new Playwright versions.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 310906d and 5aff838.

📒 Files selected for processing (1)
  • app/common/adapter/binary/PlaywrightBinary.ts (3 hunks)
🔇 Additional comments (4)
app/common/adapter/binary/PlaywrightBinary.ts (4)

16-17: LGTM: Constant extraction improves maintainability.

The architecture list is now properly extracted to a named constant at the top level, which addresses previous feedback and makes it easier to maintain.


387-393: LGTM: Directory entry follows established pattern.

The new 'driver/' directory entry is consistent with the existing browser directory structure.


434-451: LGTM: Directory separation logic is correct.

The critical issue from previous reviews has been properly fixed. Each driver file is now pushed to exactly one directory:

  • Stable versions → /builds/driver/
  • Beta versions → /builds/driver/next/

The code correctly computes targetDir based on isBetaVersion and pushes each item only once, eliminating the previous duplication problem.


421-451: Verify test coverage for driver logic.

Per fengmk2's earlier request, ensure that unit tests cover the driver directory logic, including:

  • Stable versions appearing only in /builds/driver/
  • Beta versions appearing only in /builds/driver/next/
  • Correct URL construction for both paths
  • Proper initialization of the next/ subdirectory when beta versions exist

The AI summary mentions test updates, but please confirm tests are comprehensive.

@fengmk2 fengmk2 enabled auto-merge November 18, 2025 12:02
@fengmk2 fengmk2 disabled auto-merge November 18, 2025 12:19
@fengmk2 fengmk2 merged commit 93034bf into cnpm:master Nov 18, 2025
18 of 19 checks passed
fengmk2 pushed a commit that referenced this pull request Nov 18, 2025
[skip ci]

## 4.12.0 (2025-11-18)

* feat: add builds/driver for playwright (#884) ([93034bf](93034bf)), closes [#884](#884) [#883](#883)
* feat: add ffmpeg-builds binary mirror (#879) ([d7de1cd](d7de1cd)), closes [#879](#879)
* feat: try to avoid recalculating integrity (#880) ([4859ce8](4859ce8)), closes [#880](#880)
* chore: add deployment test (#874) ([0d32146](0d32146)), closes [#874](#874)
* chore: Configure Renovate (#845) ([f3f3584](f3f3584)), closes [#845](#845)
* chore(deps): update actions/attest-build-provenance action to v3 (#847) ([957f43d](957f43d)), closes [#847](#847)
* chore(deps): update actions/checkout action to v5 (#849) ([e8a3ee5](e8a3ee5)), closes [#849](#849)
* chore(deps): update actions/first-interaction action to v3 (#850) ([35a7be3](35a7be3)), closes [#850](#850)
* chore(deps): update actions/setup-node action to v6 (#851) ([3671c52](3671c52)), closes [#851](#851)
* chore(deps): update dependency lint-staged to v16 (#853) ([e1848c7](e1848c7)), closes [#853](#853)
* chore(deps): update dependency mocha to v11.7.4 (#846) ([4213bd8](4213bd8)), closes [#846](#846)
* chore(deps): update dependency oxlint-tsgolint to ^0.3.0 (#863) ([0c987a7](0c987a7)), closes [#863](#863)
* chore(deps): update dependency oxlint-tsgolint to ^0.5.0 (#875) ([95543b1](95543b1)), closes [#875](#875)
* chore(deps): update dependency oxlint-tsgolint to ^0.7.0 (#885) ([06a3ae1](06a3ae1)), closes [#885](#885)
* chore(deps): update dependency type-fest to v5 [skip ci] (#871) ([01385f4](01385f4)), closes [#871](#871)
* fix(deps): update dependency npm-package-arg to v13 (#866) ([c3059c7](c3059c7)), closes [#866](#866)
* fix(deps): update dependency read-env-value to v2 (#869) ([098c75a](098c75a)), closes [#869](#869)
* fix(deps): update dependency ssri to v13 (#870) ([0f11e77](0f11e77)), closes [#870](#870)
* fix(deps): update dependency validate-npm-package-name to v7 [skip ci] (#873) ([6c29f08](6c29f08)), closes [#873](#873)
* refactor: use all in one egg v4 (#855) ([89f1250](89f1250)), closes [#855](#855)
@github-actions
Copy link

🎉 This PR is included in version 4.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@elrrrrrrr
Copy link
Member

https://registry.npmmirror.com/binary.html?path=playwright/builds/driver/

@akkuman 😄 看看产物对吗

@akkuman
Copy link
Contributor Author

akkuman commented Nov 20, 2025

https://registry.npmmirror.com/binary.html?path=playwright/builds/driver/

@akkuman 😄 看看产物对吗

对,是这个

@fengmk2
Copy link
Member

fengmk2 commented Nov 20, 2025

发现一个长期问题,playwright 的这种不按目录分版本的更新速度,30 年后这个 html 页面是没法打开了(;¬_¬)
还好 api 是直接读取一个文件

@akkuman
Copy link
Contributor Author

akkuman commented Nov 24, 2025

发现一个长期问题,playwright 的这种不按目录分版本的更新速度,30 年后这个 html 页面是没法打开了(;¬_¬) 还好 api 是直接读取一个文件

这种在 s3 上都不是一个好的目录结构,list 这个目录的压力会很大,也不知道上游是为什么搞成这样

@fengmk2
Copy link
Member

fengmk2 commented Nov 24, 2025

发现一个长期问题,playwright 的这种不按目录分版本的更新速度,30 年后这个 html 页面是没法打开了(;¬_¬) 还好 api 是直接读取一个文件

这种在 s3 上都不是一个好的目录结构,list 这个目录的压力会很大,也不知道上游是为什么搞成这样

我猜访问都是直接拼接 url 的,所以没有考虑 list 的方式。

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

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

playwright 二进制,缺少 builds/driver

3 participants

Comments