Skip to content

Generated bindings change across identical runs and event updates can be missed #42

Description

@hazre

Module

common (shared/core functionality)

Version

0.3.4

Environment

OS: Windows 11
Rust: 1.94.0
Tauri: 2.10.3
tauri-typegen: reproduced on current main / 0.5.0

Configuration

CLI: cargo tauri-typegen generate --validation none

Equivalent config:
{
  "plugins": {
    "typegen": {
      "projectPath": "./src-tauri",
      "outputPath": "./src/app/generated/tauri",
      "validationLibrary": "none"
    }
  }
}

Code Sample

use serde::{Deserialize, Serialize};
use tauri::Manager;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Payload {
    pub value: String,
}

#[tauri::command]
pub fn fetch_payload() -> Result<Payload, String> {
    Ok(Payload {
        value: "one".to_string(),
    })
}

#[tauri::command]
pub fn emit_event(app: tauri::AppHandle) -> Result<(), String> {
    app.emit("first-event", Payload {
        value: "one".to_string(),
    }).ok();
    Ok(())
}

Description

Generated output is not fully stable across identical inputs.

Right now some parts of analysis, rendering, and cache hashing depend on unordered traversal / HashMap iteration. That can cause commands.ts, types.ts, events.ts, and index.ts to change across repeated runs even when the Rust API surface did not actually change.

There is also a cache gap for discovered events, which can leave events.ts stale after an event change.

Expected:

  • generated TS only changes when commands, structs, events, or relevant config change
  • repeated runs with the same inputs stay byte-stable
  • event changes always trigger regeneration

Actual:

  • repeated runs can reorder or rewrite generated files unnecessarily
  • event changes can be missed by the cache

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule:commonIssue affects core/shared functionality

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions