Skip to content

docs(windows): 补齐上游交付与测试工作流#67

Merged
appergb merged 1 commit into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-docs-workflow-pr
Apr 30, 2026
Merged

docs(windows): 补齐上游交付与测试工作流#67
appergb merged 1 commit into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-docs-workflow-pr

Conversation

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor

@Cooper-X-Oak Cooper-X-Oak commented Apr 30, 2026

摘要

关联 fork 验证:Cooper-X-Oak#12

本 PR 是从 fork/dev 已验证批次拆出的文档维护项:补齐 Windows 平台适配架构、Tauri 测试 agent 调研、上游 PR 交付门禁和 WebDriver workflow 参考。

fork/dev 先行验证

修复 / 新增 / 改进

  • 更新 docs/platform-adapter-architecture.md,明确 desktop core / platform adapter 分层方向。
  • 新增 docs/windows-tauri-test-agent-research.md,记录 Windows Tauri 测试 agent / workflow 调研。
  • 新增 docs/windows-upstream-pr-workflow.md,规定 fork/dev CI、自 PR、复审后再拆 upstream PR。
  • 新增 docs/references/tauri-webdriver-v2.workflow.yml,作为后续 WebDriver CI 落地参考。

兼容

  • 不包含:应用运行时代码、构建脚本、真实凭据、构建产物。
  • 对现有用户 / 本地环境 / 构建流程的影响:无运行时影响。

测试计划

Summary by Sourcery

Document the planned desktop platform adapter architecture and Windows-focused workflows for testing and upstream PR delivery.

Documentation:

  • Expand the desktop platform adapter architecture document to describe layered design, adapter boundaries, capability matrix, testing layers, and migration order across platforms.
  • Add a Windows Tauri test agent and workflow research document outlining candidate tools, recommended CI baselines, and priority test scenarios.
  • Add a reference WebDriver v2 GitHub Actions workflow file for future Tauri WebDriver-based CI setup.
  • Add a Windows upstream PR workflow guide formalizing the fork-first development, CI, review, and upstream PR gating process.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 30, 2026

Reviewer's Guide

This PR adds and updates documentation to formalize the desktop platform adapter architecture, define a Windows-focused upstream PR workflow, and capture research and reference workflows for Windows Tauri testing and WebDriver-based CI, without changing runtime code or build pipelines.

Sequence diagram for hotkey event flow through platform adapter

sequenceDiagram
  actor User
  participant OS_Windows
  participant LowLevelKeyboardHookAdapter
  participant HotkeyAdapterTrait as HotkeyAdapter
  participant Coordinator
  participant ProductCore
  participant UI

  User->>OS_Windows: Press right_control
  OS_Windows-->>LowLevelKeyboardHookAdapter: Keyboard event
  LowLevelKeyboardHookAdapter->>HotkeyAdapterTrait: pressed edge event
  HotkeyAdapterTrait->>Coordinator: on_hotkey_pressed()
  Coordinator->>ProductCore: start_dictation_session()
  ProductCore->>UI: update_recording_indicator(active)

  User->>OS_Windows: Release right_control
  OS_Windows-->>LowLevelKeyboardHookAdapter: Keyboard event
  LowLevelKeyboardHookAdapter->>HotkeyAdapterTrait: released edge event
  HotkeyAdapterTrait->>Coordinator: on_hotkey_released()
  Coordinator->>ProductCore: stop_dictation_session()
  ProductCore->>UI: update_recording_indicator(inactive)
Loading

Class diagram for platform adapters and hotkey implementations

classDiagram
  class AdapterError {
    +code
    +platform
    +operation
    +recoverable
    +user_message
    +debug_message
  }

  class AdapterCapability {
    +supported
    +requires_permission
    +permission_name
    +fallback_available
  }

  class HotkeyStatus {
    +installed
    +last_error: AdapterError
  }

  class HotkeyAdapter {
    <<interface>>
    +install()
    +uninstall()
    +update_binding(binding)
    +get_status(): HotkeyStatus
    +get_capability(): AdapterCapability
  }

  class AudioAdapter {
    <<interface>>
    +list_input_devices()
    +probe_permissions(): AdapterCapability
    +start_probe_capture(device_id)
    +stop_probe_capture()
    +open_stream(device_id)
    +close_stream()
  }

  class InsertionAdapter {
    <<interface>>
    +insert_text(text)
    +fallback_clipboard_insert(text)
    +classify_insertion_result(result)
  }

  class AppContextAdapter {
    <<interface>>
    +get_foreground_app()
    +get_active_window()
    +probe_text_field_capabilities()
  }

  class TrayAdapter {
    <<interface>>
    +create_tray()
    +update_menu()
    +open_window(window_id)
    +quit_app()
  }

  class AutostartAdapter {
    <<interface>>
    +read_autostart()
    +write_autostart(enabled)
  }

  class MacHotkeyAdapter {
    +cg_event_tap_handle
    +install()
    +uninstall()
    +update_binding(binding)
    +get_status(): HotkeyStatus
    +get_capability(): AdapterCapability
  }

  class LowLevelKeyboardHookAdapter {
    +hook_handle
    +install()
    +uninstall()
    +update_binding(binding)
    +get_status(): HotkeyStatus
    +get_capability(): AdapterCapability
  }

  class RegisteredShortcutAdapter {
    +shortcut_id
    +install()
    +uninstall()
    +update_binding(binding)
    +get_status(): HotkeyStatus
    +get_capability(): AdapterCapability
  }

  class LegacyRdevHotkeyAdapter {
    +install()
    +uninstall()
    +update_binding(binding)
    +get_status(): HotkeyStatus
    +get_capability(): AdapterCapability
  }

  HotkeyAdapter <|.. MacHotkeyAdapter
  HotkeyAdapter <|.. LowLevelKeyboardHookAdapter
  HotkeyAdapter <|.. RegisteredShortcutAdapter
  HotkeyAdapter <|.. LegacyRdevHotkeyAdapter

  HotkeyStatus --> AdapterError
  HotkeyAdapter --> HotkeyStatus
  HotkeyAdapter --> AdapterCapability
  AudioAdapter --> AdapterCapability
  AutostartAdapter --> AdapterError
  InsertionAdapter --> AdapterError
  AppContextAdapter --> AdapterCapability
Loading

Flow diagram for Windows upstream PR workflow

graph TD
  A[Start: Windows issue discovered] --> B[Fix in fork/dev]
  B --> B1[Keep commits focused and findings local]
  B1 --> C[Run fork/dev CI]
  C --> C1{CI and local smoke pass?}

  C1 -- No --> B
  C1 -- Yes --> D[Open fork PR]

  D --> D1[Include fork CI links and local evidence]
  D1 --> E[Self review fork PR]
  E --> F[Peer review fork PR]
  F --> F1{Review approved?}

  F1 -- No --> B
  F1 -- Yes --> G[Extract minimal upstream maintenance slice]

  G --> H[Create upstream PR from latest upstream base]
  H --> H1[Describe single goal and include fork links]
  H1 --> I[Upstream review and merge]

  I --> J[End: Windows fix merged upstream]
Loading

File-Level Changes

Change Details Files
Clarify and extend the desktop platform adapter architecture with a layered model and explicit adapter boundaries and migration plan.
  • Retitle and localize the platform adapter architecture doc to focus on OpenLess desktop
  • Replace the previous hotkey-centric description with a five-layer architecture (extensions, UI, product core, platform adapter, native system) and one-way dependency rules
  • Define responsibilities and non-responsibilities for multiple adapters (Hotkey, Audio, Insertion, AppContext, Tray, Autostart) plus shared error/capability contracts
  • Add a detailed hotkey section contrasting modifier-only triggers vs registered shortcuts and proposing Windows adapter strategies
  • Document a cross-platform capability matrix, test layering strategy, migration steps, and decisions for Windows hotkey fixes
docs/platform-adapter-architecture.md
Document research and recommendations for Windows Tauri test agents and workflows, emphasizing WebDriver-based automation baselines and supplemental tools.
  • Describe Windows-specific problem areas for the Tauri desktop app (startup, system capabilities, local state, physical hotkeys)
  • Survey tauri-driver/WebDriver, tauri-plugin-playwright, Tauri MCP/AI agent plugins, and TestDriver AI with pros/cons and suggested usage
  • Recommend an implementation sequence focusing first on WebDriverIO CI, then augmenting with manual gates and optional agent/AI tooling
  • List a first batch of mandatory tests around startup behavior, credentials handling, hotkey UX, and platform-specific permission copy
docs/windows-tauri-test-agent-research.md
Add a reference GitHub Actions workflow for Tauri v2 WebDriver-based tests across Linux and Windows.
  • Introduce a WebDriver (v2) CI workflow file intended as reference, triggered on relevant PRs and manual dispatch
  • Define a matrix job running on ubuntu-latest and windows-latest with selenium and webdriverio variants
  • Set up platform-specific dependencies, including webkit2gtk and webkit2gtk-driver on Linux and msedgedriver on Windows via a helper tool
  • Configure Rust toolchain, pnpm, Node.js v20, and caching, then install tauri-driver and run pnpm-based WebDriver tests in per-runner subdirectories
docs/references/tauri-webdriver-v2.workflow.yml
Define a Windows-focused upstream PR workflow that routes discovery and validation through a fork/dev branch before creating minimal upstream PRs.
  • Specify the standard fork-first workflow: fix on fork/dev, run CI and local Windows smoke, then open and review a fork PR before upstreaming
  • Describe expectations for fork PR content, including Chinese descriptions, CI links, regression summaries, and self-review
  • List precise entry criteria for upstream PRs, including linkage back to fork PR/CI and single, independently understandable changesets
  • Enumerate prohibited practices such as bypassing fork CI, batching multiple issues into one upstream PR, or leaking credentials and local artifacts
docs/windows-upstream-pr-workflow.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • In docs/references/tauri-webdriver-v2.workflow.yml, the Windows install msdgedriver step has both a typo in the step name (msdgedriver vs msedgedriver) and an incomplete PATH update ($PWD.Path >> $env:GITHUB_PATH won’t work as written in PowerShell); consider correcting the name and using an explicit Out-File or echo pipeline to append the driver directory to GITHUB_PATH.
  • The adapter layer now standardizes error and capability shapes (code/platform/operation/recoverable/..., supported/requires_permission/...); it would help future implementation if you add a short, single source of truth type/schema snippet (e.g., Rust struct + TS interface name/location) in the architecture doc so both sides know exactly which types to reuse.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `docs/references/tauri-webdriver-v2.workflow.yml`, the Windows `install msdgedriver` step has both a typo in the step name (`msdgedriver` vs `msedgedriver`) and an incomplete PATH update (`$PWD.Path >> $env:GITHUB_PATH` won’t work as written in PowerShell); consider correcting the name and using an explicit `Out-File` or `echo` pipeline to append the driver directory to `GITHUB_PATH`.
- The adapter layer now standardizes error and capability shapes (`code/platform/operation/recoverable/...`, `supported/requires_permission/...`); it would help future implementation if you add a short, single source of truth type/schema snippet (e.g., Rust struct + TS interface name/location) in the architecture doc so both sides know exactly which types to reuse.

## Individual Comments

### Comment 1
<location path="docs/references/tauri-webdriver-v2.workflow.yml" line_range="20" />
<code_context>
+        platform: [ubuntu-latest, windows-latest]
+        webdriver-test: [selenium, webdriverio]
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: install Tauri dependencies (Linux)
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider updating `actions/checkout` to the latest major version for security and maintenance benefits.

This workflow is pinned to `actions/checkout@v2`. Please upgrade to `actions/checkout@v4` so you get the latest security and performance fixes; the migration is typically drop‑in for most workflows.

```suggestion
      - uses: actions/checkout@v4
```
</issue_to_address>

### Comment 2
<location path="docs/references/tauri-webdriver-v2.workflow.yml" line_range="32-37" />
<code_context>
+          webkit2gtk-driver
+          xvfb
+
+      - name: install msdgedriver (Windows)
+        if: matrix.platform == 'windows-latest'
+        run: |
+          cargo install --git https://github.com/chippers/msedgedriver-tool
+          & "$HOME/.cargo/bin/msedgedriver-tool.exe"
+          $PWD.Path >> $env:GITHUB_PATH
+
+      - uses: actions-rust-lang/setup-rust-toolchain@v1
</code_context>
<issue_to_address>
**suggestion (performance):** Clarify and potentially optimize the Windows Edge WebDriver installation step.

There’s a small typo in the step name (`msdgedriver``msedgedriver`). Also, since this installs a custom tool from a Git repo on every run, consider switching to the official Edge WebDriver distribution (or a maintained action) and/or caching the driver by version and platform to improve stability and reduce CI time on Windows jobs.

Suggested implementation:

```
      - name: install msedgedriver (Windows)
        if: matrix.platform == 'windows-latest'
        run: |
          cargo install --git https://github.com/chippers/msedgedriver-tool
          & "$HOME/.cargo/bin/msedgedriver-tool.exe"
          $PWD.Path >> $env:GITHUB_PATH

```

To fully address the suggestion about stability and CI time improvements, you may also want to:
1. Replace the `cargo install --git` approach with a step that downloads a specific, versioned Edge WebDriver directly from Microsoft's official distribution for the target platform (e.g., via `Invoke-WebRequest` / `Expand-Archive` in PowerShell), and add a cache step (using `actions/cache`) keyed by `{ os, driverVersion }` to avoid re-downloading on every run.
2. Alternatively, switch to a maintained GitHub Action that installs Edge WebDriver on Windows and relies on internal caching, then remove the `msedgedriver-tool` install step entirely.
3. Document in this workflow (e.g., via a comment above the step) which Edge channel/version you are targeting so future updates to the driver/caching key are straightforward.
These changes depend on how you prefer to manage browser versions and what other parts of your CI configuration look like, so they should be tailored to your existing setup.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

platform: [ubuntu-latest, windows-latest]
webdriver-test: [selenium, webdriverio]
steps:
- uses: actions/checkout@v2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 suggestion (security): Consider updating actions/checkout to the latest major version for security and maintenance benefits.

This workflow is pinned to actions/checkout@v2. Please upgrade to actions/checkout@v4 so you get the latest security and performance fixes; the migration is typically drop‑in for most workflows.

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@v4

Comment on lines +32 to +37
- name: install msdgedriver (Windows)
if: matrix.platform == 'windows-latest'
run: |
cargo install --git https://github.com/chippers/msedgedriver-tool
& "$HOME/.cargo/bin/msedgedriver-tool.exe"
$PWD.Path >> $env:GITHUB_PATH
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (performance): Clarify and potentially optimize the Windows Edge WebDriver installation step.

There’s a small typo in the step name (msdgedrivermsedgedriver). Also, since this installs a custom tool from a Git repo on every run, consider switching to the official Edge WebDriver distribution (or a maintained action) and/or caching the driver by version and platform to improve stability and reduce CI time on Windows jobs.

Suggested implementation:

      - name: install msedgedriver (Windows)
        if: matrix.platform == 'windows-latest'
        run: |
          cargo install --git https://github.com/chippers/msedgedriver-tool
          & "$HOME/.cargo/bin/msedgedriver-tool.exe"
          $PWD.Path >> $env:GITHUB_PATH

To fully address the suggestion about stability and CI time improvements, you may also want to:

  1. Replace the cargo install --git approach with a step that downloads a specific, versioned Edge WebDriver directly from Microsoft's official distribution for the target platform (e.g., via Invoke-WebRequest / Expand-Archive in PowerShell), and add a cache step (using actions/cache) keyed by { os, driverVersion } to avoid re-downloading on every run.
  2. Alternatively, switch to a maintained GitHub Action that installs Edge WebDriver on Windows and relies on internal caching, then remove the msedgedriver-tool install step entirely.
  3. Document in this workflow (e.g., via a comment above the step) which Edge channel/version you are targeting so future updates to the driver/caching key are straightforward.
    These changes depend on how you prefer to manage browser versions and what other parts of your CI configuration look like, so they should be tailored to your existing setup.

@appergb appergb force-pushed the codex/windows-docs-workflow-pr branch from 9ec8ad9 to 386f866 Compare April 30, 2026 06:25
@appergb appergb merged commit 7797d14 into Open-Less:main Apr 30, 2026
2 checks passed
appergb pushed a commit that referenced this pull request Apr 30, 2026
包含本轮所有合并:
- Codex 终审两条 HIGH (cancel race) 修复 (PR #79)
- 6 个 Cooper-X-Oak/Codex bot PRs 自动合并 (#44 #49 #53 #68 #72 #73)
- 2 个有冲突 PR 本地 rebase 后合并 (#66 cancel + 空转写并存 / #67 Windows docs)
- README 破图修复 (PR #80)
- workflow-scope 受限的 #48 + #75 由用户在 GitHub UI 直接合并

3 处版本字段同步:package.json + tauri.conf.json + Cargo.toml
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.

2 participants