[PR #1456] [MERGED] Add haptics API wrapper #5096

Closed
opened 2026-10-22 04:13:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1456
Author: @Xelvanis
Created: 5/28/2026
Status: ✅ Merged
Merged: 5/28/2026
Merged by: @Xelvanis

Base: refactor ← Head: chore/raw-invoketauri-haptics


📝 Commits (2)

  • b7b2054 Add haptics API wrapper
  • 5903c4f Cover local-only haptic routing

📊 Changes

5 files changed (+95 additions, -10 deletions)

View changed files

📝 src/features/runtime/haptics/hooks/use-haptic.ts (+8 -8)
➕ src/shared/api/haptics-api.test.ts (+48 -0)
➕ src/shared/api/haptics-api.ts (+13 -0)
📝 src/shared/api/integration-gateway.ts (+3 -2)
📝 src/shared/api/tauri-client.test.ts (+23 -0)

📄 Description

Linked issue

Refs #1457

Why this change

Feature/runtime haptics were still calling raw Tauri commands directly. This moves those calls behind a focused shared API wrapper so feature code uses the same boundary pattern as the rest of the refactor lane.

What changed

  • Added src/shared/api/haptics-api.ts for haptic status, connection, scan, command, stop-scan, and stop-all calls.
  • Updated runtime haptics hooks to call hapticsApi instead of importing invokeTauri directly.
  • Updated the integration gateway haptic port to reuse the wrapper.
  • Added wrapper payload tests and widened the local-only routing regression test to cover the full haptic command family.

Refactor impact

  • Primary owner area: shared API adapter / runtime haptics.
  • Impact areas reviewed: runtime haptics hooks, integration gateway haptic port, remote runtime routing, Tauri haptic command names and payloads.
  • Boundary notes: feature code no longer imports tauri-client; hapticsApi owns raw invoke calls; haptic commands remain desktop-native/local-only and are not added to the remote runtime allowlist; engine code continues using the integration port through integrationGateway.
  • Pressure points touched: none of the listed generation, mode, storage, provider, or import/export pressure points.

Validation

  • pnpm typecheck
  • pnpm build
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm check:architecture
  • Targeted/unit tests: pnpm exec vitest run src/shared/api/haptics-api.test.ts src/shared/api/tauri-client.test.ts
  • Manual QA / app-path check completed
  • Not run; explained below

Manual verification notes

Run locally before opening this draft:

  • pnpm exec vitest run src/shared/api/haptics-api.test.ts src/shared/api/tauri-client.test.ts - 2 files, 13 tests passed.
  • pnpm typecheck - passed.
  • pnpm check:architecture - passed.
  • git diff --check - passed.
  • Graphify update skipped per Xel override until tracked Graphify output churn is fixed.
  • Native Intiface/manual device QA was not run; this branch is intended to preserve behavior through adapter-only routing changes.

Test intent gate: added tests are intentional. haptics-api.test.ts pins the wrapper command names and payload shape; the widened tauri-client.test.ts negative control keeps every haptic command local-only under remote runtime configuration.

Docs and release impact

No changelog update made: this repository has no CHANGELOG.md, and the change is an internal adapter migration with no intended user-visible behavior change.

No documentation update needed for the same reason.

UI evidence

No UI evidence attached; this branch does not intentionally change visible UI.

Summary by CodeRabbit

  • Tests

    • Added comprehensive test coverage for haptics API operations and local command routing behavior.
  • Chores

    • Refactored internal haptics operations to use a centralized API abstraction layer for improved code organization and maintainability.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1456 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/28/2026 **Status:** ✅ Merged **Merged:** 5/28/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `chore/raw-invoketauri-haptics` --- ### 📝 Commits (2) - [`b7b2054`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b7b2054a0b0112779fdef4e131c704466757b3a8) Add haptics API wrapper - [`5903c4f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5903c4f2393fcd3aef119b54948bf07b934cb83f) Cover local-only haptic routing ### 📊 Changes **5 files changed** (+95 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/features/runtime/haptics/hooks/use-haptic.ts` (+8 -8) ➕ `src/shared/api/haptics-api.test.ts` (+48 -0) ➕ `src/shared/api/haptics-api.ts` (+13 -0) 📝 `src/shared/api/integration-gateway.ts` (+3 -2) 📝 `src/shared/api/tauri-client.test.ts` (+23 -0) </details> ### 📄 Description ## Linked issue Refs #1457 ## Why this change Feature/runtime haptics were still calling raw Tauri commands directly. This moves those calls behind a focused shared API wrapper so feature code uses the same boundary pattern as the rest of the refactor lane. ## What changed - Added `src/shared/api/haptics-api.ts` for haptic status, connection, scan, command, stop-scan, and stop-all calls. - Updated runtime haptics hooks to call `hapticsApi` instead of importing `invokeTauri` directly. - Updated the integration gateway haptic port to reuse the wrapper. - Added wrapper payload tests and widened the local-only routing regression test to cover the full haptic command family. ## Refactor impact - Primary owner area: shared API adapter / runtime haptics. - Impact areas reviewed: runtime haptics hooks, integration gateway haptic port, remote runtime routing, Tauri haptic command names and payloads. - Boundary notes: feature code no longer imports `tauri-client`; `hapticsApi` owns raw invoke calls; haptic commands remain desktop-native/local-only and are not added to the remote runtime allowlist; engine code continues using the integration port through `integrationGateway`. - Pressure points touched: none of the listed generation, mode, storage, provider, or import/export pressure points. ## Validation - [x] `pnpm typecheck` - [x] `pnpm build` - [x] `cargo check --manifest-path src-tauri/Cargo.toml` - [x] `pnpm check:architecture` - [x] Targeted/unit tests: `pnpm exec vitest run src/shared/api/haptics-api.test.ts src/shared/api/tauri-client.test.ts` - [ ] Manual QA / app-path check completed - [x] Not run; explained below ## Manual verification notes Run locally before opening this draft: - `pnpm exec vitest run src/shared/api/haptics-api.test.ts src/shared/api/tauri-client.test.ts` - 2 files, 13 tests passed. - `pnpm typecheck` - passed. - `pnpm check:architecture` - passed. - `git diff --check` - passed. - Graphify update skipped per Xel override until tracked Graphify output churn is fixed. - Native Intiface/manual device QA was not run; this branch is intended to preserve behavior through adapter-only routing changes. Test intent gate: added tests are intentional. `haptics-api.test.ts` pins the wrapper command names and payload shape; the widened `tauri-client.test.ts` negative control keeps every haptic command local-only under remote runtime configuration. ## Docs and release impact No changelog update made: this repository has no `CHANGELOG.md`, and the change is an internal adapter migration with no intended user-visible behavior change. No documentation update needed for the same reason. ## UI evidence No UI evidence attached; this branch does not intentionally change visible UI. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test coverage for haptics API operations and local command routing behavior. * **Chores** * Refactored internal haptics operations to use a centralized API abstraction layer for improved code organization and maintainability. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1456?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:13:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5096
No description provided.