~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
chore(lint): enable no-shadow + rename 47 inner shadows (#3630)
LearningCircuit2f5b70b6e6f0
diff --git a/eslint.config.js b/eslint.config.jsindex cb6ff07280..5552a12e26 100644--- a/eslint.config.js+++ b/eslint.config.js@@ -212,6 +212,9 @@ export default [// Catch dead stores: `let x = 1; x = 2;` where the first 1 is never read"no-useless-assignment": "error",++ // Forbid variable shadowing — clearer reads, fewer accidental rebinds+ "no-shadow": "error",},languageOptions: {diff --git a/src/local_deep_research/web/static/js/collection_upload.js b/src/local_deep_research/web/static/js/collection_upload.jsindex e2dd0c2f08..5355560e69 100644--- a/src/local_deep_research/web/static/js/collection_upload.js+++ b/src/local_deep_research/web/static/js/collection_upload.js@@ -120,7 +120,6 @@ document.addEventListener('DOMContentLoaded', function() {e.preventDefault();dragCounter++;if (e.dataTransfer && e.dataTransfer.types.includes('Files')) {- const dropZone = document.getElementById('drop-zone');if (dropZone) {dropZone.classList.add('ldr-drag-over');// Scroll drop zone into view if not visible@@ -137,7 +136,6 @@ document.addEventListener('DOMContentLoaded', function() {// Only remove class when truly leaving the documentif (dragCounter <= 0) {dragCounter = 0;- const dropZone = document.getElementById('drop-zone');if (dropZone) {dropZone.classList.remove('ldr-drag-over');}@@ -146,7 +144,6 @@ document.addEventListener('DOMContentLoaded', function() {document.addEventListener('drop', () => {dragCounter = 0;- const dropZone = document.getElementById('drop-zone');if (dropZone) {dropZone.classList.remove('ldr-drag-over');}diff --git a/src/local_deep_research/web/static/js/components/details.js b/src/local_deep_research/web/static/js/components/details.jsindex d1c5577e8a..efe76b3aa3 100644--- a/src/local_deep_research/web/static/js/components/details.js+++ b/src/local_deep_research/web/static/js/components/details.js@@ -57,7 +57,7 @@}// Load link analytics for the research- async function loadLinkAnalytics(researchId) {+ async function loadLinkAnalytics() {try {SafeLogger.log('Loading link analytics for research:', researchId);@@ -1078,7 +1078,7 @@}// Load and display context overflow data- async function loadContextOverflowData(researchId) {+ async function loadContextOverflowData() {try {const response = await fetch(`/metrics/api/research/${researchId}/context-overflow`);if (!response.ok) {@@ -1322,10 +1322,10 @@loadResearchMetrics();// Load link analytics for this research- loadLinkAnalytics(researchId);+ loadLinkAnalytics();// Load context overflow data- loadContextOverflowData(researchId);+ loadContextOverflowData();// View Results buttonconst viewResultsBtn = document.getElementById('view-results-btn');diff --git a/src/local_deep_research/web/static/js/components/progress.js b/src/local_deep_research/web/static/js/components/progress.jsindex 19e52ba94b..b2b8941105 100644--- a/src/local_deep_research/web/static/js/components/progress.js+++ b/src/local_deep_research/web/static/js/components/progress.js@@ -408,21 +408,21 @@/*** Update progress bar- * @param {HTMLElement} progressBar - The progress bar element+ * @param {HTMLElement} bar - The progress bar element* @param {number} progress - Progress percentage (0-100)*/- function updateProgressBar(progressBar, progress) {- if (!progressBar) return;+ function updateProgressBar(bar, progress) {+ if (!bar) return;// Ensure progress is between 0-100const percentage = Math.max(0, Math.min(100, Math.floor(progress)));// Update progress bar width with transition for smooth animation- progressBar.style.transition = 'width 0.3s ease-in-out';- progressBar.style.width = `${percentage}%`;+ bar.style.transition = 'width 0.3s ease-in-out';+ bar.style.width = `${percentage}%`;// Update aria-valuenow on the container element (which has role="progressbar")- const progressContainer = progressBar.parentElement;+ const progressContainer = bar.parentElement;if (progressContainer && progressContainer.getAttribute('role') === 'progressbar') {progressContainer.setAttribute('aria-valuenow', percentage);}diff --git a/src/local_deep_research/web/static/js/components/results.js b/src/local_deep_research/web/static/js/components/results.jsindex 4005488f0d..0c6c563480 100644--- a/src/local_deep_research/web/static/js/components/results.js+++ b/src/local_deep_research/web/static/js/components/results.js@@ -455,7 +455,7 @@}// Extract research object if nested- const researchData = data.research || data;+ const dataObj = data.research || data;// Debug nested structure if existsif (data.research) {@@ -473,16 +473,16 @@query = metadata.query;} else if (metadata.title) {query = metadata.title;- } else if (researchData.query) {- query = researchData.query;- } else if (researchData.prompt) {- query = researchData.prompt;- } else if (researchData.title) {- query = researchData.title;- } else if (researchData.question) {- query = researchData.question;- } else if (researchData.input) {- query = researchData.input;+ } else if (dataObj.query) {+ query = dataObj.query;+ } else if (dataObj.prompt) {+ query = dataObj.prompt;+ } else if (dataObj.title) {+ query = dataObj.title;+ } else if (dataObj.question) {+ query = dataObj.question;+ } else if (dataObj.input) {+ query = dataObj.input;}SafeLogger.log('Setting query to:', query);@@ -502,14 +502,14 @@timestampField = metadata.timestamp;} else if (metadata.date) {timestampField = metadata.date;- } else if (researchData.timestamp) {- timestampField = researchData.timestamp;- } else if (researchData.created_at) {- timestampField = researchData.created_at;- } else if (researchData.date) {- timestampField = researchData.date;- } else if (researchData.time) {- timestampField = researchData.time;+ } else if (dataObj.timestamp) {+ timestampField = dataObj.timestamp;+ } else if (dataObj.created_at) {+ timestampField = dataObj.created_at;+ } else if (dataObj.date) {+ timestampField = dataObj.date;+ } else if (dataObj.time) {+ timestampField = dataObj.time;}// Format the date using the available formatter@@ -533,8 +533,8 @@dateStr += ` (${metadata.duration} seconds)`;} else if (metadata.duration_seconds) {dateStr += ` (${metadata.duration_seconds} seconds)`;- } else if (researchData.duration) {- dateStr += ` (${researchData.duration} seconds)`;+ } else if (dataObj.duration) {+ dateStr += ` (${dataObj.duration} seconds)`;}SafeLogger.log('Setting date to:', dateStr);@@ -552,12 +552,12 @@mode = metadata.research_mode;} else if (metadata.type) {mode = metadata.type;- } else if (researchData.mode) {- mode = researchData.mode;- } else if (researchData.research_mode) {- mode = researchData.research_mode;- } else if (researchData.type) {- mode = researchData.type;+ } else if (dataObj.mode) {+ mode = dataObj.mode;+ } else if (dataObj.research_mode) {+ mode = dataObj.research_mode;+ } else if (dataObj.type) {+ mode = dataObj.type;}// Format mode using available formatterdiff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.jsindex dcbcc26542..b37ade62f1 100644--- a/src/local_deep_research/web/static/js/components/settings.js+++ b/src/local_deep_research/web/static/js/components/settings.js@@ -524,9 +524,9 @@JSON.parse(input.value);// Valid JSON on blur, clear any errormarkInvalidInput(input, null);- } catch (e) {+ } catch (err) {// Still invalid on blur, show error- markInvalidInput(input, 'Invalid JSON format: ' + e.message);+ markInvalidInput(input, 'Invalid JSON format: ' + err.message);}}, { once: true });}@@ -758,8 +758,9 @@try {// Try to parse JSON to validateJSON.parse(textarea.value);- } catch (e) {+ } catch {// If it's not valid JSON, show an error+ // Cancel form submission via the outer submit evente.preventDefault();hasInvalidJson = true;@@ -2346,9 +2347,9 @@try {const jsonValue = JSON.parse(input.value);formData[input.name] = jsonValue;- } catch (e) {+ } catch (err) {// Mark as invalid and don't include- markInvalidInput(input, 'Invalid JSON format: ' + e.message);+ markInvalidInput(input, 'Invalid JSON format: ' + err.message);}} else {formData[input.name] = input.value;@@ -2411,8 +2412,8 @@// Skip empty JSONSafeLogger.log(`Skipping empty JSON object for ${actualName}`);}- } catch (e) {- SafeLogger.log(`Error parsing original JSON for ${actualName}:`, e);+ } catch (err) {+ SafeLogger.log(`Error parsing original JSON for ${actualName}:`, err);}} else {// Use the collected data@@ -2467,8 +2468,8 @@// Merge with form data, giving precedence to the raw JSON configObject.assign(formData, flattenedConfig);- } catch (e) {- showAlert('Invalid JSON in raw config editor: ' + e.message, 'error');+ } catch (err) {+ showAlert('Invalid JSON in raw config editor: ' + err.message, 'error');return;}}@@ -2980,8 +2981,8 @@rawConfigSection.style.display = isVisible ? 'none' : 'block';// Update aria-expanded state- const rawConfigToggle = document.getElementById('toggle-raw-config');- if (rawConfigToggle) rawConfigToggle.setAttribute('aria-expanded', String(!isVisible));+ const toggleBtn = document.getElementById('toggle-raw-config');+ if (toggleBtn) toggleBtn.setAttribute('aria-expanded', String(!isVisible));// Update toggle textconst toggleText = document.getElementById('toggle-text');@@ -3542,11 +3543,11 @@if (icon) icon.className = 'fas fa-sync-alt';// Re-filter for current provider- const currentProvider = providerHiddenInput ?+ const provider = providerHiddenInput ?providerHiddenInput.value :settingsProviderInput ? settingsProviderInput.value : 'ollama';- filterModelOptionsForProvider(currentProvider);+ filterModelOptionsForProvider(provider);showAlert('Model list refreshed', 'success');}).catch(error => {@@ -4112,21 +4113,21 @@// Initialize the dropdownif (window.setupCustomDropdown) {- const dropdown = window.setupCustomDropdown(+ const dropdownInstance = window.setupCustomDropdown(dropdownInput,dropdownList,() => optionsSource,(value) => {SafeLogger.log(`Dropdown ${settingKey} selected:`, value);// --- MODIFICATION START: Removed hiddenInput retrieval, already have it ---- const hiddenInput = document.getElementById(`${dropdownInput.id}_hidden`);+ const hidden = document.getElementById(`${dropdownInput.id}_hidden`);// --- MODIFICATION END ---// --- MODIFICATION START: Update hidden input and trigger change ---- if (hiddenInput) {- hiddenInput.value = value;+ if (hidden) {+ hidden.value = value;const changeEvent = new Event('change', { bubbles: true });- hiddenInput.dispatchEvent(changeEvent);+ hidden.dispatchEvent(changeEvent);}// --- MODIFICATION END ---@@ -4148,9 +4149,9 @@);// Set initial value- if (currentValue && dropdown.setValue) {+ if (currentValue && dropdownInstance && dropdownInstance.setValue) {SafeLogger.log(`Setting initial value for ${settingKey}:`, currentValue);- dropdown.setValue(currentValue, false); // Don't fire event on init+ dropdownInstance.setValue(currentValue, false); // Don't fire event on init// --- MODIFICATION START: Set hidden input initial value ---if (hiddenInput) {hiddenInput.value = currentValue;diff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.jsindex a79888875b..65f35685cb 100644--- a/src/local_deep_research/web/static/js/pages/news.js+++ b/src/local_deep_research/web/static/js/pages/news.js@@ -2527,9 +2527,9 @@ async function monitorResearch(researchId, query = null) {SafeLogger.log('Research completed, reloading news feed');// Remove the progress card- const progressCard = document.querySelector(`[data-research-id="${researchId}"]`);- if (progressCard) {- progressCard.remove();+ const card = document.querySelector(`[data-research-id="${researchId}"]`);+ if (card) {+ card.remove();}// Show success message@@ -2544,9 +2544,9 @@ async function monitorResearch(researchId, query = null) {clearInterval(checkInterval);localStorage.removeItem('active_news_research'); // Clear from localStorage// Remove progress card- const progressCard = document.querySelector(`[data-research-id="${researchId}"]`);- if (progressCard) {- progressCard.remove();+ const card = document.querySelector(`[data-research-id="${researchId}"]`);+ if (card) {+ card.remove();}showAlert('Test run failed. Please check your configuration and try again.', 'error');}@@ -3557,15 +3557,15 @@ function showNewsSubscriptionModal(query = '', templateName = '') {// Set up run once buttondocument.getElementById('run-template-btn').addEventListener('click', async () => {- const query = document.getElementById('news-subscription-query').value;- SafeLogger.log('Run Once clicked, query:', query);- if (query) {+ const currentQuery = document.getElementById('news-subscription-query').value;+ SafeLogger.log('Run Once clicked, query:', currentQuery);+ if (currentQuery) {// Close modal firstbootstrap.Modal.getInstance(document.getElementById('newsSubscriptionModal')).hide();// Use the same advanced search function that the search uses- SafeLogger.log('Calling performAdvancedNewsSearch with query:', query);- await performAdvancedNewsSearch(query);+ SafeLogger.log('Calling performAdvancedNewsSearch with query:', currentQuery);+ await performAdvancedNewsSearch(currentQuery);} else {SafeLogger.error('No query found in news-subscription-query input');showAlert('Please enter a query', 'warning');diff --git a/src/local_deep_research/web/static/js/services/pdf.js b/src/local_deep_research/web/static/js/services/pdf.jsindex e9d544ec00..d487d73f5d 100644--- a/src/local_deep_research/web/static/js/services/pdf.js+++ b/src/local_deep_research/web/static/js/services/pdf.js@@ -648,12 +648,12 @@ async function generatePdf(title, content, _metadata = {}) {// Draw cell contentpdf.setTextColor(0, 0, 0);- cellContents.forEach((content, index) => {+ cellContents.forEach((cellText, index) => {let x = margin;for (let j = 0; j < index; j++) {x += colWidths[j];}- pdf.text(content, x + cellPadding, tableY + 12);+ pdf.text(cellText, x + cellPadding, tableY + 12);});// Draw horizontal line after rowdiff --git a/src/local_deep_research/web/static/js/services/socket.js b/src/local_deep_research/web/static/js/services/socket.jsindex 7b0ca4d19c..43b0b66503 100644--- a/src/local_deep_research/web/static/js/services/socket.js+++ b/src/local_deep_research/web/static/js/services/socket.js@@ -911,10 +911,10 @@ if (!window.addConsoleLog) {entry.querySelector('.ldr-log-message').textContent = message;// Add data attribute for filtering- const logEntry = entry.querySelector('.ldr-console-log-entry');- if (logEntry) {- logEntry.dataset.logType = level.toLowerCase();- logEntry.classList.add(`ldr-log-${level.toLowerCase()}`);+ const entryEl = entry.querySelector('.ldr-console-log-entry');+ if (entryEl) {+ entryEl.dataset.logType = level.toLowerCase();+ entryEl.classList.add(`ldr-log-${level.toLowerCase()}`);}} else {// Create a simple log entry without templatediff --git a/tests/api_tests_with_login/test_research_api_enhanced.js b/tests/api_tests_with_login/test_research_api_enhanced.jsindex 57b37e70e1..0320bd7427 100644--- a/tests/api_tests_with_login/test_research_api_enhanced.js+++ b/tests/api_tests_with_login/test_research_api_enhanced.js@@ -129,9 +129,9 @@ describe('Enhanced Research API - Validates Model Usage', function() {while (!completed && attempts < maxAttempts) {await new Promise(resolve => setTimeout(resolve, 3000));- const statusResponse = apiTest.makeRequest(`/api/research/${testResearchId}/status`);- if (statusResponse.status === 200) {- const status = statusResponse.body.status;+ const pollResponse = apiTest.makeRequest(`/api/research/${testResearchId}/status`);+ if (pollResponse.status === 200) {+ const status = pollResponse.body.status;console.log(`Status check ${attempts + 1}: ${status}`);if (status === 'completed') {diff --git a/tests/puppeteer/test_deep_functionality.js b/tests/puppeteer/test_deep_functionality.jsindex e9e34eb61f..a8f0a2e96f 100644--- a/tests/puppeteer/test_deep_functionality.js+++ b/tests/puppeteer/test_deep_functionality.js@@ -529,7 +529,6 @@ describe('Deep Functionality Tests', function() {console.log(' Found Export Markdown button');// Set up download handling- const fs = require('fs');const downloadPath = '/tmp/puppeteer-downloads';if (!fs.existsSync(downloadPath)) {fs.mkdirSync(downloadPath, { recursive: true });diff --git a/tests/ui_tests/NO_CI_executes_research_research_with_model.js b/tests/ui_tests/NO_CI_executes_research_research_with_model.jsindex cfd5fdb13b..32bfaa69b5 100644--- a/tests/ui_tests/NO_CI_executes_research_research_with_model.js+++ b/tests/ui_tests/NO_CI_executes_research_research_with_model.js@@ -143,8 +143,8 @@ async function testResearchWithAvailableModel() {// Method 1: Click submit and wait for responseconst [response] = await Promise.all([page.waitForResponse(- response => response.url().includes('/api/start_research') ||- response.url().includes('/research/'),+ resp => resp.url().includes('/api/start_research') ||+ resp.url().includes('/research/'),{ timeout: 30000 }).catch(() => null),submitButton.click()@@ -172,13 +172,13 @@ async function testResearchWithAvailableModel() {const progress = await page.evaluate(() => {const logs = document.querySelectorAll('.log-entry, .log-item, #logs li');const status = document.querySelector('.status, .research-status, #status');- const progress = document.querySelector('.progress, #progress');+ const progressEl = document.querySelector('.progress, #progress');return {logCount: logs.length,hasStatus: !!status,statusText: status ? status.textContent : '',- hasProgress: !!progress+ hasProgress: !!progressEl};});diff --git a/tests/ui_tests/mobile/test_mobile_diagnostic.js b/tests/ui_tests/mobile/test_mobile_diagnostic.jsindex 37fc853d71..d9bfb6ea05 100644--- a/tests/ui_tests/mobile/test_mobile_diagnostic.js+++ b/tests/ui_tests/mobile/test_mobile_diagnostic.js@@ -286,11 +286,11 @@ class MobileDiagnosticTool {}async annotateIssues(page, issues) {- await page.evaluate((issues) => {+ await page.evaluate((issueList) => {// Remove previous annotationsdocument.querySelectorAll('.diagnostic-annotation').forEach(el => el.remove());- issues.forEach(issue => {+ issueList.forEach(issue => {if (issue.type === 'small-touch-targets' && issue.details) {issue.details.forEach(target => {const annotation = document.createElement('div');diff --git a/tests/ui_tests/mobile/test_ui_functionality_ci.js b/tests/ui_tests/mobile/test_ui_functionality_ci.jsindex 47a43318f9..592f26dd08 100644--- a/tests/ui_tests/mobile/test_ui_functionality_ci.js+++ b/tests/ui_tests/mobile/test_ui_functionality_ci.js@@ -528,10 +528,10 @@ const ScrollTests = {await navigateTo(page, `${baseUrl}/settings/`);const result = await page.evaluate(() => {- const main = document.querySelector('main, .main-content, .container');- if (!main) return { exists: false };+ const mainEl = document.querySelector('main, .main-content, .container');+ if (!mainEl) return { exists: false };- const allElements = main.querySelectorAll('*');+ const allElements = mainEl.querySelectorAll('*');let lastBottom = 0;allElements.forEach(el => {diff --git a/tests/ui_tests/test_api_key_comprehensive.js b/tests/ui_tests/test_api_key_comprehensive.jsindex d2fd1cacec..75fa93969f 100644--- a/tests/ui_tests/test_api_key_comprehensive.js+++ b/tests/ui_tests/test_api_key_comprehensive.js@@ -63,7 +63,7 @@ async function runComprehensiveApiKeyTest() {log(`Test user: ${testUsername}`, 'info');// Launch browser- const browser = await puppeteer.launch(getPuppeteerLaunchOptions());+ browser = await puppeteer.launch(getPuppeteerLaunchOptions());page = await browser.newPage();await page.setViewport({ width: 1920, height: 1080 });diff --git a/tests/ui_tests/test_api_key_via_api.js b/tests/ui_tests/test_api_key_via_api.jsindex c81536c080..9759ea415b 100644--- a/tests/ui_tests/test_api_key_via_api.js+++ b/tests/ui_tests/test_api_key_via_api.js@@ -16,7 +16,7 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');const BASE_URL = 'http://localhost:5000';// Launch browser- const browser = await puppeteer.launch(getPuppeteerLaunchOptions());+ browser = await puppeteer.launch(getPuppeteerLaunchOptions());const page = await browser.newPage();diff --git a/tests/ui_tests/test_benchmark_settings.js b/tests/ui_tests/test_benchmark_settings.jsindex 2d4d82f8bd..32f12248e9 100644--- a/tests/ui_tests/test_benchmark_settings.js+++ b/tests/ui_tests/test_benchmark_settings.js@@ -64,15 +64,15 @@ async function waitForTextOnPage(page, text, timeout = 30000) {return false;}}-async function typeWithDelay(page, selector, text, delay = 50) {+async function typeWithDelay(page, selector, text, charDelay = 50) {await page.focus(selector);- await page.evaluate(selector => {- document.querySelector(selector).value = '';+ await page.evaluate(sel => {+ document.querySelector(sel).value = '';}, selector);for (const char of text) {await page.type(selector, char);- await new Promise(resolve => setTimeout(resolve, delay));+ await new Promise(resolve => setTimeout(resolve, charDelay));}}@@ -95,7 +95,7 @@ async function keepSessionAlive(page) {try {log('=== Starting Benchmark Settings Puppeteer Test ===', colors.bright);- const browser = await puppeteer.launch(getPuppeteerLaunchOptions());+ browser = await puppeteer.launch(getPuppeteerLaunchOptions());logSuccess('Browser launched');const page = await browser.newPage();diff --git a/tests/ui_tests/test_cost_analytics.js b/tests/ui_tests/test_cost_analytics.jsindex a62abfb1a8..f95d39da8f 100644--- a/tests/ui_tests/test_cost_analytics.js+++ b/tests/ui_tests/test_cost_analytics.js@@ -113,9 +113,9 @@ async function testCostAnalytics() {console.log('🔧 Manually testing API call...');const apiResponse = await page.evaluate(async () => {try {- const response = await fetch('/metrics/api/cost-analytics?period=7d');- const data = await response.json();- return { success: true, status: response.status, data };+ const resp = await fetch('/metrics/api/cost-analytics?period=7d');+ const data = await resp.json();+ return { success: true, status: resp.status, data };} catch (error) {return { success: false, error: error.message };}diff --git a/tests/ui_tests/test_followup_research.js b/tests/ui_tests/test_followup_research.jsindex 9aa5e7335d..8d47d26931 100644--- a/tests/ui_tests/test_followup_research.js+++ b/tests/ui_tests/test_followup_research.js@@ -191,12 +191,12 @@ async function testFollowUpResearch() {// Check if modal is visibleconst modalVisible = await page.evaluate(() => {- const modal = document.getElementById('followUpModal');- if (!modal) return false;+ const m = document.getElementById('followUpModal');+ if (!m) return false;// Check Bootstrap modal classes or inline styles- const hasShowClass = modal.classList.contains('show');- const displayStyle = window.getComputedStyle(modal).display;+ const hasShowClass = m.classList.contains('show');+ const displayStyle = window.getComputedStyle(m).display;return hasShowClass || displayStyle !== 'none';});@@ -263,9 +263,9 @@ async function testFollowUpResearch() {// Debug: Log all buttons in the modalconst modalInfo = await page.evaluate(() => {- const modal = document.querySelector('#followUpModal');- const modalVisible = modal && window.getComputedStyle(modal).display !== 'none';- const buttons = modal ? modal.querySelectorAll('button') : [];+ const m = document.querySelector('#followUpModal');+ const isVisible = m && window.getComputedStyle(m).display !== 'none';+ const buttons = m ? m.querySelectorAll('button') : [];const buttonInfo = Array.from(buttons).map(btn => ({text: btn.textContent.trim(),classes: btn.className,@@ -278,8 +278,8 @@ async function testFollowUpResearch() {const specificBtn = document.querySelector('#startFollowUpBtn');return {- modalFound: !!modal,- modalVisible,+ modalFound: !!m,+ modalVisible: isVisible,buttonCount: buttons.length,buttons: buttonInfo,startFollowUpBtnFound: !!specificBtn,diff --git a/tests/ui_tests/test_metrics.js b/tests/ui_tests/test_metrics.jsindex ed9b744152..79de83de29 100644--- a/tests/ui_tests/test_metrics.js+++ b/tests/ui_tests/test_metrics.js@@ -26,14 +26,14 @@ exec('curl -s http://127.0.0.1:5000/metrics/', (error, stdout) => {// Test the API endpoints that the JavaScript would callconsole.log('\nTesting API endpoints...');- exec('curl -s "http://127.0.0.1:5000/metrics/api/metrics?period=30d&mode=all"', (error, stdout) => {- if (error) {- console.error('Basic API error:', error);+ exec('curl -s "http://127.0.0.1:5000/metrics/api/metrics?period=30d&mode=all"', (basicErr, basicOut) => {+ if (basicErr) {+ console.error('Basic API error:', basicErr);return;}try {- const data = JSON.parse(stdout);+ const data = JSON.parse(basicOut);if (data.status === 'success') {console.log('✓ Basic metrics API working');console.log(' - Total tokens:', data.metrics.total_tokens);@@ -47,14 +47,14 @@ exec('curl -s http://127.0.0.1:5000/metrics/', (error, stdout) => {}});- exec('curl -s "http://127.0.0.1:5000/metrics/api/metrics/enhanced?period=30d&mode=all"', (error, stdout) => {- if (error) {- console.error('Enhanced API error:', error);+ exec('curl -s "http://127.0.0.1:5000/metrics/api/metrics/enhanced?period=30d&mode=all"', (enhancedErr, enhancedOut) => {+ if (enhancedErr) {+ console.error('Enhanced API error:', enhancedErr);return;}try {- const data = JSON.parse(stdout);+ const data = JSON.parse(enhancedOut);if (data.status === 'success') {console.log('✓ Enhanced metrics API working');console.log(' - Has search_engine_stats:', !!data.metrics.search_engine_stats);diff --git a/tests/ui_tests/test_pages_browser.js b/tests/ui_tests/test_pages_browser.jsindex 130db3494b..4486e09f80 100644--- a/tests/ui_tests/test_pages_browser.js+++ b/tests/ui_tests/test_pages_browser.js@@ -76,8 +76,8 @@ class BrowserTester {}}- async testPage(path, testName, customTests = null) {- const url = `${this.baseUrl}${path}`;+ async testPage(urlPath, testName, customTests = null) {+ const url = `${this.baseUrl}${urlPath}`;console.log(`\n📄 Testing ${testName}: ${url}`);try {diff --git a/tests/ui_tests/test_rate_limiting_settings.js b/tests/ui_tests/test_rate_limiting_settings.jsindex e4a59df5d8..8937c2f3c1 100644--- a/tests/ui_tests/test_rate_limiting_settings.js+++ b/tests/ui_tests/test_rate_limiting_settings.js@@ -39,8 +39,8 @@ async function testRateLimiting() {// Make login attempts until rate limitedfor (let i = 0; i < 10; i++) {- const response = await page.evaluate(async (baseUrl) => {- const res = await fetch(`${baseUrl}/api/v1/auth/login`, {+ const response = await page.evaluate(async (url) => {+ const res = await fetch(`${url}/api/v1/auth/login`, {method: 'POST',headers: {'Content-Type': 'application/json',@@ -97,8 +97,8 @@ async function testRateLimiting() {// Make registration attempts until rate limitedfor (let i = 0; i < 10; i++) {- const response = await page2.evaluate(async (baseUrl, attemptNum) => {- const res = await fetch(`${baseUrl}/api/v1/auth/register`, {+ const response = await page2.evaluate(async (url, attemptNum) => {+ const res = await fetch(`${url}/api/v1/auth/register`, {method: 'POST',headers: {'Content-Type': 'application/json',@@ -148,8 +148,8 @@ async function testRateLimiting() {// Test 3: Verify 429 error response formatconsole.log('\n🔍 Test 3: Verify 429 error response format');- const errorResponse = await page.evaluate(async (baseUrl) => {- const res = await fetch(`${baseUrl}/api/v1/auth/login`, {+ const errorResponse = await page.evaluate(async (url) => {+ const res = await fetch(`${url}/api/v1/auth/login`, {method: 'POST',headers: {'Content-Type': 'application/json',diff --git a/tests/ui_tests/test_research_diagnosis.js b/tests/ui_tests/test_research_diagnosis.jsindex c02722decc..79fb9e5ab4 100644--- a/tests/ui_tests/test_research_diagnosis.js+++ b/tests/ui_tests/test_research_diagnosis.js@@ -168,8 +168,8 @@ async function testResearchDiagnosis() {const data = {};const form = document.getElementById('research-form');if (form) {- const formData = new FormData(form);- for (const [key, value] of formData.entries()) {+ const fd = new FormData(form);+ for (const [key, value] of fd.entries()) {data[key] = value;}}diff --git a/tests/ui_tests/test_results_exports_ci.js b/tests/ui_tests/test_results_exports_ci.jsindex a6e22169e9..ec2104c894 100644--- a/tests/ui_tests/test_results_exports_ci.js+++ b/tests/ui_tests/test_results_exports_ci.js@@ -247,10 +247,10 @@ const StarRatingTests = {// Get initial stateconst beforeHover = await page.evaluate((sel) => {- const star = document.querySelector(sel);+ const el = document.querySelector(sel);return {- className: star?.className,- style: star ? window.getComputedStyle(star).color : null+ className: el?.className,+ style: el ? window.getComputedStyle(el).color : null};}, starSelector);@@ -260,10 +260,10 @@ const StarRatingTests = {// Get hover stateconst afterHover = await page.evaluate((sel) => {- const star = document.querySelector(sel);+ const el = document.querySelector(sel);return {- className: star?.className,- style: star ? window.getComputedStyle(star).color : null+ className: el?.className,+ style: el ? window.getComputedStyle(el).color : null};}, starSelector);