- Remove dead nil check in ignorePayload() (repoFiles already initialized)
- Replace manual map merge loops with maps.Copy in 3 handler sites
- Deduplicate fmt.Sprintf + ui.Success in doctor checkSkillignore
- Extract extractIgnoreSources() helper in SyncPage to DRY two identical
state-setting blocks
Add ignore_root and ignore_repos fields to sync/diff/diff-stream API
responses from IgnoreStats. UI now uses real file paths instead of
heuristic (skill name starts with _) to determine ignore source.
Switch from DiscoverSourceSkills to DiscoverSourceSkillsWithStats so
the sync, diff, and diff-stream endpoints can surface .skillignore
stats (ignored_count, ignored_skills) in their JSON responses.
Addresses P1 and P2 from code review on the RWMutex commit:
P1 — Stream handlers now snapshot config under RLock before streaming:
- handleDiffStream: clone Targets map to prevent concurrent map panic
- handleCheckStream, handleAuditStream: snapshot source/projectRoot
- handleUpdateStream: snapshot source (per-item Lock already correct)
P2 — All read handlers now use narrow snapshot instead of defer RUnlock:
- RLock → copy needed fields to locals → RUnlock → do work with locals
- Prevents slow I/O (git fetch, version check, audit scan) from blocking
the auto-reload middleware's exclusive Lock on concurrent requests
Other changes:
- computeTargetDiff takes source parameter (no more s.cfg.Source access)
- Add cloneTargets() helper for safe map copying
- Add writeOpsLogTo/writeAuditLogTo for lock-free oplog writes
Replace sequential POST loops and blocking useQuery calls with
Server-Sent Events for real-time progress feedback on Update, Check,
and Diff operations. Extract shared helpers to reduce duplication:
- initSSE() in middleware.go consolidates SSE preamble across 4 handlers
- createSSEStream() in client.ts unifies EventSource lifecycle management
- StreamProgressBar component replaces 3 near-identical progress bars
- handleDiff now delegates to computeTargetDiff (eliminates ~150 lines)
- Paginate audit results (20 cards + 10 findings per card) to prevent
DOM overload with large skill counts