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(ci): honour fast SQLCipher KDF in test servers via LDR_TEST_MODE (#4558)

LearningCircuit1d55ef768483
diff --git a/.github/workflows/docker-multiarch-test.yml b/.github/workflows/docker-multiarch-test.yml
index 32962585d1..dbf45d9211 100644
--- a/.github/workflows/docker-multiarch-test.yml
+++ b/.github/workflows/docker-multiarch-test.yml
@@ -83,6 +83,7 @@ jobs:
--platform ${{ matrix.platform }} \
-p 5000:5000 \
-e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
-e LDR_NEWS_SCHEDULER_ENABLED=false \
ldr-test:${{ matrix.platform_slug }}-${{ github.sha }}
diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml
index 2878e80292..8cee4d2b02 100644
--- a/.github/workflows/docker-tests.yml
+++ b/.github/workflows/docker-tests.yml
@@ -659,7 +659,8 @@ jobs:
-v "${GITHUB_WORKSPACE}/ci-data":/data \
-e TEST_ENV=true \
-e LDR_DATA_DIR=/data \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
-w /app/src \
"${TEST_IMAGE}" \
python ../scripts/ci/init_test_database.py
@@ -676,7 +677,8 @@ jobs:
-e LDR_DISABLE_RATE_LIMITING=true \
-e SECRET_KEY=test-secret-key-for-ci \
-e LDR_DATA_DIR=/data \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
"${TEST_IMAGE}" ldr-web
# --max-time bounds total request time; --connect-timeout bounds
@@ -709,7 +711,8 @@ jobs:
docker run --rm \
-v "${GITHUB_WORKSPACE}":/app \
-e CI=true \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
--network host \
-w /app/tests/ui_tests \
"${TEST_IMAGE}" \
@@ -721,7 +724,8 @@ jobs:
-v "${GITHUB_WORKSPACE}":/app \
-e CI=true \
-e PUPPETEER_HEADLESS=true \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
--network host \
-w /app/tests/ui_tests \
"${TEST_IMAGE}" \
@@ -838,7 +842,8 @@ jobs:
-v "$PWD/ci-data":/data \
-e TEST_ENV=true \
-e LDR_DATA_DIR=/data \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
-w /app/src \
${{ env.TEST_IMAGE }} \
python ../scripts/ci/init_test_database.py
@@ -855,7 +860,8 @@ jobs:
-e LDR_DISABLE_RATE_LIMITING=true \
-e SECRET_KEY=test-secret-key-for-ci \
-e LDR_DATA_DIR=/data \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
${{ env.TEST_IMAGE }} ldr-web
# Wait for server to be ready.
@@ -889,7 +895,8 @@ jobs:
docker run --rm \
-v "$PWD":/app \
-e CI=true \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
-e NODE_PATH=/install/tests/ui_tests/node_modules \
--network host \
-w /app/tests/ui_tests \
@@ -903,7 +910,8 @@ jobs:
-v "$PWD":/app \
-e CI=true \
-e BASE_URL=http://localhost:5000 \
- -e LDR_DB_KDF_ITERATIONS=1000 \
+ -e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \
+ -e LDR_TEST_MODE=1 \
--network host \
-w /app \
${{ env.TEST_IMAGE }} \
diff --git a/.github/workflows/nuclei.yml b/.github/workflows/nuclei.yml
index 65dc0d4859..823021aa72 100644
--- a/.github/workflows/nuclei.yml
+++ b/.github/workflows/nuclei.yml
@@ -31,7 +31,11 @@ jobs:
TEST_ENV: true
FLASK_ENV: testing
LDR_DATA_DIR: ${{ github.workspace }}/data
- LDR_DB_KDF_ITERATIONS: "1000"
+ LDR_DB_CONFIG_KDF_ITERATIONS: "1000"
+ # Honour the fast test KDF: without LDR_TEST_MODE the value is clamped
+ # to the production minimum (256000), making every SQLCipher open/backup
+ # ~256x slower — see #4430 and tests/shared/chrome_profile.js context.
+ LDR_TEST_MODE: "1"
LDR_DISABLE_RATE_LIMITING: "true"
SECRET_KEY: test-secret-key-for-ci
TEST_USERNAME: test_admin
diff --git a/.github/workflows/owasp-zap-scan.yml b/.github/workflows/owasp-zap-scan.yml
index ec750772d9..c62ecab897 100644
--- a/.github/workflows/owasp-zap-scan.yml
+++ b/.github/workflows/owasp-zap-scan.yml
@@ -51,7 +51,10 @@ jobs:
- name: Start LDR server for testing
run: |
export CI=true
- export LDR_DB_KDF_ITERATIONS=1000
+ export LDR_DB_CONFIG_KDF_ITERATIONS=1000
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ export LDR_TEST_MODE=1
export PYTHONPATH=$PWD/src:$PYTHONPATH
pdm run python -m local_deep_research.web.app > server.log 2>&1 &
SERVER_PID=$!
@@ -145,7 +148,10 @@ jobs:
- name: Start LDR server for testing
run: |
export CI=true
- export LDR_DB_KDF_ITERATIONS=1000
+ export LDR_DB_CONFIG_KDF_ITERATIONS=1000
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ export LDR_TEST_MODE=1
export PYTHONPATH=$PWD/src:$PYTHONPATH
pdm run python -m local_deep_research.web.app > server.log 2>&1 &
SERVER_PID=$!
diff --git a/.github/workflows/playwright-webkit-tests.yml b/.github/workflows/playwright-webkit-tests.yml
index eef5faa111..fde6274bba 100644
--- a/.github/workflows/playwright-webkit-tests.yml
+++ b/.github/workflows/playwright-webkit-tests.yml
@@ -115,7 +115,10 @@ jobs:
env:
TEST_ENV: true
LDR_DATA_DIR: ${{ github.workspace }}/data
- LDR_DB_KDF_ITERATIONS: "1000"
+ LDR_DB_CONFIG_KDF_ITERATIONS: "1000"
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ LDR_TEST_MODE: "1"
run: |
export PYTHONPATH="$PWD/src:$PYTHONPATH"
pdm run python scripts/ci/init_test_database.py
@@ -271,7 +274,10 @@ jobs:
env:
TEST_ENV: true
LDR_DATA_DIR: ${{ github.workspace }}/data
- LDR_DB_KDF_ITERATIONS: "1000"
+ LDR_DB_CONFIG_KDF_ITERATIONS: "1000"
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ LDR_TEST_MODE: "1"
run: |
export PYTHONPATH="$PWD/src:$PYTHONPATH"
pdm run python scripts/ci/init_test_database.py
diff --git a/.github/workflows/puppeteer-e2e-tests.yml b/.github/workflows/puppeteer-e2e-tests.yml
index 575cd7712a..db2f6d012e 100644
--- a/.github/workflows/puppeteer-e2e-tests.yml
+++ b/.github/workflows/puppeteer-e2e-tests.yml
@@ -103,7 +103,10 @@ jobs:
env:
TEST_ENV: true
LDR_DATA_DIR: ${{ github.workspace }}/data
- LDR_DB_KDF_ITERATIONS: "1000"
+ LDR_DB_CONFIG_KDF_ITERATIONS: "1000"
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ LDR_TEST_MODE: "1"
run: |
cd src
pdm run python ../scripts/ci/init_test_database.py
@@ -144,7 +147,10 @@ jobs:
LDR_SEARCH_ENGINE_WEB_SERPER_API_KEY: ${{ secrets.SERPER_API_KEY }}
# Database and server settings
LDR_DATA_DIR: ${{ github.workspace }}/data
- LDR_DB_KDF_ITERATIONS: "1000"
+ LDR_DB_CONFIG_KDF_ITERATIONS: "1000"
+ # Without LDR_TEST_MODE the 1000 is clamped to the production
+ # minimum (256000), making SQLCipher ~256x slower — see #4430.
+ LDR_TEST_MODE: "1"
CI: true
LDR_DISABLE_RATE_LIMITING: true
run: |
diff --git a/changelog.d/+ci-kdf-test-mode.misc.md b/changelog.d/+ci-kdf-test-mode.misc.md
new file mode 100644
index 0000000000..c0eec3ebad
--- /dev/null
+++ b/changelog.d/+ci-kdf-test-mode.misc.md
@@ -0,0 +1 @@
+CI: set ``LDR_TEST_MODE=1`` on every test/scan workflow that starts a server or initialises the test database, so the intended fast SQLCipher KDF (``LDR_DB_CONFIG_KDF_ITERATIONS=1000``) is actually honoured. ``_get_min_kdf_iterations()`` deliberately ignores generic ``CI``/``TEST_ENV`` and only relaxes for ``PYTEST_CURRENT_TEST``/``LDR_TEST_MODE``; without the latter the requested 1000 was silently clamped to the production minimum (256000), making every DB open and the post-login background backup ~256× slower. Under contended CI runners that turned the backup into a multi-minute, GIL-holding stall that timed out release-gate UI shards (chat/settings navigations) — the failures seen on clean ``main`` while investigating #4430. Also renames the deprecated ``LDR_DB_KDF_ITERATIONS`` env var to its canonical ``LDR_DB_CONFIG_KDF_ITERATIONS`` across all six workflows (docker-tests, nuclei, owasp-zap-scan, playwright-webkit-tests, puppeteer-e2e-tests, docker-multiarch-test).