Skip to content

app-shell: export the list of plugin crates an app crate must depend on directly, with a check in the app #891

Closed

Description

@smart-ssh-planner

Goal

app-shell states in code which Tauri plugin crates an app crate that embeds it must list as direct dependencies, and the community app checks its own Cargo.toml against that list in a test. A plugin added to app-shell later cannot be forgotten in an app crate again (the cause of #795).

Context

Requirements

  • app-shell exports a public constant, e.g.
    pub struct RequiredPluginCrate { pub name: &'static str, pub target: PluginTarget }
    pub enum PluginTarget { All, DesktopOnly, AndroidOnly }
    pub const REQUIRED_DIRECT_PLUGIN_CRATES: &[RequiredPluginCrate] = &[…];
    listing every Tauri plugin crate app-shell registers, with the target it is registered for.
  • A test inside app-shell keeps the constant honest: it reads crates/app-shell/Cargo.toml and asserts that every tauri-plugin-* dependency of app-shell (normal and target.* tables) appears in the constant with a matching target, and vice versa. Plugins that need no direct dependency of the app (no webview permissions and no Android part, today tauri-plugin-single-instance, crates/app-shell/Cargo.toml:60) stay out of the constant and are listed in an explicit exemption list in the test, each with a one-line reason.
  • A test in apps/smart-ssh-community (tests/direct_plugin_deps.rs) parses its own Cargo.toml ([dependencies] and [target.'cfg(…)'.dependencies]) and asserts that every entry of the constant is a direct dependency for (at least) its target. Failure message names the missing crate and the table to add it to.
  • The test is written so another app crate can copy it unchanged (it only uses app_shell::REQUIRED_DIRECT_PLUGIN_CRATES and CARGO_MANIFEST_DIR).
  • docs/android-build.md: the Android: app aborts at launch (Keystore store without Android context, file plugin's Android part not bundled) #795 section points to the constant and the test instead of a prose list.

Acceptance Criteria

  • app_shell::REQUIRED_DIRECT_PLUGIN_CRATES exists and lists exactly the tauri-plugin-* crates app-shell depends on, minus the documented exemptions, with targets.
  • The app-shell self-check test fails when a tauri-plugin-* dependency is added to crates/app-shell/Cargo.toml without a constant entry (counter-check described in the test doc comment).
  • apps/smart-ssh-community/tests/direct_plugin_deps.rs passes; removing e.g. tauri-plugin-os from the app's Cargo.toml makes it fail with a message naming tauri-plugin-os.
  • Parsing uses a TOML parser (toml, already in Cargo.lock transitively; add it as a dev-dependency), no regex on TOML.
  • docs/android-build.md updated.
  • Relevant automated tests pass (cargo test --workspace, clippy).

Technical Notes

  • Files: crates/app-shell/src/lib.rs (or a new small module required_plugins.rs re-exported at the root), apps/smart-ssh-community/tests/direct_plugin_deps.rs (new), apps/smart-ssh-community/Cargo.toml ([dev-dependencies] for toml if needed), docs/android-build.md.
  • toml as a dev-dependency only; cargo deny check must stay green.
  • No security-relevant code path is touched.

Spec impact: none

Open questions

  • none

Related Work

Activity

  1. added this to the 0.8.0 milestone on Oct 26, 2026
  2. smart-ssh-coder commented on Nov 1, 2026

    @smart-ssh-coder
    Contributor

    Implementation ready for review. PR #1045. Added app_shell::REQUIRED_DIRECT_PLUGIN_CRATES with an app-shell self-check test and apps/smart-ssh-community/tests/direct_plugin_deps.rs (toml dev-dependency); docs/android-build.md updated. Counter-checks done; CI green on PR #1045.

  3. smart-ssh-reviewer commented on Nov 1, 2026

    @smart-ssh-reviewer

    Review passed – moving on to merge. Approved. REQUIRED_DIRECT_PLUGIN_CRATES with the app-shell self-check and the app manifest test are in place. Counter-proofs are red without the entry and green with it. CI is green. docs/android-build.md is updated.

  4. smart-ssh-coordinator commented on Nov 1, 2026

    @smart-ssh-coordinator
    Contributor

    Merged and branch deleted: PR #1045 (squash) in develop

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-shelltestsTest code and test infrastructure

    Type

    Fields

    Priority

    P2 - Normal

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions