mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
dad5f42a385d3fc3578476381021663fcff45e39
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d3a4ea3688 |
fix(oauth): stabilize first-launch OAuth CI readiness
## Summary - Restores the first-launch desktop OAuth flow from #2247 while unblocking the failing CI surfaces. - Keeps the runtime readiness gate before launching OAuth in Tauri so first-launch sign-in waits for core/auth readiness. - Stabilizes legacy OAuth provider tests by mocking the new readiness preflight in Tauri-mode unit tests. - Makes the E2E-only `window.__simulateDeepLink` helper fire-and-forget, matching production `onOpenUrl` behavior so WebDriver does not block on auth readiness. - Keeps auth readiness focused on core-mode selection plus core RPC reachability, so first-login callbacks are not blocked by CoreStateProvider bootstrap. - Adds regression coverage for the non-blocking deep-link helper path. ## Problem - #2247 fixes first-launch OAuth readiness, but its PR branch is not writable from this maintainer account, and CI is currently red. - Frontend unit and coverage jobs fail because legacy provider tests exercise Tauri mode without mocking the new readiness preflight. - Linux E2E times out because `browser.execute(async () => await window.__simulateDeepLink(...))` waits on the full auth callback path, including readiness waits. - The PR checklist also had the diff coverage item unchecked. ## Solution - Mock `prepareOAuthLoginLaunch()` in the legacy Google/GitHub/Discord/Twitter OAuth tests, preserving their existing URL/openUrl assertions while isolating the readiness preflight. - Change `__simulateDeepLink` to schedule `handleDeepLinkUrls()` without awaiting it, which matches the real desktop deep-link listener's fire-and-forget handler. - Treat CoreStateProvider bootstrap as observational logging rather than a hard auth-readiness gate; core mode plus a successful core RPC ping are the required login preconditions. - Dismiss the runtime picker before E2E auth deep-link simulation so raw mega-flow auth callbacks also commit a core mode before readiness checks. - Treat the E2E default local core mode as an auth-readiness core mode when no explicit localStorage marker exists. - Add a desktop deep-link listener unit test proving the E2E helper resolves immediately while the auth readiness path continues asynchronously. - This PR supersedes #2247 because the original contributor fork rejected direct pushes from `YOMXXX` despite `maintainerCanModify=true`. ## Submission Checklist > If a section does not apply to this change, mark the item as `N/A` with a one-line reason. Do not delete items. - [x] Tests added or updated (happy path + at least one failure / edge case) per [Testing Strategy](../gitbooks/developing/testing-strategy.md#failure-path-requirement) - [x] **Diff coverage ≥ 80%** — changed lines (Vitest + cargo-llvm-cov merged via `diff-cover`) meet the gate enforced by [`.github/workflows/coverage.yml`](../.github/workflows/coverage.yml). Run `pnpm test:coverage` and `pnpm test:rust` locally; PRs below 80% on changed lines will not merge. - [x] Coverage matrix updated — N/A: behavior/test stabilization for existing OAuth sign-in flow; no feature row added/removed/renamed. - [x] All affected feature IDs from the matrix are listed in the PR description under `## Related` — N/A: no matrix feature IDs changed. - [x] No new external network dependencies introduced (mock backend used per [Testing Strategy](../gitbooks/developing/testing-strategy.md#mock-policy)) - [x] Manual smoke checklist updated if this touches release-cut surfaces ([`docs/RELEASE-MANUAL-SMOKE.md`](../docs/RELEASE-MANUAL-SMOKE.md)) — N/A: no release smoke procedure changed. - [x] Linked issue closed via `Closes #NNN` in the `## Related` section ## Impact - Desktop OAuth first-launch sign-in is more reliable because OAuth launch still waits for readiness before opening the external browser. - E2E-only deep-link simulation no longer blocks WebDriver script execution on long auth readiness waits. - No new runtime dependency, migration, storage, or security surface. - Web OAuth behavior is unchanged. ## Related - Closes: Closes #1689 - Follow-up PR(s)/TODOs: Supersedes #2247 because the original head branch is not writable from this fork. --- ## AI Authored PR Metadata (required for Codex/Linear PRs) > Keep this section for AI-authored PRs. For human-only PRs, mark each field `N/A`. ### Linear Issue - Key: N/A - URL: N/A ### Commit & Branch - Branch: `fix/2247-oauth-ci-readiness` - Commit SHA: `3367058b145a37566dcd377198b2881a977ce3cd` ### Validation Run - [x] `pnpm --filter openhuman-app format:check` (via pre-push hook) - [x] `pnpm typecheck` - [x] Focused tests: - `pnpm debug unit test/OAuthTwitter.test.tsx` - `pnpm debug unit src/utils/__tests__/desktopDeepLinkListener.test.ts` - `pnpm debug unit test/OAuthGitHub.test.tsx test/OAuthDiscord.test.tsx test/OAuthLoginSection.test.tsx` - `pnpm debug unit src/components/oauth/__tests__/OAuthProviderButton.test.tsx src/components/oauth/__tests__/oauthAuthReadiness.test.ts` - `pnpm debug unit src/components/oauth/__tests__/oauthAuthReadiness.test.ts src/utils/__tests__/desktopDeepLinkListener.test.ts src/components/oauth/__tests__/OAuthProviderButton.test.tsx test/OAuthTwitter.test.tsx` - `pnpm debug unit src/utils/__tests__/configPersistence.test.ts src/components/oauth/__tests__/oauthAuthReadiness.test.ts src/utils/__tests__/desktopDeepLinkListener.test.ts` - `pnpm debug unit` - `pnpm test:coverage` - `pnpm --dir app exec eslint src/utils/desktopDeepLinkListener.ts src/utils/__tests__/desktopDeepLinkListener.test.ts test/OAuthTwitter.test.tsx test/OAuthGitHub.test.tsx test/OAuthDiscord.test.tsx test/OAuthLoginSection.test.tsx --ext .ts,.tsx --max-warnings=0` - [x] Rust fmt/check (if changed): `cargo fmt --manifest-path ../Cargo.toml --all --check`, `cargo fmt --manifest-path src-tauri/Cargo.toml --all --check`, and `GGML_NATIVE=OFF pnpm rust:check` via pre-push hook - [x] Tauri fmt/check (if changed): `cargo fmt --manifest-path app/src-tauri/Cargo.toml --all --check` and `GGML_NATIVE=OFF pnpm rust:check` via pre-push hook ### Validation Blocked - `command:` N/A - `error:` N/A - `impact:` N/A. Local macOS/Tahoe `rust:check` requires the documented `GGML_NATIVE=OFF` workaround for `whisper-rs-sys`/`-mcpu=native`; validation passed with that env var. ### Behavior Changes - Intended behavior change: first-launch Tauri OAuth launch waits for runtime readiness, and E2E deep-link simulation no longer blocks the WebDriver script on asynchronous auth completion. - User-visible effect: desktop first-launch sign-in should complete reliably instead of racing core/auth initialization. ### Parity Contract - Legacy behavior preserved: web OAuth redirects and Tauri `openUrl()` URL construction remain unchanged. - Guard/fallback/dispatch parity checks: existing provider tests still cover Google/GitHub/Discord/Twitter web and Tauri branches; deep-link listener test covers readiness failure and async helper behavior. ### Duplicate / Superseded PR Handling - Duplicate PR(s): #2247 - Canonical PR: this PR - Resolution (closed/superseded/updated): #2247 could not be updated directly because `git push git@github.com:CodeGhost21/openhuman.git HEAD:cursor/a02-1689-signin-failed-first-time` was rejected with `Permission denied to YOMXXX`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * OAuth sign-in adds a readiness gate that checks local runtime availability, surfaces clear user-facing messages when sign-in can’t proceed, and runs a short preflight on supported desktop builds before launching provider flows. * Deep-link sign-ins coordinate lifecycle steps for more reliable handling across environments; E2E helpers now treat auth deep links to bypass boot checks when appropriate. * Config lookup supports an E2E default core-mode fallback. * **Tests** * Expanded tests for OAuth readiness, deep-link lifecycle, launch preparation, desktop flows, and config fallbacks. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/tinyhumansai/openhuman/pull/2267?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 --> Co-authored-by: Ghost Scripter <ghostscripter@zerolend.xyz> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: 李冠辰 <liguanchen@xiaomi.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai> |
||
|
|
9c14c13752 |
fix(oauth): surface backend outage instead of opening browser to 504 (#1985) (#2147)
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai> |
||
|
|
dc5e7adeb6 |
fix(auth): update RPC method names for authentication calls (#463)
* fix(auth): update RPC method names for authentication calls Refactor authentication-related RPC method names to use underscores instead of dots for consistency. Updated methods include `get_state`, `get_session_token`, `clear_session`, and `store_session`. chore: update OpenHuman version to 0.51.19 style: standardize string formatting in quickjs_libs/bootstrap.js and other files - Replace single quotes with double quotes for string literals in various functions. - Ensure consistent formatting across console logging and error handling. fix(config): improve token retrieval logic in ops_core.rs - Enhance the logic for retrieving the active session token from the credentials store, accommodating user-specific directories. * test: align auth and OAuth assertions with current behavior Update stale test expectations for underscore-style auth RPC methods and light-theme OAuth button classes, and make the bypass-login E2E assertion resilient to the current auth persistence model. Made-with: Cursor * chore: apply formatter output for login flow spec Include Prettier formatting adjustments produced by the pre-push hook so the branch can pass repository push checks cleanly. Made-with: Cursor |
||
|
|
3b9fd2e446 |
Refactor OAuth provider tests for consistency and readability
- Updated test files for Discord, GitHub, Google, and Twitter to improve code consistency by standardizing async function formatting and import statements. - Enhanced readability by restructuring promise resolutions and waitFor assertions. - Ensured uniformity in the handling of button click events across all OAuth provider tests. |
||
|
|
b2edcb7b62 |
Add OAuth provider tests for Discord, GitHub, Google, and Twitter
- Implemented comprehensive unit tests for OAuthProviderButton across multiple providers: Discord, GitHub, Google, and Twitter. - Covered rendering, OAuth flow in both web and Tauri environments, loading states, and error handling. - Ensured consistent styling and behavior for each provider's button, including label, icon, and disabled states. - Enhanced test coverage for backend URL retrieval and interaction with the OAuth flow. |