Repository navigation
Add AppExtensions with Tauri-plugin support and a runtime-generic assemble() - #3385
Conversation
Pragmatic code review (medium), initial reviewReview Type: Initial Review Scope: Requirements Check (issue 3304)
Ratchet criterion. Deviations.
The 2 extra tests are worth keeping. Verification of the rustdoc claims against tauri 2.11.2All claims in
Three docs are forward-looking rather than wrong (Nit 3). Test quality
Code Review Findings[Improvement] 1. Core plugin names can drift from what [Improvement] 2. The core-name collision test does not model the hazard ( [Nit] 1. The [Nit] 2. Tighten the ACL assertion and comment the doc-hidden helper ( [Nit] 3. Three docs state future wiring as present fact ( [Nit] 4. API design notes (no action needed)
Recommendation: APPROVE. There are no blockers. Every acceptance criterion is met, the rustdoc claims check out against tauri 2.11.2, and the tests are non-vacuous. The two improvements are cheap and worth doing here or tracking for the change that wires |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment, GitHub blocks self-approval). Full findings in the review comment above.
6a0d6fd to
6cb0987
Compare
Address-review summaryAddresses the pragmatic code review (medium, initial) above, which recommended APPROVE with no blockers. Pushed as Addressed (5 of 6 recommendations)
Skipped (1)
Verification after the fixes
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The production-code changes are attributes and a signature |
…emble() Adds the first pieces of the extension API to nodespace_app_lib: EXTENSION_API_VERSION, AppExtensions<R> with none() and plugin(P), and assemble(builder, extensions), which registers extension Tauri plugins in the order they were added. A plugin whose name belongs to a plugin core registers (single-instance, opener, dialog), or that reuses the name of an earlier extension plugin, is skipped and logged, since Tauri would otherwise let it silently replace the earlier plugin. assemble is generic over the runtime so the fixture tests drive it on tauri::test::MockRuntime, including a plugin command answered through IPC once granted and refused without a grant. run() does not use these yet, so the app is unchanged. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…n docs and must_use - The core-name test now registers a probe under each core plugin name before assemble and asserts that its setup still ran and the extension plugin's did not, so it shows the extension plugin is skipped rather than replacing core's. - The denied-without-a-grant test also asserts the refusal names the command. - Comment why the grant uses a doc-hidden call, and that the no-extension test can only probe known names. - Mark none, plugin and assemble #[must_use]; take the builder as `mut` in the assemble signature. - Drop the unenforced "in the order it does" wording from the core plugin list and the module-doc sentence about core's app crate. Skipped: tying run()'s plugin registrations to CORE_PLUGIN_NAMES, which needs run() to go through assemble and belongs with that wiring. Co-Authored-By: Claude Sonnet 5 <[email protected]>
6cb0987 to
8caab60
Compare
Closes #3304
Summary
Adds the first pieces of the Rust extension API to
nodespace_app_lib, in a newextensionsmodule:EXTENSION_API_VERSION: (u32, u32) = (1, 0).AppExtensions<R = tauri::Wry>with private fields,none(),plugin(P)(kept in call order) and aDefaultequal tonone()with noR: Defaultbound.assemble(builder, extensions), generic over the runtime, which registers each extension plugin withBuilder::plugin_boxedin order.pub(crate) CORE_PLUGIN_NAMES = ["single-instance", "opener", "dialog"].assembleskips, and logs withtracing::error!, an extension plugin whose name is inCORE_PLUGIN_NAMESor was already registered by an earlier extension plugin. Tauri's plugin store would otherwise let the later plugin silently replace the earlier one, so the first registration wins. Skipped means never handed to the builder, so its setup never runs.run()does not call any of this yet, so the app is unchanged. The re-exports are inlib.rs:pub use extensions::{assemble, AppExtensions, EXTENSION_API_VERSION};.Tests
extensions/fixture_tests.rsholds a fixture plugin (fixture, commandfixture_ping, managedFixtureState), all driven throughassembleontauri::test::MockRuntime. The IPC tests grant the command withContext::runtime_authority_mut().__allow_command(..), as the issue describes.The seven tests the issue lists:
extension_plugin_setup_runs_and_its_state_is_managedextension_plugin_command_answers_through_ipc_once_grantedextension_plugin_command_is_denied_without_a_grant(also asserts the refusal is the capability check's, not a missing plugin)extension_plugin_named_like_a_core_plugin_is_not_registered(loops over all three core names; a probe registered under the name beforeassemblestands in for core's plugin, and the test checks that its setup still ran and the extension plugin's did not)second_extension_plugin_with_the_same_name_is_not_registeredcore_plugin_names_match_the_plugins_core_registers(compares against the realsingle_instance,openeranddialogconstructors'name())none_registers_nothing(coversnone()andDefault)Two more I added:
extension_api_version_is_one_zero, andextension_plugins_are_registered_in_the_order_they_were_added, since call order is part of the specified contract.Mutation results
Each mutation was applied on its own, the suite run, and the change reverted:
(1, 1)extension_api_version_is_one_zeroassembleregisters nothing..named_like_a_core_plugin..second_extension_plugin_with_the_same_name..dialogdropped fromCORE_PLUGIN_NAMEScore_plugin_names_match..openermisspelled inCORE_PLUGIN_NAMEScore_plugin_names_match..assemblealways adds afixturepluginnone_registers_nothingDefaultadds afixturepluginnone_registers_nothing..denied_without_a_grantVerification
cargo test --lib -p nodespace-app-lib -- extensions:: --test-threads=2: 9 passed.cargo fmt -p nodespace-app-libclean.cargo clippy -p nodespace-app-lib --all-targets -- -D warnings -D clippy::unused-asyncclean.NODESPACE_PRO_SUPABASE_URL=https://example.invalid NODESPACE_PRO_ANON_KEY=dummy cargo check -p nodespace-apppasses.bun run test:changedpassed (scripts tier and the Rust workspace under nextest), re-run after the review fixes.Pro/core boundary ratchet
bun run scripts/check-pro-boundary.tspasses on this branch rebased onto main with the check. This PR adds and removes no markers (0 hits on its added lines and no pro-named files), so every count equals main's and none rises. The only count below its baseline iscloudSyncHooks(0 against 4), which an earlier merge on main caused; this PR does not touch it, so no baseline is edited here.Deviations from the issue
tonic::transport::Channel,tokio_util::sync::CancellationToken) are left for the daemon-ready-task change, whereDaemonReadyfirst needs them.core_plugin_names_match_the_plugins_core_registersis#[cfg(desktop)], mirroring the guard on the single-instance plugin inrun()(thedesktopalias comes from this crate'sbuild.rs).CORE_PLUGIN_NAMESis checked against the plugin constructors as the issue specifies. It is not yet tied to the registrations inrun(), which do not go throughassemble.🤖 Generated with Claude Code