Skip to content

~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.

fix: resolve failing tests in dev-to-main merge PR #899

LearningCircuit001a7ebe8206
diff --git a/src/local_deep_research/security/ssrf_validator.py b/src/local_deep_research/security/ssrf_validator.py
index 568474a0b5..362c547bf6 100644
--- a/src/local_deep_research/security/ssrf_validator.py
+++ b/src/local_deep_research/security/ssrf_validator.py
@@ -6,13 +6,12 @@ by blocking requests to internal/private networks and enforcing safe schemes.
"""
import ipaddress
+import os
import socket
from urllib.parse import urlparse
from typing import Optional
from loguru import logger
-from ..settings.env_definitions.testing import TESTING
-from ..settings.env_definitions.security import PYTEST_CURRENT_TEST
from ..settings.env_registry import get_env_setting
@@ -91,10 +90,14 @@ def validate_url(url: str, allow_redirects: bool = True) -> bool:
- LDR_SECURITY_SSRF_DISABLE_VALIDATION=true
"""
# Bypass SSRF validation in test mode
+ # Check environment variables at runtime (not import time) to ensure
+ # pytest's PYTEST_CURRENT_TEST is captured when tests actually run
disable_ssrf = get_env_setting(
"security.ssrf.disable_validation", default=False
)
- if TESTING or PYTEST_CURRENT_TEST or disable_ssrf:
+ testing_mode = os.environ.get("TESTING", "").lower() in ("true", "1", "yes")
+ pytest_current_test = os.environ.get("PYTEST_CURRENT_TEST")
+ if testing_mode or pytest_current_test or disable_ssrf:
logger.debug(f"SSRF validation bypassed in test mode for URL: {url}")
return True
diff --git a/tests/ui_tests/library/test_collections_page.js b/tests/ui_tests/library/test_collections_page.js
index 69b9146ba7..782bcd53fe 100644
--- a/tests/ui_tests/library/test_collections_page.js
+++ b/tests/ui_tests/library/test_collections_page.js
@@ -12,6 +12,9 @@ const { getPuppeteerLaunchOptions } = require('../puppeteer_config');
const BASE_URL = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';
const TIMEOUT = 30000;
+// Helper function for delays (Puppeteer doesn't have waitForTimeout like Playwright)
+const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
+
async function runTests() {
console.log('🧪 Testing Collections Page UI\n');
@@ -60,7 +63,7 @@ async function runTests() {
await page.goto(`${BASE_URL}/library/`, { waitUntil: 'networkidle2' });
// Wait a bit for page to fully load
- await page.waitForTimeout(1000);
+ await delay(1000);
const pageContent = await page.content();
if (!pageContent.toLowerCase().includes('library') && !pageContent.toLowerCase().includes('collection')) {
@@ -87,7 +90,7 @@ async function runTests() {
await authHelper.ensureAuthenticated();
await page.goto(`${BASE_URL}/library/`, { waitUntil: 'networkidle2' });
- await page.waitForTimeout(1000);
+ await delay(1000);
const pageContent = await page.content();
if (pageContent.length < 100) {
@@ -114,7 +117,7 @@ async function runTests() {
await authHelper.ensureAuthenticated();
await page.goto(`${BASE_URL}/library/`, { waitUntil: 'networkidle2' });
- await page.waitForTimeout(1000);
+ await delay(1000);
const createButton = await page.$(
'button[data-action="create-collection"], .create-collection-btn, [onclick*="createCollection"], button:has-text("Create")'
@@ -146,15 +149,15 @@ async function runTests() {
await authHelper.ensureAuthenticated();
await page.goto(`${BASE_URL}/library/`, { waitUntil: 'networkidle2' });
- await page.waitForTimeout(1000);
+ await delay(1000);
const collectionLink = await page.$('.collection-item a, [data-collection-id], a[href*="collection"]');
if (collectionLink) {
await Promise.race([
collectionLink.click(),
- page.waitForTimeout(2000)
+ delay(2000)
]);
- await page.waitForTimeout(1000);
+ await delay(1000);
console.log('✅ Test 5 passed\n');
testsPassed++;
@@ -179,7 +182,7 @@ async function runTests() {
await authHelper.ensureAuthenticated();
await page.goto(`${BASE_URL}/library/`, { waitUntil: 'networkidle2' });
- await page.waitForTimeout(1000);
+ await delay(1000);
const pageLoaded = await page.$('body');
if (!pageLoaded) {
diff --git a/tests/ui_tests/library/test_library_documents.js b/tests/ui_tests/library/test_library_documents.js
index 142adc03bf..5e5e6181b0 100644
--- a/tests/ui_tests/library/test_library_documents.js
+++ b/tests/ui_tests/library/test_library_documents.js
@@ -10,6 +10,9 @@ const { getPuppeteerLaunchOptions } = require('../puppeteer_config');
const BASE_URL = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';
const TIMEOUT = 30000;
+// Helper function for delays (Puppeteer doesn't have waitForTimeout like Playwright)
+const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
+
describe('Library Documents UI Tests', () => {
let browser;
let page;
@@ -109,7 +112,7 @@ describe('Library Documents UI Tests', () => {
await page.keyboard.press('Enter');
// Wait for results or loading state
- await page.waitForTimeout(2000);
+ await delay(2000);
// Check for results or empty state
const pageContent = await page.content();
@@ -134,7 +137,7 @@ describe('Library Documents UI Tests', () => {
if (documentLink) {
const initialUrl = page.url();
await documentLink.click();
- await page.waitForTimeout(1000);
+ await delay(1000);
const newUrl = page.url();
// URL should change or modal should open
@@ -155,7 +158,7 @@ describe('Library Documents UI Tests', () => {
if (documentLink) {
await documentLink.click();
- await page.waitForTimeout(2000);
+ await delay(2000);
// Look for document content area
const contentArea = await page.$(