fix(tauri): ship generated permission files in the plugin crates by goosewobbler · Pull Request #743 · webdriverio/desktop-mobile · GitHub
Skip to content

fix(tauri): ship generated permission files in the plugin crates - #743

Merged
goosewobbler merged 12 commits into
mainfrom
fix/issue-730-tauri-crate-permissions
Oct 22, 2026
Merged

goosewobbler merged 12 commits into
mainfrom
fix/issue-730-tauri-crate-permissions

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

tauri-plugin-wdio-webdriver has never shipped permissions/autogenerated/reference.md (1.0.0 through 1.5.0). Its build.rs runs tauri_plugin::Builder, which writes that file at build time unless it already holds the exact bytes it would generate. In a read-only vendored source tree (cargo vendor + chmod -R a-w), the write fails with unable to create permissions dir: Permission denied.

Cause: the root .gitignore has **/autogenerated/**/*. The webdriver crate has no include =, so cargo package respects .gitignore and leaves the generated files out. tauri-plugin-wdio only ships them by luck: its include = [...] makes cargo read the filesystem, so it picks up whatever the pre-publish build generated.

Fix

This takes the same approach as Tauri's official plugins (tauri-plugin-shell, tauri-plugin-fs): commit the generated files and make sure they ship byte-for-byte.

  • Commit the generated permission files for both crates. A new .gitignore rule, !packages/tauri-plugin*/permissions/autogenerated/**, re-includes everything under that directory. Any new generator output therefore shows up in the drift checks and the package file list. The files were generated with cargo check, so they're exactly what tauri_plugin::Builder writes with the locked tauri-plugin / tauri-utils.
    • webdriver crate: reference.md only, since its command list is empty.
    • tauri-plugin: reference.md plus commands/*.toml.
    • permissions/schemas/schema.json doesn't change for either crate.
  • Keep the files exact through release, Windows and old Tauri:
    • turbo.json: @wdio/tauri-plugin#build:rust no longer lists permissions/autogenerated/** and permissions/schemas/** as outputs. The release workflow runs this task, and a cache hit would otherwise restore stale bytes over the committed files before publishing. Its inputs never included permissions/default.toml or Cargo.lock. No other task or scripts/test-package.ts relies on these as build outputs; test-package.ts copies the plugin source tree.
    • tauri-plugin-wdio: the tauri-plugin build-dependency floor goes from 2.0.0 to 2.5.3, matching the webdriver crate. With the old floor, apps on older Tauri could resolve a tauri-utils whose generator writes a different reference.md, so read-only builds would still fail.
    • tauri-plugin-wdio: the unused runtime tauri-plugin dependency and the unused tauri-build build-dependency are removed. The crate's Cargo.lock and both Tauri fixture lockfiles drop the tauri-build edge. The crate's lockfile also updates its own version entry to 1.5.0, which matches main.
    • .editorconfig: insert_final_newline = false now applies only to permissions/schemas/**. The schemas have no final newline, but the autogenerated files end with one, and an editor stripping it would break byte identity. Biome's matching ignore comment is corrected.
  • CI, in _ci-rust-clippy.reusable.yml behind a new generated-permissions-crates input. Only the Linux Tauri clippy job enables it, because the generated files don't depend on the platform. The step runs even if clippy failed. For each crate, it:
    1. deletes permissions/autogenerated, runs cargo check, and fails if git status -- <crate>/permissions isn't clean. This keeps the committed files in sync with build.rs; deleting first means the check can't pass just because the build script didn't re-run. The error tells you to do the same locally: delete permissions/autogenerated, rebuild, and commit the result, including deletions.
    2. fails if there are no committed files under permissions/autogenerated, or if cargo package --list is missing any committed file under permissions/autogenerated. It lists the missing files.
  • Nightly crate-drift.yml re-resolves dependencies and runs cargo check. It now deletes permissions/autogenerated first, the same as the PR check. The run then fails if the build changed its committed permissions/ files, so a new tauri-utils release that changes the generator's output gets caught. The auto-filed issue's text covers both cases.
  • scripts/detect-changes.ts no longer classes *.md under packages/<pkg>/permissions/** as docs, so a PR that only touches a generated reference.md still runs the Tauri jobs.

Why there's no read-only vendored build in CI: a dependency's build script makes no writes when two things hold: the committed files match what the generator produces, and they're in the package. The checks above cover exactly those. A CI read-only build would need cargo package, unpacking the crate, a copied lockfile and a throwaway consumer crate. The only extra case it would catch is a future Tauri build script writing outside permissions/. I ran that build once by hand instead (see Testing).

The crate versions in Cargo.toml are unchanged; releasekit handles them. rust-version is also unchanged, so MSRV-aware resolvers still pick this release for apps on older toolchains.

Related Issues

Closes #730

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📖 Documentation update
  • 🎨 Code style/refactoring (no functional changes)
  • 🔧 Internal/tooling change (build scripts, CI, etc.)
  • ⚡ Performance improvement

Scope

  • scope:electron - Electron service and CDP bridge
  • scope:tauri - Tauri service and plugin

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests pass (pnpm test)

The tests are the new CI checks plus new detect-changes cases. I didn't run the full pnpm test locally. I did run pnpm test:scripts, cargo test for both crates, and the pre-push hook's turbo typecheck/test, and all of them pass.

Testing

Run locally on macOS (arm64), rustc 1.97.1:

  • Packaging: cargo package --list now includes every committed file under permissions/autogenerated and permissions/schemas for both crates. With the old .gitignore and the files untracked, the webdriver crate's list didn't include reference.md, even though the file was on disk.

  • Read-only vendored build, run by hand: cargo package --no-verify on the webdriver crate, unpack the .crate, chmod -R a-w, then cargo check --offline a consumer crate that depends on it by path. It passes. With permissions/autogenerated removed from the unpacked crate, it fails with the error from the issue (unable to create permissions dir: ... PermissionDenied).

  • New CI step script, extracted from the workflow and run per crate:

    • It passes for both crates with the final manifests; the generated files come out byte-identical to the committed ones.
    • It fails as intended when a command is temporarily added to tauri-plugin's build.rs. It reports the new untracked commands/drift_probe.toml and the modified reference.md and schema.json, and the error gives the delete, rebuild and commit advice.
    • It fails and lists the missing files when they're left out of the package:
      • tauri-plugin with its include narrowed: missing commands/*.toml (all six are listed).
      • webdriver crate with an exclude: missing reference.md.
  • New crate-drift.yml block (delete, cargo check, git status), run under /bin/bash 3.2 to match the macOS runner:

    • It passes for the webdriver crate and for dioxus-bridge, which has no permissions/ directory.
    • Without the rebuild, it fails when a committed permission file is modified.
  • .gitignore: a new file anywhere under permissions/autogenerated/, including in a new subdirectory, shows up as untracked.

  • .editorconfig: the committed files contain no CR bytes or trailing whitespace. Only the two schema.json files lack a final newline.

  • Removed dependencies: nothing in tauri-plugin's src/ or build.rs uses tauri_plugin at runtime or tauri_build. In the fixture lockfiles, the only other change cargo would make is moving the two path crates' stale self-versions to 1.5.0, which main already has.

  • detect-changes: the new spec cases fail against the old classifier and pass with the change. pnpm test:scripts passes (111 tests), and typecheck:scripts is clean.

  • Lint and Rust: cargo clippy --all-targets -- -D warnings and cargo test are clean for both crates (webdriver: 28 tests pass; tauri-plugin has no Rust tests). actionlint is clean on all changed workflows. Biome is clean on the changed TS/JSON.

  • Left to CI: the new step on ubuntu-latest in Clippy Tauri Crates [Linux]. crate-drift.yml also runs on this PR because the workflow file changed, so its Fresh deps legs run against today's newest dependencies.

  • Unit tests added/updated

  • Integration tests added/updated

  • E2E tests added/updated (if applicable)

  • Manually tested on: macOS 26 (arm64)

Additional Context

The committed files are tied to the generator in the locked tauri-plugin / tauri-utils. If a later bump changes the output, the clippy-job check fails on the PR and the nightly crate-drift check fails on main. In both cases, the fix is to delete permissions/autogenerated, build the crate and commit the regenerated files. Building a Tauri fixture app against a newer Tauri would also rewrite them in the working tree.


🤖 Generated with Claude Code

tauri-plugin-wdio-webdriver never packaged permissions/autogenerated/reference.md
because the root .gitignore excluded it, so tauri_plugin::Builder tried to write it
at build time and failed in read-only vendored source trees. Commit the generated
files for both plugin crates and check in CI that they stay in sync with build.rs
and end up in the packaged crate.

Closes #730

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread .github/workflows/_ci-rust-clippy.reusable.yml Outdated
The package check only looked for reference.md, so tauri-plugin-wdio could
drop its generated commands/*.toml from the crate without failing CI. Compare
`cargo package --list` against every committed file under
permissions/autogenerated and list the missing ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

goosewobbler and others added 3 commits October 21, 2026 10:06
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, Windows and old Tauri

- turbo: stop caching permissions/ as build:rust outputs, so a cache hit at
  release can't restore stale bytes over the committed files.
- tauri-plugin-wdio: raise the tauri-plugin build-dependency floor to 2.5.3,
  matching the webdriver crate; older generators write a different
  reference.md, so read-only builds of old-Tauri apps would still fail.
- .gitattributes: never EOL-convert the generated files.
- CI: the package check also covers permissions/schemas, runs even when
  clippy failed, and reads git status once so a git failure isn't read as
  clean. The nightly crate-drift run fails when fresh dependencies change
  the committed files.
- detect-changes: a generated reference.md under packages/*/permissions
  runs its service's CI instead of being classed as docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
goosewobbler and others added 6 commits October 21, 2026 13:36
- CI error says to delete permissions/autogenerated, rebuild, and commit
  including deletions, since stale files left on disk survive a rebuild.
- Nightly crate-drift deletes permissions/autogenerated before building, and
  its issue text covers permission-file drift as well as build failures.
- .editorconfig: only the schemas lack a final newline; the autogenerated
  files keep theirs. Biome's comment no longer claims otherwise.
- tauri-plugin-wdio: declare the runtime tauri-plugin floor as 2.5.3, which
  cargo already enforces through the build-dependency.
- detect-changes spec derives the expected runs from the service list.
- Wrap lines over 120 characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heck

- crate-drift compares a crate's permission files only when its build
  succeeded, so a broken fresh dependency isn't also reported as drift.
- .gitignore re-includes only reference.md and commands/*.toml under
  permissions/autogenerated, so stray files there stay ignored.
- rust-version matches what the dependency floors need: 1.77.2 for
  tauri-plugin-wdio (tauri-plugin 2.5.3) and 1.83 for
  tauri-plugin-wdio-webdriver (glib 0.21 on Linux).
- tauri-plugin-wdio drops the unused runtime tauri-plugin and build-time
  tauri-build dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d permission files

- Restore the published rust-version values, so MSRV-aware resolvers still
  offer this fix to apps on older toolchains.
- Re-include everything under permissions/autogenerated again, so the drift
  checks and the git-based package list see any new generator output.
- Drop tauri-build from tauri-plugin-wdio in the Tauri fixture lockfiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…b's build gate

The schemas were always committed and packaged, so checking them guards
nothing today. The drift job already fails on a build error, so skipping
the permission comparison then only spared a second error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The package check runs on Linux and the crates publish from Linux, and on
Windows git normalises line endings when comparing, so they protected
nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goosewobbler
goosewobbler merged commit 56d222e into main Oct 22, 2026
5 of 13 checks passed
@goosewobbler
goosewobbler deleted the fix/issue-730-tauri-crate-permissions branch October 22, 2026 20:21
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
11 of 12 tasks
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.

[🐛 Bug]: tauri-plugin-wdio-webdriver 1.5.0 omits permissions/autogenerated/reference.md, breaking read-only vendored builds

1 participant