fix: re-export __tauri_command_name_* alongside __cmd__ in summary mod.rs (Tauri 2.6 generate_handler! resolution)#485
Open
baral50 wants to merge 1 commit into
Conversation
…d.rs Tauri 2.6's `#[tauri::command]` proc-macro generates TWO sibling constants for each command: the legacy `__cmd__<fn_name>` (Tauri 1.x compat) and the new `__tauri_command_name_<fn_name>`. The `tauri::generate_handler![...]` macro in `src/lib.rs` looks up the LATTER at the module path used in the handler list — e.g. for `summary_engine::builtin_ai_list_models` it expects to find `summary_engine::__tauri_command_name_builtin_ai_list_models`. The existing re-exports in `summary/mod.rs` and `summary/summary_engine/mod.rs` only re-export the `__cmd__*` form and the function itself. The `__tauri_command_name_*` consts stay private to the `commands` sub-module, so `generate_handler!` resolution fails with 15 `cannot find __tauri_command_name_<fn> in <module>` errors when building on a fresh clone of `91b0c09`. Reproducer: git clone https://github.com/Zackriya-Solutions/meeting-minutes cd meeting-minutes/frontend pnpm install && ./build-gpu.sh # → 15× E0433 cannot find __tauri_command_name_<fn> in <mod> Fix is mechanical: in both mod.rs files, extend the existing `pub use commands::{...}` and `pub use template_commands::{...}` lists to include the `__tauri_command_name_<fn>` variant of every re-exported Tauri command. After the fix, `cargo tauri build` completes cleanly and produces the meetily binary + .deb + .AppImage bundles. Verified on: rustc 1.95.0 cargo 1.95.0 Ubuntu 24.04 LTS x86_64 tauri 2.6.2 + tauri-macros 2.6.2 No behaviour change: the additional re-exports are the same constants the proc-macro already emits at the use-site; this PR only widens their visibility so the macro that already expected them can find them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__tauri_command_name_<fn>to the existingpub use commands::{...}andpub use template_commands::{...}re-exports insrc-tauri/src/summary/mod.rs+src-tauri/src/summary/summary_engine/mod.rsE0433 cannot find __tauri_command_name_<fn> in <module>build errors seen when running./build-gpu.shon a fresh clone of91b0c09(currentmainHEAD /v0.3.0tag)The bug
Tauri 2.6's
#[tauri::command]proc-macro emits two sibling constants per command function:__cmd__<fn_name>— legacy Tauri 1.x compat name (pertauri-macros-2.6.2/src/command/mod.rs:15)__tauri_command_name_<fn_name>— whatgenerate_handler!looks up in Tauri 2.x (pertauri-macros-2.6.2/src/command/handler.rs:166andcommand/wrapper.rs:299)The existing
pub use commands::{__cmd__api_*, api_*, ...}re-exports insummary/mod.rsonly re-export the legacy__cmd__*form. The__tauri_command_name_*constants stay private to thecommandssubmodule.src-tauri/src/lib.rsthen callstauri::generate_handler![summary::api_process_transcript, summary_engine::builtin_ai_list_models, ...], which expands to lookups likesummary::__tauri_command_name_api_process_transcript— names that don't exist at that path because they were never re-exported.Result: 15 compile errors on a fresh build, blocking everyone from building the project from current
main.Reproducer
The fix
In
summary/mod.rsandsummary/summary_engine/mod.rs, extend the existingpub use commands::{...}andpub use template_commands::{...}lists to include the__tauri_command_name_<fn>variant of every re-exported Tauri command.Diff is mechanical — for each
__cmd__<fn>already re-exported, add__tauri_command_name_<fn>alongside it.The functions themselves are still annotated
#[tauri::command]and the proc-macro already emits both constants — this PR only widens the visibility of the new-form constants sogenerate_handler!(which expects them at the same path it uses for the function name) can resolve them.Verification
After the fix,
./build-gpu.shcompletes cleanly and produces:target/release/meetily(77 MB ELF)target/release/bundle/deb/meetily_0.3.0_amd64.debtarget/release/bundle/appimage/meetily_0.3.0_amd64.AppImageTested on:
rustc 1.95.0/cargo 1.95.0tauri 2.6.2+tauri-macros 2.6.2(resolved from currentCargo.toml)Test plan
pnpm install+./build-gpu.shproduces binary + bundles without errorsNotes
The legacy
__cmd__*re-exports are kept in place for backward compatibility with any external consumers — this PR is additive, not a rename.If a wholesale
pub use commands::*;is preferred over the explicit name list, happy to revise. The explicit form was chosen to match the existing style of these mod.rs files.