Files
openhuman/app/scripts/e2e-build.sh
T
Steven EnamakelandGitHub 7ad3c73ac3 Refactor UI auth/bootstrap and remove legacy UI runtime layers (#63)
* Enhance E2E build process and backend URL handling

- Updated `e2e-build.sh` to set CI environment variable correctly for compatibility with various CI runners.
- Refactored `backendUrl.ts` to support dynamic backend URL resolution from Vite environment variables, improving flexibility in different deployment contexts.

* Implement web channel functionality and enhance chat features

- Introduced new web channel commands for sending and canceling chat messages, improving user interaction with the chat system.
- Added support for server-sent events (SSE) to handle real-time updates for chat interactions, enhancing responsiveness.
- Refactored existing code to improve readability and maintainability, including updates to the core HTTP router and JSON-RPC handling.
- Implemented comprehensive end-to-end tests for the web channel flow, ensuring robust functionality and user experience.
- Enhanced the overall structure of the web channel module, including event publishing and subscription mechanisms for better scalability.

* Refactor socket handling to unify communication across environments

- Removed Tauri-specific socket handling from various components, streamlining the codebase to use a single Socket.IO client for both web and desktop environments.
- Updated the `useIntelligenceSocket` hook to eliminate Tauri checks and directly utilize the socket service for message sending and chat initialization.
- Refactored metadata synchronization in Gmail and Notion services to use the unified socket service, enhancing consistency in socket communication.
- Improved error handling and logging across socket interactions to provide clearer feedback during connection issues.
- Enhanced the Conversations component to manage socket connection status, ensuring a more robust user experience during chat interactions.

* Refactor socket service and enhance core URL resolution

- Replaced the deprecated `getBackendUrl` function with `resolveCoreSocketBaseUrl` to improve backend URL resolution for socket connections, accommodating both Tauri and non-Tauri environments.
- Introduced `coreSocketBaseFromRpcUrl` to streamline the processing of RPC URLs.
- Removed the `tauriSocket.ts` file, consolidating socket handling into a unified service for better maintainability and clarity.
- Updated the socket connection logging to provide more informative messages during connection attempts.

* Add engineioxide and socketioxide packages to Cargo.lock and update Cargo.toml

- Introduced new packages: `engineioxide` and `socketioxide`, both at version 0.15.2, enhancing the project's capabilities.
- Updated `Cargo.toml` to include `socketioxide` with the "extensions" feature, ensuring proper integration with the existing codebase.
- Added dependencies for both packages, improving modularity and functionality across the application.

* Refactor Conversations component and streamline chat handling

- Removed unused imports and functions related to Notion context and socket handling, simplifying the Conversations component.
- Enhanced error handling during chat interactions, ensuring clearer feedback for users.
- Updated chatSend function parameters to eliminate unnecessary context, improving the clarity of the API call.
- Consolidated logic for managing chat message history and context, enhancing maintainability and readability of the code.

* Enhance core RPC client with improved logging and error handling

- Introduced debug logging for socket RPC requests and responses, providing better visibility into the communication process.
- Enhanced error handling in the core RPC client to log detailed error messages, improving debugging capabilities.
- Updated socket service to log inbound events, ensuring comprehensive tracking of socket interactions.
- Removed deprecated MCP handlers from the socket service, streamlining the codebase and improving maintainability.

* Refactor apiClient and socketService for improved maintainability

- Changed the declaration of `_getToken` from `let` to `var` in `apiClient.ts` to enhance variable scoping.
- Removed unused imports in `socketService.ts`, streamlining the code and improving readability.

* Refactor deep link handling and enhance E2E testing capabilities

- Updated the deep link configuration in `lib.rs` to use a more generalized `#[cfg(desktop)]` directive, improving compatibility across desktop platforms.
- Enhanced the `triggerDeepLink` function in `deep-link-helpers.ts` to include macOS-specific app activation and launching logic, ensuring better integration with the macOS environment.
- Introduced a new `buildBypassJwt` function to generate bypass JWT tokens for E2E testing, improving the flexibility of authentication flows in tests.
- Updated E2E tests in `conversations-web-channel-flow.spec.ts` to utilize the new `triggerAuthDeepLinkBypass` function, enhancing the testing of authentication scenarios.

* Enhance deep link handling and E2E test configuration

- Updated `triggerAuthDeepLink` in `deep-link-helpers.ts` to support environment-based bypass tokens, improving flexibility in authentication flows during E2E tests.
- Modified the `serve_on_ephemeral` function call in `json_rpc_e2e.rs` to disable the core HTTP router's default behavior, enhancing test isolation and control over the testing environment.

* Refactor deep link handling and enhance E2E test utilities

- Updated `authFlow.e2e.test.tsx` to utilize `window.__simulateDeepLink` for simulating deep links, improving test accuracy and alignment with real-world scenarios.
- Modified `lib.rs` to restrict deep link registration to Windows and Linux platforms, clarifying platform-specific behavior.
- Enhanced `deep-link-helpers.ts` with a new function to simulate deep links in the WebView, providing a fallback mechanism for E2E tests.
- Updated `conversations-web-channel-flow.spec.ts` to reflect changes in deep link triggering, improving logging and test clarity.

* Update dependencies in Cargo.lock and Cargo.toml for improved project stability

- Removed several unused dependencies from `Cargo.lock` and `Cargo.toml`, including `aes-gcm`, `argon2`, and `async-imap`, streamlining the project and reducing potential security vulnerabilities.
- Updated existing dependencies to their latest versions, ensuring compatibility and leveraging improvements in performance and security.
- Simplified the dependency structure by consolidating features and removing unnecessary comments, enhancing clarity and maintainability of the configuration files.

* Refactor App component and remove unused providers

- Removed `AIProvider` and `SkillProvider` from the `App` component, streamlining the component structure and improving readability.
- Updated the `UserProvider` to focus solely on bootstrapping the authentication token, enhancing its clarity and purpose.
- Adjusted the layout within the `App` component to maintain functionality without the removed providers, ensuring a smooth user experience.

* Remove deprecated AI components and types

- Deleted the `index.ts`, `loader.ts`, `types.ts`, and related test files from the AI module, streamlining the codebase by removing unused and outdated components.
- Eliminated the `default-constitution.md` and associated constitution files, which were no longer relevant to the current architecture.
- This cleanup enhances maintainability and reduces complexity within the AI system.

* Refactor user data fetching logic and remove legacy tools cache watcher

- Enhanced the `useUser` hook to prevent infinite retry loops by implementing a token check with a reference to track the last auto-fetch token.
- Removed the legacy file watcher for `TOOLS.md`, transitioning to a core RPC and socket event-based refresh mechanism for tool/config updates.
- Updated test state structure to include `isAuthBootstrapComplete` and `channelConnections`, improving test coverage and state management.

* Refactor channel module structure and add new providers

- Consolidated channel modules under a new `providers` directory, improving organization and clarity.
- Introduced new channel providers for DingTalk, Discord, Email, iMessage, IRC, and Lark, expanding the messaging capabilities of the application.
- Updated the `mod.rs` file to reflect the new structure and ensure proper module exports, enhancing maintainability and ease of use.

* refactor(ui): remove legacy providers/lib logic and stabilize auth bootstrap

* chore: apply pre-push auto-fixes
2026-03-29 20:22:38 -07:00

45 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Build the .app bundle for E2E tests with the mock server URL baked in.
# Cargo incremental builds are used by default for faster iteration.
#
set -euo pipefail
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
REPO_ROOT="$(cd "$APP_DIR/.." && pwd)"
cd "$APP_DIR"
# Source Cargo environment
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
export VITE_BACKEND_URL="http://127.0.0.1:${E2E_MOCK_PORT:-18473}"
echo "Building E2E app bundle with VITE_BACKEND_URL=$VITE_BACKEND_URL"
if [ -n "${E2E_FORCE_CARGO_CLEAN:-}" ]; then
echo "Forcing cargo clean (E2E_FORCE_CARGO_CLEAN is set)."
cargo clean --manifest-path src-tauri/Cargo.toml
else
echo "Skipping cargo clean (default incremental E2E build)."
fi
if [ -f .env ]; then
# shellcheck source=/dev/null
source "$REPO_ROOT/scripts/load-dotenv.sh"
else
echo "No .env file — skipping load-dotenv (optional for CI)."
fi
export VITE_BACKEND_URL="http://127.0.0.1:${E2E_MOCK_PORT:-18473}"
# Stage rust-core sidecar for bundle.externalBin (see app/src-tauri/tauri.conf.json).
node "$REPO_ROOT/scripts/stage-core-sidecar.mjs"
# Disable updater artifacts for E2E bundles to avoid signing-key requirements.
TAURI_CONFIG_OVERRIDE='{"bundle":{"createUpdaterArtifacts":false}}'
# Tauri CLI maps env CI to --ci and only accepts true|false; some runners set CI=1.
case "${CI:-}" in 1) export CI=true ;; 0) export CI=false ;; esac
npx tauri build -c "$TAURI_CONFIG_OVERRIDE" --bundles app --debug
echo "E2E build complete."