From d50bfedb4e0c1245292b398b9f0cbc539697073b Mon Sep 17 00:00:00 2001 From: 0xpantera <0xpantera@proton.me> Date: Fri, 19 Jun 2026 13:52:23 +0200 Subject: [PATCH 1/2] docs: require branch hygiene preflight --- AGENTS.md | 15 +++++++++++++++ CLAUDE.md | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 71db85f..2a4a266 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,6 +28,21 @@ Treat key material with care. - Test: `cargo test --workspace`. - Bump the git GPUI stack: `just bump-gpui` (the ONLY way to change those pins). +## Branch hygiene — required before edits +Before changing files, always establish the current branch and its source-of-truth status: + +1. Run `git status --short --branch`. +2. If on `main`, run `git fetch origin --prune`, fast-forward from `origin/main`, then create a new + feature branch before editing. +3. If not on `main`, run `git fetch origin --prune` and check whether the branch has already been + merged into current `origin/main`. + - If it has been merged, switch back to `main`, fast-forward from `origin/main`, and create a new + feature branch before editing. + - If it has not been merged, inspect the branch's upstream/ahead/behind state and update local + state before editing. Do not stack unrelated work on a stale or merged branch. +4. If there are uncommitted changes, identify whether they are user changes before switching, + rebasing, stashing, or applying patches. + ## Definition of done (all must hold; show command output as evidence) 1. `cargo fmt --all --check` clean 2. `just check` green (both feature configs) diff --git a/CLAUDE.md b/CLAUDE.md index f209c70..44988a4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,6 +32,22 @@ before you're done. (For UI work you must build the app: `just check`.) 4. No new or changed dependencies (`Cargo.toml` / `Cargo.lock`) unless explicitly approved (the git GPUI stack is bumped only via `just bump-gpui` — never hand-edit those pins) +## Branch hygiene — required before edits + +Before changing files, always establish the current branch and its source-of-truth status: + +1. Run `git status --short --branch`. +2. If on `main`, run `git fetch origin --prune`, fast-forward from `origin/main`, then create a new + feature branch before editing. +3. If not on `main`, run `git fetch origin --prune` and check whether the branch has already been + merged into current `origin/main`. + - If it has been merged, switch back to `main`, fast-forward from `origin/main`, and create a new + feature branch before editing. + - If it has not been merged, inspect the branch's upstream/ahead/behind state and update local + state before editing. Do not stack unrelated work on a stale or merged branch. +4. If there are uncommitted changes, identify whether they are user changes before switching, + rebasing, stashing, or applying patches. + ## Code constraints **Enforced workspace-wide** by `[workspace.lints]` + `clippy.toml` (CI fails the build): From b543e433cd28421e90ebb5c4a7c39e3683359232 Mon Sep 17 00:00:00 2001 From: 0xpantera <0xpantera@proton.me> Date: Fri, 19 Jun 2026 13:52:38 +0200 Subject: [PATCH 2/2] test: add browser extension QA harness --- .gitignore | 7 + docs/browser-extension-qa.md | 89 +++++++ examples/browser-bridge-dapp/index.html | 1 + package-lock.json | 76 ++++++ package.json | 13 + playwright.extension.config.ts | 28 +++ .../browser-bridge-extension.spec.ts | 76 ++++++ tests/extension/fixtures.ts | 238 ++++++++++++++++++ 8 files changed, 528 insertions(+) create mode 100644 docs/browser-extension-qa.md create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 playwright.extension.config.ts create mode 100644 tests/extension/browser-bridge-extension.spec.ts create mode 100644 tests/extension/fixtures.ts diff --git a/.gitignore b/.gitignore index af1b6bf..39c6b9f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,10 @@ # gstack local reports .gstack/ + +# Playwright extension QA artifacts +/node_modules/ +/playwright-report/ +/test-results/ +/blob-report/ +/.playwright/ diff --git a/docs/browser-extension-qa.md b/docs/browser-extension-qa.md new file mode 100644 index 0000000..c345307 --- /dev/null +++ b/docs/browser-extension-qa.md @@ -0,0 +1,89 @@ +# Browser extension QA + +Deckard's browser connector is a local-only, experimental extension. This QA harness is a +small Playwright smoke suite, not a full end-to-end wallet test suite. It checks that the +unpacked extension loads in Chromium, injects the EIP-1193 provider, and can connect the local +test dapp through the Deckard browser bridge. + +The suite follows Playwright's Chrome extension guidance: extensions run in Chromium through a +persistent browser context, loaded with `--disable-extensions-except` and `--load-extension`. +Manifest V3 uses a service worker, so the extension id is derived from the service worker URL. + +## Install + +Install the Node dependencies: + +```sh +npm install +``` + +Install Playwright's bundled Chromium: + +```sh +npm run qa:browser:install +``` + +Use the bundled Playwright Chromium for this harness. Do not switch it to system Chrome or Edge; +those browsers no longer support the extension sideload flags that this local QA path needs. + +## Run + +Run the extension smoke tests headless: + +```sh +npm run qa:extension +``` + +Run headed while debugging: + +```sh +npm run qa:extension:headed +``` + +The test starts `deckard-browser-bridge` in dev/mock mode on `127.0.0.1:8765`, serves +`examples/browser-bridge-dapp` on `127.0.0.1:8777`, loads `extension/` unpacked, and verifies: + +- the Manifest V3 service worker loads +- `window.ethereum` is injected into the local test dapp +- `eth_accounts` returns `[]` before permission +- `eth_requestAccounts` returns the deterministic dev/mock address +- `eth_accounts` returns that address after permission +- `eth_chainId` returns Sepolia (`0xaa36a7`) + +If you already have a compatible bridge running on `127.0.0.1:8765`, stop it before running the +suite. To intentionally reuse it instead, set: + +```sh +DECKARD_QA_REUSE_BRIDGE=1 npm run qa:extension +``` + +## Artifacts + +Generated artifacts are ignored by git: + +- `playwright-report/` — HTML reports +- `test-results/` — screenshots, traces, and videos +- `.playwright/` — persistent Chromium profiles +- `blob-report/` — Playwright blob reports + +The passing dapp-connection test writes `connected-dapp.png` under `test-results/extension/...`. +On failure, Playwright retains traces, screenshots, and videos according to +`playwright.extension.config.ts`. + +## Security + +- Never use or commit a real seed phrase, private key, production wallet, browser profile, or + mainnet-funded account in this harness. +- The checked-in test uses only a deterministic mock address: + `0xdeC0ded0000000000000000000000000000001193`. +- The extension has no keys and performs no signing. +- Keep transaction and signing flows out of this harness until Deckard has reviewed approval UI + and local-chain-only signing tests. +- Do not log extension storage, browser profile contents, cookies, local storage, seeds, keys, or + wallet state. + +## Scope + +This suite proves the browser connector slice. It does not replace Rust unit/integration tests, +the real daemon proof for `deckard-signerd`, or a future transaction/signature test suite on a +local chain. diff --git a/examples/browser-bridge-dapp/index.html b/examples/browser-bridge-dapp/index.html index 631479a..0786859 100644 --- a/examples/browser-bridge-dapp/index.html +++ b/examples/browser-bridge-dapp/index.html @@ -3,6 +3,7 @@ + Deckard EIP-1193 bridge test dapp