Skip to content

Commit 4ddc238

Browse files
committed
fix(app): add missing ErrorBoundary import
1 parent 6e2f7f8 commit 4ddc238

File tree

2 files changed

+335
-0
lines changed

2 files changed

+335
-0
lines changed
Lines changed: 334 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
# Stock Yo Space: Full Testing Protocol
2+
3+
**Target URL**: https://stockyospace.com
4+
**Purpose**: Verify that Phases 1-5 fixes resolved authentication, key reset, and sharing issues.
5+
6+
---
7+
8+
## Pre-Test Setup
9+
10+
Before starting, open the browser's Developer Console (F12 → Console tab) and keep it visible throughout testing. The Phase 5 updates added detailed logging with 📦 emoji tags that will help diagnose any remaining issues.
11+
12+
**Clear all previous state first:**
13+
```javascript
14+
localStorage.clear();
15+
sessionStorage.clear();
16+
```
17+
Then hard refresh the page (Ctrl+Shift+R or Cmd+Shift+R).
18+
19+
---
20+
21+
## Test Accounts
22+
23+
| Role | nsec | npub |
24+
|-------|------|------|
25+
| Owner | `nsec1wnqh6y2aqlkygufm90vyjs38d6wcq2qzzh536tshg5u93m0w640shfrm4d` | (derived on login) |
26+
| Guest | `nsec1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7syzgmx0` | `npub1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7s23k8s6` |
27+
28+
---
29+
30+
## Phase A: Owner Login
31+
32+
### Step A1: Navigate to Login
33+
1. Go to https://stockyospace.com
34+
2. You should see a login dialog or a "Login" button
35+
3. Click to open the login dialog if not already open
36+
37+
### Step A2: Enter Owner nsec
38+
1. Locate the nsec input field (should have id="nsec" or similar)
39+
2. Click the "Key" tab if there are multiple login methods
40+
3. Type or paste the Owner nsec:
41+
```
42+
nsec1wnqh6y2aqlkygufm90vyjs38d6wcq2qzzh536tshg5u93m0w640shfrm4d
43+
```
44+
4. **CHECKPOINT**: The input should NOT show "Invalid secret key format" error
45+
5. If validation passes, the "Log In" button should become enabled (not grayed out)
46+
47+
### Step A3: Complete Login
48+
1. Click the "Log In" button
49+
2. Wait up to 10 seconds for login to complete
50+
3. **CHECKPOINT**: You should be redirected to the dashboard or inventory page
51+
4. **CHECKPOINT**: Check console for any errors (red text)
52+
5. **CHECKPOINT**: Look for console logs showing relay connections
53+
54+
### Expected Console Output (Phase 2 logging):
55+
```
56+
Connecting to relays...
57+
Connected to wss://relay.damus.io (or similar)
58+
Signer initialized
59+
```
60+
61+
### If Login Fails:
62+
- Note the exact error message shown on screen
63+
- Copy any red console errors
64+
- Check if the "Log In" button ever became enabled
65+
- Proceed to FAILURE DIAGNOSTICS section at the end
66+
67+
---
68+
69+
## Phase B: Reset Inventory Key
70+
71+
### Step B1: Navigate to Settings
72+
1. Click on "Settings" in the navigation menu
73+
2. URL should change to https://stockyospace.com/settings
74+
3. Wait for the page to fully load
75+
76+
### Step B2: Locate Reset Button
77+
1. Scroll to the bottom of the Settings page
78+
2. Look for a "Troubleshooting" section
79+
3. Find the "Reset Inventory Key" button (should be red/danger colored)
80+
81+
### Step B3: Check Button State
82+
1. **CHECKPOINT**: The button should be ENABLED (clickable), not grayed out
83+
2. If the button is disabled, check console for errors
84+
3. **CHECKPOINT**: You should NOT see "Not ready or no personal key" error
85+
86+
### Step B4: Click Reset
87+
1. Click the "Reset Inventory Key" button
88+
2. Wait up to 15 seconds
89+
3. **CHECKPOINT**: Look for "Success! Key reset." message on screen
90+
4. **CHECKPOINT**: Check console for confirmation logs
91+
92+
### Expected Console Output (Phase 3 logging):
93+
```
94+
📦 Resetting inventory key...
95+
📦 Signer available, proceeding...
96+
📦 Key reset successful
97+
```
98+
99+
### If Reset Fails:
100+
- Note if button was disabled (Phase 2 issue)
101+
- Note if "Not ready" error appeared (Phase 3 issue)
102+
- Check console for specific error messages
103+
- Proceed to FAILURE DIAGNOSTICS section
104+
105+
---
106+
107+
## Phase C: Clean Share List
108+
109+
### Step C1: Navigate to Inventory
110+
1. Click "Inventory" in the navigation menu
111+
2. URL should change to https://stockyospace.com/inventory
112+
3. Wait for inventory to load
113+
114+
### Step C2: Open Share Dialog
115+
1. Look for a "Share" button or share icon (usually looks like an arrow or person+)
116+
2. Click to open the Share dialog/modal
117+
3. **CHECKPOINT**: Dialog should open without errors
118+
119+
### Step C3: Check Existing Shares
120+
1. Look at the list of shared users in the dialog
121+
2. If the Guest npub is already listed:
122+
```
123+
npub1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7s23k8s6
124+
```
125+
3. Click the trash/remove icon next to it to remove them
126+
4. Wait for removal confirmation
127+
128+
### Step C4: Verify Clean State
129+
1. Close the Share dialog
130+
2. Re-open the Share dialog
131+
3. **CHECKPOINT**: Guest should no longer be in the list (or list should show "No shares yet")
132+
133+
---
134+
135+
## Phase D: Add Guest Share
136+
137+
### Step D1: Enter Guest npub
138+
1. With Share dialog open, locate the npub input field (id="npub")
139+
2. Type or paste the Guest npub:
140+
```
141+
npub1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7s23k8s6
142+
```
143+
3. **CHECKPOINT**: No validation error should appear
144+
145+
### Step D2: Submit Share
146+
1. Click the "Add" button OR press Enter
147+
2. **CHECKPOINT**: The form should submit (Phase 4 fixed form handling)
148+
3. Wait up to 10 seconds for the share to process
149+
150+
### Expected Console Output (Phase 4 logging):
151+
```
152+
Adding shared user: npub1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7s23k8s6
153+
Share added successfully
154+
```
155+
156+
### Step D3: Verify Share Added
157+
1. **CHECKPOINT**: Guest npub should now appear in the shared users list
158+
2. Close the Share dialog
159+
3. Re-open to verify persistence
160+
4. **CHECKPOINT**: Guest should still be listed after re-opening
161+
162+
### If Share Fails:
163+
- Check if button click/Enter registered at all (check console)
164+
- Look for "Adding shared user..." log - if missing, event handler didn't fire
165+
- Note any error messages
166+
- Proceed to FAILURE DIAGNOSTICS section
167+
168+
---
169+
170+
## Phase E: Logout
171+
172+
### Step E1: Find Logout
173+
1. Look for a "Logout" button (often in Settings or navigation menu)
174+
2. May also be in a user dropdown or profile area
175+
176+
### Step E2: Execute Logout
177+
1. Click "Logout"
178+
2. **CHECKPOINT**: You should be returned to the login screen
179+
3. If no logout button exists, manually clear state:
180+
```javascript
181+
localStorage.clear();
182+
sessionStorage.clear();
183+
location.reload();
184+
```
185+
186+
---
187+
188+
## Phase F: Guest Login
189+
190+
### Step F1: Login as Guest
191+
1. Open the login dialog
192+
2. Click "Key" tab if needed
193+
3. Enter Guest nsec:
194+
```
195+
nsec1qvqdaxh9zk42msuvlrzxx376a9k73kqc4ugfgjq4sg656tf0dy7syzgmx0
196+
```
197+
4. **CHECKPOINT**: No "Invalid secret key format" error
198+
5. Click "Log In"
199+
6. Wait for login to complete
200+
201+
### Step F2: Navigate to Inventory
202+
1. Go to the Inventory page
203+
2. Wait for it to load (watch for 📦 console logs)
204+
205+
### Expected Console Output (Phase 5 logging):
206+
```
207+
📦 Fetching inventory...
208+
📦 Found X items
209+
📦 Decrypting item 1...
210+
📦 Decrypting item 2...
211+
```
212+
213+
---
214+
215+
## Phase G: Verify Shared Inventory
216+
217+
### Step G1: Check Inventory List
218+
1. **CRITICAL CHECKPOINT**: Do you see items in the inventory?
219+
2. These items should be the ones created by the Owner
220+
3. The inventory should NOT be empty (unless Owner had no items)
221+
222+
### Step G2: Document Results
223+
Report one of the following outcomes:
224+
225+
**SUCCESS**: "Guest can see Owner's inventory items. Sharing works correctly."
226+
227+
**PARTIAL**: "Guest sees inventory page but it's empty or shows 'Loading...' indefinitely."
228+
229+
**FAILURE**: "Guest sees an error message: [exact error text]"
230+
231+
**CRITICAL FAILURE**: "Not ready or no personal key" error appeared at any point.
232+
233+
---
234+
235+
## FAILURE DIAGNOSTICS
236+
237+
If any phase failed, perform these additional checks:
238+
239+
### Diagnostic 1: Console Error Analysis
240+
1. Copy ALL red error messages from the console
241+
2. Note which phase the errors occurred in
242+
3. Look specifically for:
243+
- `nip19` or `decode` errors → Phase 1 issue
244+
- `relay` or `connect` or `timeout` errors → Phase 2 issue
245+
- `signer` or `encryption` or `key` errors → Phase 3 issue
246+
- `share` or `add` or `form` errors → Phase 4 issue
247+
- `hydration` or `state` or `undefined` errors → Phase 5 issue
248+
249+
### Diagnostic 2: LocalStorage State
250+
Run this in console and report the output:
251+
```javascript
252+
console.log('=== LocalStorage Debug ===');
253+
for (let i = 0; i < localStorage.length; i++) {
254+
const key = localStorage.key(i);
255+
console.log(key + ': ' + localStorage.getItem(key).substring(0, 50) + '...');
256+
}
257+
```
258+
259+
### Diagnostic 3: NDK State
260+
Run this in console and report the output:
261+
```javascript
262+
console.log('=== NDK Debug ===');
263+
console.log('Window NDK:', typeof window.ndk);
264+
console.log('Signer:', window.ndk?.signer ? 'Present' : 'Missing');
265+
console.log('Active user:', window.ndk?.activeUser?.pubkey?.substring(0, 16) + '...');
266+
console.log('Connected relays:', window.ndk?.pool?.relays?.size || 0);
267+
```
268+
269+
### Diagnostic 4: Network Tab
270+
1. Open Network tab in DevTools
271+
2. Filter by "WS" (WebSocket)
272+
3. Report:
273+
- How many WebSocket connections exist?
274+
- Are they in "Connected" state or "Pending"?
275+
- Any connections in "Failed" state?
276+
277+
### Diagnostic 5: Specific File Checks
278+
If the above diagnostics point to a specific phase, examine these files in the codebase:
279+
280+
| Phase | Files to Check |
281+
|-------|----------------|
282+
| 1 (Auth) | `LoginDialog.tsx` - look at nsec validation logic |
283+
| 2 (Relay) | `NDKContext.tsx` - look at connect() and timeout logic |
284+
| 3 (Keys) | `useInventoryKey.ts` - look at signer availability checks |
285+
| 4 (Share) | `ShareInventoryModal.tsx`, `useSharing.ts` - look at form handlers |
286+
| 5 (State) | `App.tsx`, `useInventory.ts` - look at ErrorBoundary and logging |
287+
288+
---
289+
290+
## Final Report Template
291+
292+
Please structure your final report as follows:
293+
294+
```
295+
## Stock Yo Space Test Results
296+
297+
**Test Date**: [date/time]
298+
**Site Version**: [check if there's a version number visible, or note last deploy time]
299+
300+
### Phase Results
301+
- Phase A (Owner Login): ✅ PASS / ❌ FAIL - [details]
302+
- Phase B (Reset Key): ✅ PASS / ❌ FAIL - [details]
303+
- Phase C (Clean Shares): ✅ PASS / ❌ FAIL - [details]
304+
- Phase D (Add Share): ✅ PASS / ❌ FAIL - [details]
305+
- Phase E (Logout): ✅ PASS / ❌ FAIL - [details]
306+
- Phase F (Guest Login): ✅ PASS / ❌ FAIL - [details]
307+
- Phase G (Verify Sharing): ✅ PASS / ❌ FAIL - [details]
308+
309+
### Critical Errors Observed
310+
[List any "Not ready or no personal key" or other critical errors]
311+
312+
### Console Errors
313+
[Paste relevant console errors here]
314+
315+
### Diagnostic Results
316+
[If any phase failed, include diagnostic outputs here]
317+
318+
### Recommended Next Steps
319+
[Based on where failure occurred, suggest which code to examine]
320+
```
321+
322+
---
323+
324+
## Notes for the Testing Agent
325+
326+
1. **Be patient with relays** — Nostr relays can take 5-15 seconds to connect. Don't assume failure too quickly.
327+
328+
2. **Use real typing when possible** — JavaScript `.value =` assignments sometimes don't trigger React's state updates. If that fails, try actual keyboard input simulation.
329+
330+
3. **Check for toasts** — Success/error messages often appear as toast notifications that disappear after a few seconds. Watch for them.
331+
332+
4. **The 📦 emoji logs are your friend** — Phase 5 added detailed logging. These logs will tell you exactly where things stall.
333+
334+
5. **If completely stuck** — Report which exact step you're stuck on and what you see on screen. Include a screenshot if possible.

src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { TooltipProvider } from "@/components/ui/tooltip";
1919
// import { NWCProvider } from '@/contexts/NWCContext'; // Keeping for now, might need refactor
2020
import { AppProvider } from '@/components/AppProvider';
2121
import { AppConfig } from '@/contexts/AppContext';
22+
import { ErrorBoundary } from '@/components/ErrorBoundary';
2223
import AppRouter from './AppRouter';
2324

2425
// const head = createUnhead({

0 commit comments

Comments
 (0)