Skip to content

Commit 6b42560

Browse files
authored
chore(bots): hand triage, review, tasks and rolls to the Playwright bot (#3330)
1 parent 18175f8 commit 6b42560

7 files changed

Lines changed: 137 additions & 652 deletions

File tree

‎.claude/skills/playwright-triage/SKILL.md‎

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
---
22
name: playwright-triage
3-
description: Triage and fix one microsoft/playwright-python issue, or do a maintainer's task, unattended inside the Issue triage GitHub Actions workflow (.github/workflows/triage.yml), which a needs-triage, needs-triage-mac or needs-triage-win label starts, or a maintainer starts by hand with an issue, a task or both. Reproduces the issue on the runner, then leaves a verified fix proposal for the workflow to open as a draft PR, an investigation note for it to post on the issue, or an upstream bug report for a maintainer to file in microsoft/playwright. Only for that workflow.
3+
description: Triage and fix an issue in microsoft/playwright-python. How to use the upstream checkout, how to run a published version, how to tell a bug of the Python client from an upstream one, the upstream bug report, and what not to run from a PR of a third party.
44
---
55

66
# Playwright Python Issue Triage
77

8-
You run unattended in the [Issue triage](../../../.github/workflows/triage.yml) workflow of
9-
`microsoft/playwright-python`. First read the shared guide, `$AGENT_GUIDES_DIR/triage.md`, a copy of
10-
[microsoft/playwright/.github/actions/run-agent/guides/triage.md](https://github.com/microsoft/playwright/blob/main/.github/actions/run-agent/guides/triage.md),
11-
and then [AGENTS.md](../../../AGENTS.md), both in full. The guide says how to triage an issue in any
12-
Playwright repo. AGENTS.md says how to build, test and lint this one, and where a regression test
13-
goes. This file covers what neither has: the checkouts, how to run a published version, and the
14-
outcome that this repo adds, an upstream bug report.
15-
16-
## The checkouts
17-
18-
`$REPO_DIR` is the checkout of `microsoft/playwright-python` that the guide describes. Its requirements
19-
are installed (`pip install -r local-requirements.txt`, `pip install -r requirements.txt`,
20-
`pip install -e .`), the wheel is built (`python -m build --wheel`, which builds the driver into
21-
`playwright/driver/`), and Chromium, Firefox and WebKit are installed with
22-
`python -m playwright install --with-deps`. It is the working directory, and the checkout that the
23-
guides refer to. The clone is shallow: run `git fetch --unshallow --tags origin` in it before you
24-
bisect or use `git tag --contains`.
25-
26-
`$PLAYWRIGHT_DIR` is `$REPO_DIR/.upstream/`, a full clone of `microsoft/playwright` at the commit
27-
in `DRIVER_VERSION`, created by `python scripts/upstream.py checkout`. The driver was built from it.
28-
Read upstream code there. Do not edit, commit or switch branches in it: the wheel build and
29-
`./scripts/lint.sh` stop when it is not at that commit or has local changes. Before you run upstream
30-
tests in it, it needs `npm ci`, `npm run build` and `npx playwright install`. The wheel build
31-
(`scripts/build_driver.py`) ran the first two there; run them again when `node_modules/` is missing.
8+
## Upstream
9+
10+
`.upstream/` is the clone of `microsoft/playwright` at the commit in `DRIVER_VERSION`, as
11+
[AGENTS.md](../../../AGENTS.md) says. The driver is built from it. Read upstream code there. Do not
12+
edit, commit or switch branches in it: the wheel build and `./scripts/lint.sh` stop when it is not
13+
at that commit or has local changes. Before you run upstream tests in it, it needs `npm ci`,
14+
`npm run build` and `npx playwright install`. The wheel build (`scripts/build_driver.py`) runs the
15+
first two there; run them again when `node_modules/` is missing.
3216

3317
## Published versions
3418

35-
To run a published version, for example to bisect, create `$SCRATCH_DIR/playwright-python-<n>/<version>/`
36-
and run there:
19+
To run a published version, for example to bisect, create an empty directory outside the repo for
20+
each version, and run there:
3721

3822
```bash
3923
python -m venv env && source env/bin/activate # env\Scripts\activate on Windows
@@ -43,41 +27,38 @@ python -m playwright install
4327

4428
The fixtures of the repo are not available there. Write the condensed repro as a plain script with
4529
`sync_playwright()` or `async_playwright()` in that directory, with `page.set_content()` in place of
46-
the test server, and run it from there. In `$REPO_DIR`, the source tree shadows the installed package.
30+
the test server, and run it from there. In this repo, the source tree shadows the installed
31+
package.
4732

4833
The driver of a release is in `DRIVER_VERSION` at its tag: `git show v<version>:DRIVER_VERSION`
4934
prints the upstream commit it was built from, or, for releases up to 1.64, the `playwright-core`
5035
version of the driver; `npm view playwright-core@<core version> gitHead` prints its commit. Match a
51-
regression in the driver to commits with `git -C $PLAYWRIGHT_DIR log <good>..<bad> -- <path>`.
36+
regression in the driver to commits with `git -C .upstream log <good>..<bad> -- <path>`.
5237

5338
## Upstream bugs
5439

55-
The client talks to the Node driver that is built from `$PLAYWRIGHT_DIR`, and `microsoft/playwright`
40+
The client talks to the Node driver that is built from `.upstream/`, and `microsoft/playwright`
5641
and this repo are one team. Reproduce the bug in Python first. Then write the same calls as an
57-
upstream test and run it in `$PLAYWRIGHT_DIR`. The triage skill of `microsoft/playwright`, in
58-
`$PLAYWRIGHT_DIR/.claude/skills/playwright-triage/`, says where such a test goes, which fixtures it
59-
uses and how to run it. The rest of that skill is not for this run. Put the test in a new spec
60-
file, and delete the file when you are done, so that the checkout is clean.
42+
upstream test and run it in `.upstream/`. The triage skill of `microsoft/playwright`, in
43+
`.upstream/.claude/skills/playwright-triage/`, says where such a test goes, which fixtures it uses
44+
and how to run it. Use only those parts of it. Put the test in a new spec file, and delete the file
45+
when you are done, so that the checkout is clean.
6146

6247
- The Node test passes: the bug is in the Python client. Fix it here.
6348
- The Node test fails too: the root cause is upstream, and the fix lands in `microsoft/playwright`.
64-
Do not work around it in `playwright/_impl/`. Run `git -C $PLAYWRIGHT_DIR fetch origin main`.
65-
When `git -C $PLAYWRIGHT_DIR log HEAD..origin/main -- <path>` shows a fix that already landed,
66-
the note says that it reaches this repo with the next roll. Otherwise write the report.
49+
Do not work around it in `playwright/_impl/`. Run `git -C .upstream fetch origin main`. When
50+
`git -C .upstream log HEAD..origin/main -- <path>` shows a fix that already landed, it reaches
51+
this repo with the next roll: say so. Otherwise write the report.
6752
- The Python API lacks a member or an option: the generated API has everything that the upstream
68-
docs in `$PLAYWRIGHT_DIR/docs/src/api` give Python (`* langs:` decides; no `langs` means every
53+
docs in `.upstream/docs/src/api` give Python (`* langs:` decides; no `langs` means every
6954
language). The gap is in the docs, so it is an upstream change too. Do not edit a generated file,
7055
and do not add to `scripts/codegen/python_rules.js` to go around the docs.
7156

7257
The report is for an engineer of `microsoft/playwright` who did not read the Python issue: what
7358
fails, expected versus actual, the versions (the Python package, the commit in `DRIVER_VERSION`, the
7459
browser, the platform), the root cause when you found it, and the condensed Node test as the repro.
7560
The title has at most 256 characters, for example `route.fulfill() drops the charset of
76-
Content-Type`.
77-
78-
The bot never files it in `microsoft/playwright`: this run allows no `issue` call (the calls are
79-
in `$AGENT_GUIDES_DIR/calls.d.ts`). Put the report at the end of your comment, for a maintainer to
80-
file, in this form:
61+
Content-Type`. A maintainer files it in `microsoft/playwright`. Give it in this form:
8162

8263
`````markdown
8364
Upstream bug report, for a maintainer to file in microsoft/playwright:
@@ -94,7 +75,7 @@ Upstream bug report, for a maintainer to file in microsoft/playwright:
9475
</details>
9576
`````
9677

97-
Write the rest of the comment as the note: the verdict, the evidence, and that the bug is upstream.
78+
With it, give the verdict, the evidence, and that the bug is upstream.
9879

9980
## PRs from third parties
10081

‎.github/actions/setup-triage-runner/action.yml‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

‎.github/workflows/review.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Hands the pull request to the Playwright bot when a maintainer applies agent-review. Nothing
2+
# else of the bot lives in this repo. Apply the label again to start another run.
3+
name: "Agent: review"
4+
5+
on:
6+
# Runs from the default branch, for PRs from forks too. It never checks out the PR.
7+
pull_request_target:
8+
types: [labeled]
9+
10+
permissions: {}
11+
12+
jobs:
13+
pr:
14+
name: Hand the PR to the bot
15+
if: github.repository_owner == 'microsoft' && github.event.label.name == 'agent-review'
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
steps:
19+
- uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
20+
id: app-token
21+
with:
22+
client-id: ${{ vars.PLAYWRIGHT_APP_CLIENT_ID }}
23+
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
24+
owner: microsoft
25+
repositories: devops.playwright.dev
26+
permission-actions: write
27+
- name: Start the bot
28+
env:
29+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
30+
NUMBER: ${{ github.event.pull_request.number }}
31+
run: >-
32+
gh workflow run pr.yml --repo microsoft/devops.playwright.dev --ref main
33+
-f repo="$GITHUB_REPOSITORY" -f pr="$NUMBER"

‎.github/workflows/revision.yml‎

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)