feat: local-first polish — magic-link gating, task-use bug, no_user_yet route + SPA copy#909
Conversation
…e bug, no_user_yet route Five small gaps from the post-passkey audit, bundled per @burak's request to ship together. Server changes: 1. auth/config.ts: magic-link is now hidden when RESEND_API_KEY is unset, regardless of NODE_ENV. Previously `magicLink: hasValue(RESEND_API_KEY) || !isProduction` rendered the "Send me a magic link" button in dev — clicking it logged the URL to server stdout but didn't email anything. Operators staring at their inbox never found it. Now `magicLink: hasValue(env.RESEND_API_KEY)` — visible exactly when delivery actually works. 2. auth/routes.ts /api/local-init: the no_user_yet response's signup_url was "/sign-up", but Owletto's SPA routes signup via /auth/sign-up (the /auth/$pathname.tsx shim → /auth/login?intent=sign-up). Bare /sign-up fell into the $owner catch-all and looped through the login redirect. Codex caught this on the polish PR's review. Fixed to "/auth/sign-up". Scripts: 3. task-use.sh: same $script_dir/.. bug fixed in task-setup.sh by PR #900. Without it, running task-use from inside a worktree retargets the chrome/mac symlinks at nested paths inside the calling worktree instead of the main checkout. Fix is the identical one-liner: `git rev-parse --path-format=absolute --git-common-dir`. Submodule bump: 4. packages/owletto → 19221e9 (lobu-ai/owletto#191): - login.tsx branches copy on singleUserMode + auto-enrolls a passkey after first signup. - AppState.swift handles no_user_yet by opening the browser at the signup URL (using URL APIs, not string concat). Verified: - make typecheck clean - bun test packages/server/src/__tests__/unit — 201 pass - xcodebuild Owletto Debug — BUILD SUCCEEDED - Codex reviewed; caught the /sign-up route mismatch + unsafe URL concat; both fixed before push.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR consolidates four independent fixes: an owletto subproject version bump, auth configuration to require email delivery setup for magic-link availability, local-init routing to use the correct sign-up URL path, and a worktree-aware repository resolution fix in the task-use script. ChangesBug fixes and dependency updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
…ed0ce (polish merged)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Five real gaps from the post-passkey audit, bundled.
Server
auth/config.ts: hide magic-link button whenRESEND_API_KEYis unset. Previously rendered a dead button in dev that logged the URL to stdout instead of emailing.auth/routes.ts /api/local-init:no_user_yetresponse'ssignup_urlnow points at/auth/sign-up(Owletto's actual SPA route, mapped via/auth/$pathname.tsx). The previous/sign-upfell into the$ownercatch-all and looped.Scripts
task-use.sh: same$script_dir/..→git rev-parse --path-format=absolute --git-common-dirfix as task-setup.sh in fix(cli): task-setup uses --path-format=absolute for git-common-dir #900. Without it, running from inside a worktree retargets symlinks at nested paths.Owletto submodule (lobu-ai/owletto#191,
19221e9)login.tsx: single-user-mode copy ("Set up your local install", "stays on this machine", etc.). Post-signupaddPasskey()auto-enrolls Touch ID from the same form-submit click context.AppState.swift: handlesno_user_yetfrom/api/local-initby opening the signup URL in the browser. Resolves the URL via URL APIs so absolute signup_url and base URLs with path prefixes both work.Codex review
Caught two bugs in the polish PR's first draft:
/sign-uproute →/auth/sign-up(would otherwise loop into$ownercatch-all).Both fixed before push.
Test plan
make typecheckclean.bun test packages/server/src/__tests__/unit— 201 pass.xcodebuild Owletto Debug— BUILD SUCCEEDED./auth/sign-up, operator types name+password+email, post-submit OS prompts for Touch ID, Mac app picks up the session via/api/local-init.Summary by CodeRabbit