mohsin-devs commited on
Commit
f0e9b9e
·
verified ·
1 Parent(s): 282f3b5

Delete HF_SPACES_TESTING_GUIDE.md

Browse files
Files changed (1) hide show
  1. HF_SPACES_TESTING_GUIDE.md +0 -356
HF_SPACES_TESTING_GUIDE.md DELETED
@@ -1,356 +0,0 @@
1
- # DocVault HuggingFace Spaces - Deployment & Testing Guide
2
-
3
- **Application URL**: https://huggingface.co/spaces/mohsin-devs/DocVault-app
4
- **Repository**: mohsin-devs/DocVault-Storage (dataset)
5
- **Status**: Ready for production validation
6
-
7
- ---
8
-
9
- ## 🔧 Current Configuration
10
-
11
- ```
12
- STORAGE_MODE: HF (Hugging Face Mode)
13
- HF_REPO_ID: mohsin-devs/DocVault-Storage
14
- HF_REPO_TYPE: dataset
15
- Cache TTL: 60 seconds
16
- Max File Size: 50MB
17
- USER_ID: default_user
18
- ```
19
-
20
- ---
21
-
22
- ## ✅ Pre-Deployment Checklist
23
-
24
- ### Environment Variables (Verify in HF Spaces Settings)
25
- ```bash
26
- STORAGE_MODE=HF # ✅ Set
27
- HF_TOKEN=hf_MXrmgjFFRaqYUltCaf... # ✅ Set (current token in codebase)
28
- HF_REPO_ID=mohsin-devs/DocVault-Storage # ✅ Set
29
- HF_REPO_TYPE=dataset # ✅ Set
30
- DEBUG=False # ⏳ Verify for production
31
- SECRET_KEY=<random-value> # ✅ Should be changed in production
32
- ```
33
-
34
- ### Backend Requirements
35
- ```python
36
- # server/requirements.txt contains:
37
- Flask
38
- flask-cors
39
- huggingface_hub
40
- Werkzeug
41
- ```
42
-
43
- ### Frontend Configuration
44
- ```javascript
45
- // js/api/hfService.js
46
- apiBase = '/api'
47
- User ID = 'default_user'
48
- Cache TTL = 60 seconds
49
- Retry Limit = 3
50
- Retry Delay = 1 second (exponential backoff)
51
- ```
52
-
53
- ---
54
-
55
- ## 🧪 Post-Deployment Testing Procedure
56
-
57
- ### Step 1: Verify Application is Accessible
58
- ```
59
- 1. Open: https://huggingface.co/spaces/mohsin-devs/DocVault-app
60
- 2. Should see:
61
- - Logo and "DocVault" title
62
- - Sidebar with "New" button
63
- - File browser area (empty or with existing files)
64
- - Upload progress area
65
- - Storage stats at bottom
66
- 3. Check browser console: No errors
67
- ```
68
-
69
- ### Step 2: Test Basic Upload (5 minutes)
70
- ```
71
- 1. Click "New" → "Upload File"
72
- 2. Select a test file (small .txt file recommended)
73
- 3. Wait for upload to complete
74
- 4. Verify:
75
- ✓ File appears in main area
76
- ✓ File size displays correctly
77
- ✓ Toast shows "Uploaded <filename>" success
78
- ✓ Storage stats update
79
- ```
80
-
81
- ### Step 3: Test Download
82
- ```
83
- 1. Click on uploaded file (or download icon)
84
- 2. If preview modal opens:
85
- - Click download button
86
- - Or: right-click → Save as
87
- 3. Verify: File downloads with original name
88
- 4. Verify: Content is correct
89
- ```
90
-
91
- ### Step 4: Test NEW Rename Feature ⭐ (PRIORITY)
92
- ```
93
- 1. Click file's dropdown menu (three-dot icon)
94
- 2. Should see two options:
95
- - Rename
96
- - Delete
97
- 3. Click "Rename"
98
- 4. Modal appears with filename pre-filled and selected
99
- 5. Type new name: "test_renamed.txt"
100
- 6. Press Enter or click "Rename" button
101
- 7. Verify:
102
- ✓ Modal closes
103
- ✓ File list updates
104
- ✓ New name appears
105
- ✓ Toast shows success
106
- ✓ In HF repo: file renamed
107
- ```
108
-
109
- ### Step 5: Test Delete
110
- ```
111
- 1. Upload another test file
112
- 2. Click file menu → Delete
113
- 3. Delete confirmation modal appears
114
- 4. Click "Confirm Delete"
115
- 5. Verify:
116
- ✓ File removed from list
117
- ✓ Storage stats decrease
118
- ✓ Toast shows "Deleted successfully"
119
- ```
120
-
121
- ### Step 6: Test Folder Operations (5 minutes)
122
- ```
123
- 1. Click "New" → "Create Folder"
124
- 2. Type: "TestFolder"
125
- 3. Click "Create" or press Enter
126
- 4. Verify:
127
- ✓ Folder appears in list
128
- ✓ Folder icon displays
129
- ✓ Toast shows "Folder created"
130
-
131
- 5. Double-click folder to enter
132
- 6. Verify:
133
- ✓ Path updates in breadcrumbs
134
- ✓ Says "Nothing here yet"
135
-
136
- 7. Upload file into folder
137
- 8. Verify: File appears in folder
138
-
139
- 9. Click three-dot menu on folder
140
- 10. Click "Rename" → "Renamed_Folder"
141
- 11. Verify: Folder name updated
142
-
143
- 12. Delete folder
144
- 13. Verify: Removed with all contents
145
- ```
146
-
147
- ### Step 7: Test Version History (HF Mode) ⏸️ - Requires Pre-existing Versions
148
- ```
149
- IF previous versions of files exist in HF repo:
150
- 1. Click file's history icon (clock icon)
151
- 2. History modal opens
152
- 3. Verify:
153
- ✓ Multiple versions listed
154
- ✓ Current version marked
155
- ✓ Commit messages visible
156
- ✓ Timestamps correct
157
-
158
- 4. Test "Restore as Copy":
159
- - Click on old version
160
- - Click "Restore as Copy"
161
- - Modal closes WITHOUT warning
162
- - New file appears with timestamp suffix
163
-
164
- 5. Test "Restore (Overwrite)":
165
- - Click on old version
166
- - Click "Overwrite"
167
- - Confirmation dialog appears
168
- - Click "Confirm"
169
- - File reverted to old version
170
- ```
171
-
172
- ### Step 8: Test Cache Behavior (10 minutes)
173
- ```
174
- 1. Upload file1.txt
175
- 2. Note the time
176
- 3. Reload page within 10 seconds
177
- 4. Verify:
178
- ✓ List loads instantly (uses cache)
179
- ✓ file1.txt visible
180
-
181
- 5. Upload file2.txt
182
- 6. List should update immediately
183
- 7. Wait 65 seconds
184
- 8. Upload file3.txt again
185
- 9. Verify: List updates immediately (cache was cleared)
186
-
187
- DevTools Network check:
188
- - Upload: Should clear cache (no /api/list call immediately after)
189
- - Delete: Should clear cache
190
- - Rename: Should clear cache
191
- ```
192
-
193
- ### Step 9: Test Error Handling (5 minutes)
194
- ```
195
- 1. Note current network activity
196
- 2. Simulate offline: DevTools → Network → Offline
197
- 3. Try to upload: Should show "offline" warning
198
- 4. Go back online: DevTools → Network → Online
199
- 5. Try operation again: Should work
200
-
201
- Alternative error tests:
202
- - Try renaming to extremely long name (>255 chars)
203
- - Try special characters: file[2024].txt
204
- - Try path traversal: ../../../admin
205
- - All should be rejected gracefully with error toast
206
- ```
207
-
208
- ### Step 10: View Mode Toggle (2 minutes)
209
- ```
210
- 1. Files should display in "Grid" view by default
211
- 2. Click grid/list toggle buttons (top right)
212
- 3. Verify:
213
- ✓ View changes between grid and list
214
- ✓ All files still visible
215
- ✓ File actions still work in both views
216
- ✓ Preference persists on reload
217
- ```
218
-
219
- ---
220
-
221
- ## 🔍 Verification Checklist
222
-
223
- ### Frontend Functionality
224
- - [ ] Upload file works
225
- - [ ] Download file works
226
- - [ ] Delete file shows warning, works correctly
227
- - [ ] **Rename file works (NEW FEATURE)**
228
- - [ ] Create folder works
229
- - [ ] Delete folder works
230
- - [ ] **Rename folder works (NEW FEATURE)**
231
- - [ ] Browse folders with breadcrumbs works
232
- - [ ] Grid/List view toggle works
233
- - [ ] View preference persists (localStorage)
234
-
235
- ### API Responsiveness
236
- - [ ] All requests complete within 5 seconds
237
- - [ ] Cache works (repeated list calls are instant)
238
- - [ ] Cache invalidation works (changes appear immediately)
239
- - [ ] Error responses show helpful messages
240
-
241
- ### HF Integration
242
- - [ ] Files appear in https://huggingface.co/datasets/mohsin-devs/DocVault-Storage
243
- - [ ] Deletions remove files from HF repo
244
- - [ ] Renames work correctly in HF repo
245
- - [ ] File structure preserved with user_id prefix
246
-
247
- ### UX/Polish
248
- - [ ] Toast notifications appear and fade
249
- - [ ] Progress indicator shows during operations
250
- - [ ] Modals open/close smoothly
251
- - [ ] No console errors
252
- - [ ] Mobile responsive (test on small screen)
253
- - [ ] Keyboard shortcuts work (Enter to confirm, Escape to cancel)
254
-
255
- ---
256
-
257
- ## 📊 Performance Benchmarks
258
-
259
- | Operation | Expected Time | Current | Pass/Fail |
260
- |-----------|---------------|---------|-----------|
261
- | List files (cached) | <100ms | ? | ? |
262
- | List files (fresh) | <2s | ? | ? |
263
- | Upload small file (<5MB) | <5s | ? | ? |
264
- | Upload large file (45MB) | <30s | ? | ? |
265
- | Download file | <5s | ? | ? |
266
- | Delete file | <2s | ? | ? |
267
- | Rename operation | <2s | ? | ? |
268
- | Cache hit rate | >80% | ? | ? |
269
-
270
- ---
271
-
272
- ## 🐛 Known Issues & Workarounds
273
-
274
- | Issue | Workaround |
275
- |-------|-----------|
276
- | HF file sizes show as 0 | HF API limitation—consider querying file API separately if size needed |
277
- | Search is client-side | Works for <10K files; disable for massive lists or implement backend search |
278
- | Version history not synced | Refresh page/reopen modal to see latest history |
279
- | Large batch operations slow | Reduce batch size or implement progressive loading |
280
-
281
- ---
282
-
283
- ## 🚨 Troubleshooting
284
-
285
- ### Files not appearing after upload
286
- ```
287
- 1. Check network tab: Upload request should return 201
288
- 2. Wait 3 seconds for cache to clear
289
- 3. Refresh page manually
290
- 4. Check HF repo: Files should be at /default_user/filename
291
- 5. If still missing: Check browser console for errors
292
- ```
293
-
294
- ### Rename shows but doesn't work
295
- ```
296
- 1. Verify backend /api/rename endpoint exists
297
- 2. Check response: Should return {"success": true, "message": "..."}
298
- 3. Clear browser cache and hard refresh (Ctrl+F5)
299
- 4. Check console for JavaScript errors
300
- 5. Verify HuggingFace API token is valid
301
- ```
302
-
303
- ### Cache not clearing
304
- ```
305
- 1. Manual refresh: Ctrl+F5 (hard refresh)
306
- 2. Clear browser cache: DevTools → Application → Clear storage
307
- 3. Check network: Recent upload should trigger cache clear
308
- 4. Verify: TTL is 60 seconds (not 5 minutes)
309
- ```
310
-
311
- ### Slow performance
312
- ```
313
- 1. Check: File count (if >1000, might need pagination)
314
- 2. Check: File sizes (very large files slow down listing)
315
- 3. Check: Network speed (throttle in DevTools)
316
- 4. Consider: Reducing cache data logged to console
317
- ```
318
-
319
- ---
320
-
321
- ## 🚀 Production Deployment Readiness
322
-
323
- ### Deployment Checklist
324
- - [x] Code fixes applied and verified
325
- - [x] Cache TTL aligned (60 seconds)
326
- - [x] Error handling comprehensive
327
- - [x] Security validation in place
328
- - [ ] HF token configured in Space settings
329
- - [ ] DEBUG=False set for production
330
- - [ ] Monitoring/alerting configured
331
- - [ ] Backup strategy documented
332
- - [ ] User documentation ready
333
- - [ ] Team trained on deployment
334
-
335
- ### Go/No-Go Decision
336
- After completing all test steps above:
337
- - [ ] Go: All tests passed, ready for production
338
- - [ ] No-Go: Issues found, needs fixes before deployment
339
-
340
- ---
341
-
342
- ## 📞 Support
343
- For issues or questions:
344
- 1. Check this guide
345
- 2. Review `/memories/repo/docvault-comprehensive-audit-report.md` for detailed testing
346
- 3. Check browser console (F12 → Console tab) for error messages
347
- 4. Review HF Space logs for backend errors
348
-
349
- ---
350
-
351
- **Test Date**: ___________
352
- **Tested By**: ___________
353
- **Result**: ☐ PASS ☐ FAIL
354
- **Comments**: ____________________________
355
-
356
- **Sign Off**: _________________ Date: _______