Skip to content

Commit 19a3984

Browse files
committed
update
1 parent e326f5f commit 19a3984

File tree

1 file changed

+185
-1
lines changed

1 file changed

+185
-1
lines changed

.github/listen.md

Lines changed: 185 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,34 @@ fetch('./api/endpoint');
166166
- [ ] Check browser console for errors
167167
- [ ] Get user approval before committing
168168

169+
### Proactive Violation Scanning
170+
**Run these before every release to catch violations early:**
171+
```bash
172+
# 1. Absolute URL violations (most critical for subpath deployment)
173+
echo "=== SCANNING FOR ABSOLUTE URL VIOLATIONS ==="
174+
grep -r "fetch('/api/" frontend/ --include="*.js" | wc -l | xargs echo "fetch() absolute URLs:"
175+
grep -r "window.location.href.*= '/" frontend/ --include="*.js" --include="*.html" | wc -l | xargs echo "redirect absolute URLs:"
176+
177+
# 2. Documentation link violations
178+
echo "=== SCANNING FOR DOCUMENTATION LINK VIOLATIONS ==="
179+
grep -r "href.*plexguide.github.io" frontend/ --include="*.js" | grep -v "plexguide.github.io/Huntarr.io" | wc -l | xargs echo "wrong domain links:"
180+
181+
# 3. Hard-coded path violations
182+
echo "=== SCANNING FOR HARD-CODED PATH VIOLATIONS ==="
183+
grep -r "/config" src/ --include="*.py" | grep -v "_detect_environment\|_get.*path" | wc -l | xargs echo "hard-coded /config paths:"
184+
grep -r "/app" src/ --include="*.py" | grep -v "_detect_environment\|_get.*path" | wc -l | xargs echo "hard-coded /app paths:"
185+
186+
# 4. Frontend-docs alignment check
187+
echo "=== CHECKING FRONTEND-DOCS ALIGNMENT ==="
188+
echo "Frontend anchor references:"
189+
grep -r "href.*plexguide\.github\.io.*#" frontend/static/js/ | grep -o "#[^\"]*" | sort | uniq | wc -l
190+
echo "Documentation anchors available:"
191+
grep -r 'id="[^"]*"' docs/apps/ | grep -o 'id="[^"]*"' | sort | uniq | wc -l
192+
```
193+
169194
### Path Hunting Commands
170195
```bash
171-
# Search for hard-coded paths
196+
# Search for hard-coded paths (legacy)
172197
grep -r "/config" src/ --include="*.py"
173198
grep -r "/app" src/ --include="*.py"
174199
grep -r "href=\"/" frontend/
@@ -195,6 +220,35 @@ grep -r "window.location.href = '/" frontend/
195220

196221
## 🎯 DEBUGGING QUICK REFERENCE
197222

223+
### Systematic Issue Discovery
224+
**When things don't work, don't guess - scan systematically:**
225+
```bash
226+
# 1. Check for violation patterns first
227+
./violation_scan.sh # From proactive practices above
228+
229+
# 2. Specific issue hunting
230+
grep -r "EXACT_ERROR_TEXT" frontend/ src/ --include="*.js" --include="*.py"
231+
grep -r "functionName\|variableName" frontend/ --include="*.js"
232+
```
233+
234+
### Subpath Deployment Issues
235+
**Symptoms:** Works on localhost, fails on domain.com/huntarr/
236+
**Root Cause:** Absolute URLs that don't work in subdirectories
237+
**Debug Process:**
238+
1. Check browser network tab for 404s on absolute URLs
239+
2. Search for absolute patterns: `grep -r "fetch('/api" frontend/`
240+
3. Check redirects: `grep -r "window.location.href.*= '/" frontend/`
241+
4. Verify all URLs are relative: `./api/` not `/api/`
242+
243+
### Frontend-Documentation Link Issues
244+
**Symptoms:** Info icons (i) lead to 404 or wrong pages
245+
**Root Cause:** Mismatched frontend links vs documentation anchors
246+
**Debug Process:**
247+
1. Extract frontend anchor references: `grep -r "href.*#" frontend/static/js/ | grep -o "#[^\"]*"`
248+
2. Extract doc anchors: `grep -r 'id="[^"]*"' docs/ | grep -o 'id="[^"]*"'`
249+
3. Compare lists to find mismatches
250+
4. Add missing anchors or fix links
251+
198252
### Log Issues
199253
1. Check if logs exist: `docker exec huntarr cat /config/logs/[app].log`
200254
2. Test backend streaming: `curl -N -s "http://localhost:9705/logs?app=[app]"`
@@ -206,12 +260,14 @@ grep -r "window.location.href = '/" frontend/
206260
2. Verify paths exist in target environment
207261
3. Test with both Docker and bare metal
208262
4. Check file permissions
263+
5. **NEW:** Scan for hard-coded paths: `grep -r "/config\|/app" src/ | grep -v "_detect_environment"`
209264

210265
### JavaScript Issues
211266
1. Check browser console for errors
212267
2. Search for undefined variables: `grep -r "variableName" frontend/`
213268
3. Verify HTML structure matches selectors
214269
4. Compare with working functions
270+
5. **NEW:** Check for absolute URL patterns causing 404s in subpaths
215271

216272
### CSS Issues
217273
1. Check browser console for errors
@@ -225,9 +281,81 @@ grep -r "window.location.href = '/" frontend/
225281
2. Verify `getFormSettings()` method
226282
3. Test save/load cycle
227283
4. Check API endpoints
284+
5. **NEW:** Verify info icon links point to existing documentation anchors
285+
286+
### Documentation Issues
287+
**Symptoms:** Broken links, 404s, outdated information
288+
**Debug Process:**
289+
1. Test all links manually or with link checker
290+
2. Verify features mentioned actually exist in codebase
291+
3. Check frontend alignment with documentation
292+
4. Audit FAQ against real support requests
228293

229294
## 📊 RECENT IMPROVEMENTS
230295

296+
### Systematic Code Violation Fixes (2024-12)
297+
**Issue:** 71 systematic code violations discovered through comprehensive codebase analysis
298+
**Root Cause:** Lack of proactive violation scanning and systematic fixing approach
299+
**Solution:** Implemented systematic approach to finding and fixing violations
300+
301+
**Fixed Violations:**
302+
1. **51 absolute fetch URLs** - All `/api/` calls converted to `./api/` for subpath compatibility
303+
2. **15 outdated documentation links** - Fixed old domain references in settings_forms.js
304+
3. **5 window.location.href absolute URLs** - Converted `/` redirects to `./`
305+
4. **Missing documentation anchors** - Added proper IDs to all referenced doc sections
306+
307+
**Key Files Modified:**
308+
- `/frontend/static/js/settings_forms.js` - Documentation links and form generation
309+
- `/frontend/static/js/new-main.js` - URL handling and redirects
310+
- `/frontend/static/js/apps.js` - API calls and fetch operations
311+
- All documentation files - Added missing anchor IDs
312+
313+
**Prevention Strategy:** Use systematic grep searches to catch violations early:
314+
```bash
315+
# Catch absolute URLs before they become problems
316+
grep -r "fetch('/api/" frontend/ --include="*.js"
317+
grep -r "window.location.href.*= '/" frontend/ --include="*.js" --include="*.html"
318+
grep -r "href.*plexguide.github.io" frontend/ --include="*.js" | grep -v "plexguide.github.io/Huntarr.io"
319+
```
320+
321+
### Documentation Reality Check & User Experience (2024-12)
322+
**Issue:** Documentation promised features that didn't exist (standalone logs/history pages)
323+
**Root Cause:** Feature documentation grew organically without reality checks
324+
**Solution:** Systematic audit of promised vs actual features
325+
326+
**Changes:**
327+
- Removed broken links to non-existent logs.html and history.html
328+
- Updated features page to reflect actual functionality (Swaparr, Search Automation)
329+
- Completely rewrote FAQ with real-world Docker problems and practical solutions
330+
- Added prominent community help section on homepage with proper user flow
331+
332+
**Lessons Learned:**
333+
- **Document what exists, not what's planned** - Only link to documentation that actually exists
334+
- **FAQ should solve real problems** - Base content on actual support requests, not theoretical issues
335+
- **User journey matters** - Help → Explanation → Setup → Community is better than promotional content
336+
337+
### Frontend-Documentation Alignment System (2024-12)
338+
**Issue:** Frontend info icons linked to anchors that didn't exist in documentation
339+
**Root Cause:** No systematic checking of frontend links against actual documentation
340+
**Solution:** Implemented verification system for frontend→docs alignment
341+
342+
**Process:**
343+
1. Extract all documentation links from frontend: `grep -r "plexguide.github.io.*#" frontend/`
344+
2. Extract all anchor IDs from docs: `grep -r 'id="[^"]*"' docs/`
345+
3. Cross-reference and fix mismatches
346+
4. Add missing anchor IDs where content exists but ID missing
347+
348+
**Prevention:** Before any documentation changes, verify link alignment:
349+
```bash
350+
# Extract frontend links
351+
grep -r "href.*plexguide\.github\.io.*#" frontend/static/js/ | grep -o "#[^\"]*" | sort | uniq
352+
353+
# Extract doc anchors
354+
grep -r 'id="[^"]*"' docs/apps/ | grep -o 'id="[^"]*"' | sort | uniq
355+
356+
# Compare results to catch mismatches
357+
```
358+
231359
### Radarr Release Date Consistency (2024-12)
232360
**Issue:** Missing movie searches respected `skip_future_releases` setting, but upgrade searches ignored it
233361
**Solution:** Made upgrade behavior consistent with missing movie logic
@@ -251,6 +379,62 @@ grep -r "window.location.href = '/" frontend/
251379
8. **❌ Adding responsive CSS to component templates (use external CSS files)**
252380
9. **❌ Not using debug borders to test CSS loading**
253381
10. **❌ Inconsistent behavior between missing/upgrade logic** - Always check both implement same filtering
382+
11. **❌ Reactive violation fixing** - Don't wait for problems to appear, scan proactively
383+
12. **❌ Documentation that promises non-existent features** - Only document what actually exists
384+
13. **❌ Frontend links without verifying documentation anchors exist** - Always cross-check
385+
14. **❌ Organic feature growth without reality checks** - Audit promised vs actual features regularly
386+
15. **❌ Theoretical FAQ content** - Base FAQ on real user problems and support requests
387+
388+
## 🚨 PROACTIVE DEVELOPMENT PRACTICES
389+
390+
### Pre-Commit Violation Scanning
391+
**ALWAYS run before any commit to catch violations early:**
392+
```bash
393+
# Create violation_scan.sh for easy reuse
394+
echo "=== HUNTARR VIOLATION SCAN ==="
395+
echo "1. Absolute URL violations (breaks subpath deployment):"
396+
echo " fetch() absolute URLs: $(grep -r "fetch('/api/" frontend/ --include="*.js" | wc -l)"
397+
echo " redirect absolute URLs: $(grep -r "window.location.href.*= '/" frontend/ --include="*.js" --include="*.html" | wc -l)"
398+
echo ""
399+
echo "2. Documentation violations:"
400+
echo " Wrong domain links: $(grep -r "href.*plexguide.github.io" frontend/ --include="*.js" | grep -v "plexguide.github.io/Huntarr.io" | wc -l)"
401+
echo ""
402+
echo "3. Hard-coded path violations:"
403+
echo " /config paths: $(grep -r "/config" src/ --include="*.py" | grep -v "_detect_environment\|_get.*path" | wc -l)"
404+
echo " /app paths: $(grep -r "/app" src/ --include="*.py" | grep -v "_detect_environment\|_get.*path" | wc -l)"
405+
echo ""
406+
echo "4. Frontend-docs alignment:"
407+
echo " Frontend anchors: $(grep -r "href.*plexguide\.github\.io.*#" frontend/static/js/ 2>/dev/null | grep -o "#[^\"]*" | sort | uniq | wc -l)"
408+
echo " Doc anchors: $(grep -r 'id="[^"]*"' docs/apps/ 2>/dev/null | grep -o 'id="[^"]*"' | sort | uniq | wc -l)"
409+
echo "=== SCAN COMPLETE ==="
410+
```
411+
412+
### Documentation Reality Audit Process
413+
**Before any documentation changes:**
414+
1. **Verify features exist**: Don't document planned features, only existing ones
415+
2. **Check all links work**: Test every link in documentation
416+
3. **Verify frontend alignment**: Ensure info icons point to existing anchors
417+
4. **FAQ reality check**: Base content on actual support requests, not theoretical issues
418+
419+
**Commands to audit documentation:**
420+
```bash
421+
# 1. Find all links in documentation
422+
grep -r "href=" docs/ | grep -v "^#" | cut -d'"' -f2 | sort | uniq
423+
424+
# 2. Find all frontend documentation links
425+
grep -r "plexguide.github.io" frontend/static/js/ | grep -o "https://[^\"]*"
426+
427+
# 3. Check anchor mismatches
428+
diff <(grep -r "href.*#" frontend/static/js/ | grep -o "#[^\"]*" | sort | uniq) \
429+
<(grep -r 'id="[^"]*"' docs/ | grep -o 'id="[^"]*"' | sed 's/id="//' | sed 's/"$//' | sort | uniq)
430+
```
431+
432+
### User Experience Validation
433+
**Before major UI changes:**
434+
1. **Test user journey**: Help → Explanation → Setup → Community
435+
2. **Verify community links work**: Discord, GitHub Issues, Reddit
436+
3. **Check mobile responsiveness**: Test all breakpoints
437+
4. **Validate against real user problems**: Base features on actual use cases
254438

255439
## 🚀 ENVIRONMENT DETECTION PATTERN
256440

0 commit comments

Comments
 (0)