Skip to content

fix(client): align api_create_user IPC argument casing between frontend and tauri backend - #127

Open
markusbrand wants to merge 1 commit into
masterfrom
fix/client-create-user-ipc-arguments
Open

markusbrand wants to merge 1 commit into
masterfrom
fix/client-create-user-ipc-arguments

Conversation

@markusbrand

Copy link
Copy Markdown
Owner

Summary

Fixes a reproducible IPC argument deserialization bug in the desktop client (client-tauri) where creating a user from the Settings UI consistently fails with:
command api_create_user missing required key firstName

Root Cause

In client-tauri/src/Settings.tsx, handleCreateUser invokes Tauri command api_create_user using snake_case arguments:

await invoke("api_create_user", {
  email: newUserEmail,
  first_name: newUserFirst,
  last_name: newUserLast,
});

However, Tauri v2's #[tauri::command] procedural macro converts Rust parameter names (email, first_name, last_name) to lowerCamelCase (email, firstName, lastName) for IPC argument deserialization. Because Settings.tsx supplied first_name and last_name, Tauri rejected the call at runtime before invoking the backend.

Changes

  • Updated client-tauri/src/Settings.tsx to include firstName: newUserFirst and lastName: newUserLast, while also retaining first_name and last_name for defense-in-depth compatibility.
  • Added OpenSpec change artifacts in openspec/changes/fix-client-create-user-ipc-arguments/ tracking proposal, delta specs, design, and verified tasks.

Verification

  • (cd client-tauri && npm run build): TypeScript compilation and Vite packaging passed cleanly.
  • (cd client-tauri/src-tauri && cargo test): All 21 unit tests passed.

…nd and tauri backend

- Pass camelCase parameters (firstName, lastName) in handleCreateUser within Settings.tsx to satisfy Tauri's IPC deserializer.
- Preserve snake_case parameters for backwards and forward compatibility.
- Add OpenSpec change artifacts tracking proposal, delta specs, design, and verified 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.

1 participant