fix: code review fixes, Perplexity API enhancements, and test improvements - #15
Open
powerfulqa wants to merge 3 commits into
Open
fix: code review fixes, Perplexity API enhancements, and test improvements#15powerfulqa wants to merge 3 commits into
powerfulqa wants to merge 3 commits into
Conversation
…ments Security: - Fix SQL injection in database.js getPerformanceMetrics() - pass hours as parameterized query instead of string interpolation Error handling & resilience: - Fix conversation cleanup using wrong threshold (24h cache interval instead of 15min inactivity timeout) - Replace setInterval with self-scheduling setTimeout in metrics broadcaster to prevent overlapping broadcasts - Add debug logging to empty catch blocks in web-dashboard - Replace all synchronous file I/O (readFileSync, writeFileSync, execSync) with async equivalents in web-dashboard and configHandlers Architecture: - Remove 625 lines of duplicate inline socket handlers from web-dashboard.js (3233 -> 2608 lines) by wiring up the already-extracted handler modules - Remove unused imports (fs, getBootEnabledStatus, buildServiceObject, etc.) - Cap userStats Map loading to DEFAULT_MAX_ENTRIES to prevent unbounded growth Perplexity API enhancements: - Auto-upgrade to sonar-pro model for multi-turn conversations (>2 messages) - Enable return_citations and append compact domain-only source footer - Add configurable search_domain_filter for gaming-specific sources - Auto-detect time-sensitive queries and apply search_recency_filter - Log token usage (prompt/completion/total) from every API response - Extract _selectModel() and _buildSearchOptions() helpers for testability Bug fixes: - Fix getTimeAgo() month/year calculation using calendar-aware math instead of dividing days by 30 (fixes flaky tests near month boundaries and DST) - Convert help command from string concatenation to template literal Tests: - Add 32 new tests for Perplexity API features (api-client-search-features, perplexity-secure-search-features) - All 1845 tests passing across 182 suites (0 failures) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump package.json version to 2.0.0 - Create docs/RELEASE-NOTES-v2.0.0.md with full release notes - Update CHANGELOG.md with v2.0.0 entry - Update README.md: version, test count, features (citations, sonar-pro), future enhancements checklist - Update wiki/Home.md and wiki/_Sidebar.md to v2.0.0 - Update docs/README.md to mark v2.0.0 as LATEST Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove tracked test artifacts (test-output.txt, test-results.json) from git — these were committed before .gitignore rules were added - Move QLTY-FIXES-SUMMARY.md and QUALITY-IMPROVEMENTS-FINAL.md from root to docs/qlty/ where they belong - Archive 17 v1.x release notes to docs/release-notes/ subdirectory, keeping only v2.0.0 at docs/ top level - Update all internal links across README.md, docs/README.md, docs/CACHE-SERVICE-ARCHITECTURE.md, docs/DASHBOARD-API-REFERENCE-v1.9.0.md, wiki/Dashboard-Features-Complete.md, wiki/V1.9.0-Dashboard-Implementation.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getPerformanceMetrics()— parameterized query instead of string interpolationweb-dashboard.jsby wiring up extracted handler modules, replace all sync file I/O with asyncsonar-profor multi-turn conversations, enable citations with compact domain footer, add search recency filter for time-sensitive queries, log token usagegetTimeAgo()calendar math (DST/month boundary flakiness), fix conversation cleanup using wrong threshold, fix metrics broadcast overlapChanges by file
src/services/database.jssrc/services/web-dashboard.jssrc/services/web-dashboard/handlers/configHandlers.jssrc/services/web-dashboard/metrics-broadcaster.jssrc/utils/conversation.jssrc/services/api-client.jssrc/services/perplexity-secure.jssrc/config/config.jssrc/utils/time-ago.jssrc/commands/index.js__tests__/unit/services/api-client-search-features.test.js__tests__/unit/services/perplexity-secure-search-features.test.jsTest plan
npm install, restart service, verify bot responds with citation footersAPI Usage:andmodel="sonar-pro"entries🤖 Generated with Claude Code