~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
feat(ci): add pip install verification to release gate with guardian tests (#3334)
LearningCircuitb93dfc1183bf
diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.ymlindex 32f5b41ad2..7b4f0514cc 100644--- a/.github/workflows/release-gate.yml+++ b/.github/workflows/release-gate.yml@@ -274,6 +274,131 @@ jobs:permissions:contents: read+ # ============================================+ # pip install verification (CRITICAL — DO NOT REMOVE OR WEAKEN)+ # ============================================+ # ┌─────────────────────────────────────────────────────────────────┐+ # │ WHY THIS TEST EXISTS AND MUST NEVER BE SKIPPED │+ # │ │+ # │ PDM uses [tool.pdm.resolution.overrides] to force specific │+ # │ dependency versions (e.g. requests>=2.33 for CVE fixes). │+ # │ These overrides LEAK into wheel metadata when `pdm build` │+ # │ runs, creating constraints that pip cannot satisfy. │+ # │ │+ # │ Example: v1.4.0 shipped with requests>=2.33 in metadata │+ # │ (from PDM override), but arxiv~=2.4 requires requests<2.33. │+ # │ pip install failed for ALL users. PDM installs worked fine │+ # │ because PDM applies overrides differently. │+ # │ │+ # │ This test catches that BEFORE publishing to PyPI. │+ # │ If this test fails, the release MUST be blocked. │+ # │ │+ # │ DO NOT: │+ # │ - Add continue-on-error to this job │+ # │ - Remove it from release-gate-summary needs │+ # │ - Replace pip install with pdm install │+ # │ - Skip dependency resolution (--no-deps) │+ # │ │+ # │ If it fails, fix the dependency conflict in pyproject.toml │+ # │ before releasing. │+ # └─────────────────────────────────────────────────────────────────┘+ pip-install-check:+ name: pip Install Verification+ runs-on: ubuntu-latest+ timeout-minutes: 15+ permissions:+ contents: read++ steps:+ - name: Harden the runner (Audit all outbound calls)+ uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0+ with:+ egress-policy: audit++ - name: Checkout code+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ persist-credentials: false++ - name: Set up Python+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0+ with:+ python-version: '3.11'++ - name: Install system dependencies for SQLCipher+ run: |+ sudo apt-get update+ sudo apt-get install -y libsqlcipher-dev++ - name: Install Node.js for Vite build+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0+ with:+ node-version: '20'++ - name: Set up PDM (build only)+ uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4.4+ with:+ python-version: '3.11'++ - name: Build Vite frontend assets+ run: |+ npm ci+ npm run build++ - name: Build wheel with PDM+ run: pdm build --no-sdist++ - name: Verify pip install in clean environment+ run: |+ # ============================================================+ # CRITICAL: This verifies the WHEEL can be installed with pip.+ #+ # PDM overrides in pyproject.toml can inject dependency+ # constraints into the wheel metadata that pip cannot resolve.+ # This catches that failure BEFORE we publish to PyPI.+ #+ # A failure here means users running `pip install local-deep-research`+ # would get a dependency resolution error.+ # ============================================================++ echo "=== Creating clean virtual environment ==="+ python -m venv /tmp/pip-verify-env+ . /tmp/pip-verify-env/bin/activate++ echo ""+ echo "=== Installing wheel with pip (NOT pdm) ==="+ echo "This simulates what end users experience with: pip install local-deep-research"+ echo ""++ WHEEL=$(find dist/ -maxdepth 1 -name '*.whl' -print -quit)+ if [ -z "$WHEEL" ]; then+ echo "::error::No wheel found in dist/"+ exit 1+ fi+ echo "Wheel: $WHEEL"+ echo ""++ # --no-cache-dir: force fresh resolution, no cached metadata+ # DO NOT add --no-deps — that defeats the entire purpose of this check+ if ! pip install --no-cache-dir "$WHEEL" 2>&1; then+ echo ""+ echo "::error::pip install FAILED — the built wheel has unresolvable dependencies."+ echo "::error::This means the PyPI release would be broken for all pip users."+ echo "::error::Check [tool.pdm.resolution.overrides] in pyproject.toml for conflicts."+ exit 1+ fi++ echo ""+ echo "=== Verifying import works ==="+ python -c "import local_deep_research; print(f'OK: v{local_deep_research.__version__}')"++ echo ""+ echo "=== Verifying dependency tree is consistent ==="+ pip check++ echo ""+ echo "✅ pip install verification passed — wheel is safe to publish"+# ============================================# Check for open code scanning alerts# This runs after all SARIF uploads complete and fails if@@ -421,6 +546,11 @@ jobs:- license-check# Backwards compatibility & migration tests- backwards-compatibility+ # CRITICAL — DO NOT REMOVE: pip install verification catches PDM override+ # leaks that break `pip install` for all users. See pip-install-check job+ # comments for the v1.4.0 incident. Removing this dependency silently+ # allows broken wheels to be published to PyPI.+ - pip-install-check# Alert check (fails if any critical/high/medium alerts exist)- check-code-scanning-alertsif: always()@@ -476,6 +606,8 @@ jobs:check_result "${{ needs.security-headers-scan.result }}" || truecheck_result "${{ needs.license-check.result }}" || truecheck_result "${{ needs.backwards-compatibility.result }}" || true+ # CRITICAL — DO NOT REMOVE: without this line, broken wheels pass the gate+ check_result "${{ needs.pip-install-check.result }}" || truecheck_result "${{ needs.check-code-scanning-alerts.result }}" || trueTOTAL=$((PASS_COUNT + FAIL_COUNT))@@ -698,6 +830,22 @@ jobs:FAILED="true"fi+ # ============================================+ # pip install verification (CRITICAL — DO NOT REMOVE)+ # Without this block, a broken wheel can pass the release gate.+ # See pip-install-check job comments for the v1.4.0 incident.+ # ============================================+ echo ""+ echo "### pip Install Verification"++ if [ "${{ needs.pip-install-check.result }}" = "success" ]; then+ echo "✅ **pip Install Check**: Passed — wheel installs cleanly with pip"+ else+ echo "❌ **pip Install Check**: ${{ needs.pip-install-check.result }} — ⚠️ WHEEL HAS BROKEN DEPENDENCIES"+ echo " > Check \`[tool.pdm.resolution.overrides]\` in pyproject.toml for conflicts that leak into wheel metadata"+ FAILED="true"+ fi+# ============================================# Code scanning alerts check# ============================================diff --git a/tests/ci/__init__.py b/tests/ci/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/tests/ci/test_release_gate_integrity.py b/tests/ci/test_release_gate_integrity.pynew file mode 100644index 0000000000..8025ed0b38--- /dev/null+++ b/tests/ci/test_release_gate_integrity.py@@ -0,0 +1,184 @@+"""+CRITICAL — DO NOT MODIFY OR DELETE THIS FILE++These tests verify that the release gate workflow contains the pip install+verification job and all its required wiring. This job prevents publishing+broken wheels to PyPI.++Background (v1.4.0 incident):+ PDM resolution overrides (pyproject.toml [tool.pdm.resolution.overrides])+ leak into wheel metadata when `pdm build` runs. This creates dependency+ constraints that pip cannot resolve, making `pip install local-deep-research`+ fail for ALL users. PDM installs work fine because PDM handles overrides+ differently, so the problem is invisible during development and CI — it+ only surfaces after publishing to PyPI, when it's too late.++ Version 1.4.0 shipped with requests>=2.33 in its metadata (from a PDM+ override for a CVE fix), but arxiv~=2.4 requires requests~=2.32.0.+ pip could not resolve this conflict. Every user who ran+ `pip install local-deep-research` got an error.++Why guardian tests:+ The pip-install-check job in release-gate.yml is the ONLY thing that+ catches this class of bug before it reaches users. If someone removes+ it (e.g. to "simplify" the workflow, reduce CI time, or fix an+ unrelated failure), the safety net disappears silently. These tests+ make that removal loud and obvious.++DO NOT:+ - Delete this file+ - Mark these tests as xfail or skip+ - Weaken the assertions (e.g. checking substring instead of exact job name)+ - Move the pip-install-check job to a non-blocking position in the workflow+"""++from pathlib import Path++import yaml+import pytest++RELEASE_GATE = (+ Path(__file__).resolve().parents[2]+ / ".github"+ / "workflows"+ / "release-gate.yml"+)++[email protected](scope="module")+def workflow():+ """Load the release-gate workflow YAML.++ CRITICAL — DO NOT MODIFY: this fixture is used by all guardian tests below.+ """+ assert RELEASE_GATE.exists(), (+ f"release-gate.yml not found at {RELEASE_GATE}. "+ "If you moved it, update the path — do NOT delete the tests."+ )+ return yaml.safe_load(RELEASE_GATE.read_text())+++class TestPipInstallCheckJobExists:+ """+ CRITICAL — DO NOT DELETE OR WEAKEN THESE TESTS.++ They verify that the pip-install-check job exists in the release gate+ and cannot be published without catching PDM override leaks.+ See module docstring for the full incident report.+ """++ def test_pip_install_check_job_is_defined(self, workflow):+ """The pip-install-check job must exist in release-gate.yml.++ CRITICAL — DO NOT REMOVE: without this job, broken wheels reach PyPI.+ """+ jobs = workflow.get("jobs", {})+ assert "pip-install-check" in jobs, (+ "CRITICAL: 'pip-install-check' job is missing from release-gate.yml! "+ "This job prevents publishing wheels with broken dependencies to PyPI. "+ "It was removed — this MUST be restored before any release. "+ "See tests/ci/test_release_gate_integrity.py docstring for background."+ )++ def test_pip_install_check_is_in_summary_needs(self, workflow):+ """The summary job must depend on pip-install-check so failures block releases.++ CRITICAL — DO NOT REMOVE from needs: removing the dependency means the+ release gate passes even when pip install fails.+ """+ summary_job = workflow.get("jobs", {}).get("release-gate-summary", {})+ needs = summary_job.get("needs", [])+ assert "pip-install-check" in needs, (+ "CRITICAL: 'pip-install-check' is missing from release-gate-summary.needs! "+ "The release gate will pass even if pip install fails. "+ "Add it back to the needs list."+ )++ def test_pip_install_check_has_no_continue_on_error(self, workflow):+ """The pip-install-check job must NOT have continue-on-error.++ CRITICAL — DO NOT ADD continue-on-error: it would make pip install+ failures non-blocking, allowing broken wheels to be published.+ """+ job = workflow.get("jobs", {}).get("pip-install-check", {})+ assert job.get("continue-on-error") is not True, (+ "CRITICAL: pip-install-check has continue-on-error: true! "+ "This makes dependency failures non-blocking — broken wheels "+ "will be published to PyPI. Remove continue-on-error."+ )++ def test_pip_install_check_uses_pip_not_pdm(self, workflow):+ """The verification step must use pip, not pdm.++ CRITICAL — DO NOT CHANGE to pdm install: PDM resolves overrides+ differently and will NOT catch the dependency conflicts that break+ pip users. The whole point is to test what pip users experience.+ """+ job = workflow.get("jobs", {}).get("pip-install-check", {})+ steps = job.get("steps", [])++ # Find the verification step+ verify_step = None+ for step in steps:+ run = step.get("run", "")+ if "pip install" in run and "no-cache-dir" in run:+ verify_step = step+ break++ assert verify_step is not None, (+ "CRITICAL: Cannot find the pip install verification step in pip-install-check! "+ "The step must run 'pip install --no-cache-dir' on the built wheel."+ )++ # Make sure it doesn't use pdm install+ run_content = verify_step.get("run", "")+ assert "pdm install" not in run_content, (+ "CRITICAL: Verification step uses 'pdm install' instead of 'pip install'! "+ "PDM handles overrides differently and won't catch dependency conflicts. "+ "Use 'pip install' to simulate what end users experience."+ )++ def test_pip_install_check_does_not_use_no_deps(self, workflow):+ """The pip install must NOT use --no-deps.++ CRITICAL — DO NOT ADD --no-deps: it skips dependency resolution+ entirely, which is the exact thing we're trying to verify.+ """+ job = workflow.get("jobs", {}).get("pip-install-check", {})+ steps = job.get("steps", [])++ for step in steps:+ run = step.get("run", "")+ if "pip install" in run and ".whl" in run:+ # Check actual pip install commands, not comments+ for line in run.splitlines():+ stripped = line.strip()+ if stripped.startswith("#"):+ continue+ if "pip install" in stripped and "--no-deps" in stripped:+ raise AssertionError(+ "CRITICAL: pip install command uses --no-deps! "+ "This skips dependency resolution — the exact check we need. "+ "Remove --no-deps."+ )++ def test_pip_install_check_runs_pip_check(self, workflow):+ """The verification must run `pip check` to catch inconsistencies.++ CRITICAL — DO NOT REMOVE: pip check catches dependency version+ mismatches that pip install might not flag during resolution.+ """+ job = workflow.get("jobs", {}).get("pip-install-check", {})+ steps = job.get("steps", [])++ has_pip_check = False+ for step in steps:+ if "pip check" in step.get("run", ""):+ has_pip_check = True+ break++ assert has_pip_check, (+ "CRITICAL: pip-install-check job does not run 'pip check'! "+ "This catches dependency inconsistencies after installation. "+ "Add 'pip check' to the verification step."+ )