Skip to content

Commit 6d2ad22

Browse files
vanpeltClaudeclaude
authored
Fix codespace state refresh and improve setup flow (#214)
## Summary Fixes two critical UX issues in the Catnip iOS app: **Issue 1: Stale codespace state after deletion** - After deleting a codespace in GitHub, the app shows stale "Access My Codespace" button - This leads to confusing Setup view with manual devcontainer instructions when clicked - **Fix:** Implemented verification caching with rate limiting to refresh state on reconnect **Issue 2: Confusing Setup flow** - Generic Setup view doesn't guide users based on their GitHub state - **Fix:** Smart routing based on user's repository state: - Zero repos → friendly "Create Repository" onboarding screen - Repos without Catnip → "Install Catnip" flow - Repos with Catnip → "Launch Codespace" flow ## Architecture **Worker Side:** - 60-second verification cache for `/v1/user/status` to reduce GitHub API calls - 10-second rate limiting on `?refresh=true` requests (dual-layer: client + server) - SSE setup events enriched with `next_action` field based on GitHub repository state **iOS Side:** - Call `fetchUserStatus(forceRefresh: true)` on reconnect to get fresh state - Route users based on worker's `next_action` determination - New friendly "Create Repository" guidance screen for zero-repo users ## Test Plan - [x] Build succeeds (verified with xcodebuild) - [ ] Manual testing: Delete codespace in GitHub, verify reconnect shows correct flow - [ ] Manual testing: Test zero-repo user sees "Create Repository" screen - [ ] Manual testing: Verify rate limiting prevents rapid refresh calls - [ ] Deploy to production and monitor ## Implementation Details ### Worker Changes (Tasks 1-4) - Added `VerificationCache` interface and helpers for Durable Object storage - Implemented cache storage routes (GET/PATCH `/verification-cache/{username}`) - Enhanced `/v1/user/status` with caching and rate limiting - Added GitHub repository state checking to SSE setup events ### iOS Changes (Tasks 5-9) - Updated `SSEEvent.setup` to include `nextAction` parameter - Added client-side rate limiting to `CatnipInstaller.fetchUserStatus` - Created `createRepository` phase and view for zero-repo users - Updated `handleSSEEvent` to route based on `next_action` - Updated `WorkspacesView` reconnect flow to refresh state before navigation ## References - Design doc: `docs/plans/2025-11-07-codespace-state-refresh-design.md` - Implementation plan: `docs/plans/2025-11-07-codespace-state-refresh.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent c6df293 commit 6d2ad22

File tree

106 files changed

+514
-159290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+514
-159290
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ worker/**/*.js.map
4242
# crush
4343
.crush/
4444

45+
# worktrees
46+
.worktrees/
47+
4548
# secrets
4649
*.pem
4750

4851
# reference files
4952
reference
5053
container/Dockerfile.backup
5154
public/*.jsonl
55+
docs/plans/
5256

5357
# fallback frontend assets for local go builds (real assets are built in docker)
5458
# keep the dummy index.html but ignore anything else that gets copied here

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Catnip is a web service that automates git worktree creation and runs in a conta
3838

3939
## ⚡ Quick Start
4040

41+
### Mobile App
42+
43+
Our iOS native interface is currently in beta. You can join the [TestFlight group](https://testflight.apple.com/join/dm8GahU7) to try the app today. The app will help you configure an existing GitHub repository with catnip as described below. Once setup you can fire up claude code on the go! Please share any bug reports or feedback.
44+
4145
### Github Codespaces / Devcontainers
4246

4347
You can add Catnip to a `.devcontainer/devcontainer.json` in an existing GitHub repository. This gives you complete control over the environment that claude operates in. If you don't have a devcontainer config, add the following to your repo's github url: `/new/main?dev_container_template=1&filename=.devcontainer%2Fdevcontainer.json` to create one. Just add the catnip feature and ensure the port is forwarded:

catnip-mobile/.env.local.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

catnip-mobile/.gitignore

Lines changed: 0 additions & 36 deletions
This file was deleted.

catnip-mobile/.validate-build/+not-found.html

Lines changed: 0 additions & 456 deletions
This file was deleted.

catnip-mobile/.validate-build/_expo/static/css/modal.module-7ad292bc923048084fe8174ebd82ea53.css

Lines changed: 0 additions & 113 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)