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): require journal release probes to execute (#6957)

LearningCircuit8ef094ecfaf3
diff --git a/.github/workflows/journal-data-integration.yml b/.github/workflows/journal-data-integration.yml
index 293161e9c0..bbacd81c26 100644
--- a/.github/workflows/journal-data-integration.yml
+++ b/.github/workflows/journal-data-integration.yml
@@ -6,8 +6,8 @@ name: Journal Quality Data Integration
# field, DOAJ changing their dump format, etc.) BEFORE we cut a release.
#
# This is intentionally a separate workflow rather than a job inside the
-# main test suite — it pulls ~25 MB from third-party APIs and takes
-# ~30–60 seconds, so it shouldn't run on every PR. It runs:
+# main test suite — it downloads public reference data from third-party
+# services and can take several minutes, so it shouldn't run on every PR. It runs:
# - Weekly (Mondays 4 AM UTC) — catches drift between releases
# - On the release-gate workflow_call — blocks publishing if upstreams
# have broken our build
@@ -34,6 +34,8 @@ jobs:
timeout-minutes: 45
permissions:
contents: read
+ env:
+ LDR_TESTING_WITH_MOCKS: 'false'
steps:
- name: Harden the runner (Audit all outbound calls)
@@ -49,7 +51,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
- python-version: '3.11'
+ python-version: '3.14'
- name: Install system dependencies for SQLCipher
run: |
@@ -59,21 +61,72 @@ jobs:
- name: Set up PDM
uses: pdm-project/setup-pdm@544d7237314ee09c256785bd360f6b30add38b37 # v4.6
with:
- python-version: '3.11'
+ python-version: '3.14'
- name: Install dependencies
run: pdm install --dev
- name: Run journal-quality release-gate integration test
+ id: tests
# The test is marked `integration and slow` so it's skipped by
# the regular suite. We opt in here. The session fixture
# downloads all 5 sources in PARALLEL via ThreadPoolExecutor;
# wall-clock is bounded by the slowest source (institutions,
# ~10 min). Per-test pytest-timeout=2400s (40 min) overrides
# the global 60s default for these slow tests.
+ shell: bash
run: |
+ mkdir -p test-results
pdm run pytest tests/integration/test_journal_quality_release_gate.py \
-m "integration and slow" \
- -v --tb=short \
- --timeout=2400
+ -v -ra --tb=short -p no:cov \
+ --timeout=2400 \
+ --junitxml=test-results/journal-quality.xml \
+ 2>&1 | tee test-results/journal-quality.log
timeout-minutes: 42
+
+ - name: Require all journal-quality probes to pass
+ id: validate-results
+ if: always()
+ shell: bash
+ run: |
+ python - <<'PYTHON'
+ from pathlib import Path
+ from xml.etree import ElementTree
+
+ report = Path("test-results/journal-quality.xml")
+ if not report.is_file():
+ raise SystemExit("Missing journal-quality test report")
+ required = {
+ "test_openalex_sources",
+ "test_doaj_journals",
+ "test_predatory_list",
+ "test_jabref_abbreviations",
+ "test_openalex_institutions",
+ "test_build_journal_quality_db",
+ "test_runtime_accessor_can_score_real_journal",
+ "test_dashboard_queries_against_real_db",
+ }
+ cases = list(ElementTree.parse(report).getroot().iter("testcase"))
+ missing = required - {case.get("name") for case in cases}
+ unsuccessful = [
+ case.get("name", "unknown")
+ for case in cases
+ if any(child.tag in {"skipped", "failure", "error"} for child in case)
+ ]
+ if missing or unsuccessful:
+ raise SystemExit(
+ f"Journal-quality probes missing: {sorted(missing)}; "
+ f"unsuccessful: {unsuccessful}"
+ )
+ print(f"All {len(cases)} journal-quality tests executed and passed")
+ PYTHON
+
+ - name: Upload journal-quality diagnostics
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: journal-quality-results
+ path: test-results/journal-quality.*
+ if-no-files-found: error
+ retention-days: 14
diff --git a/tests/ci/test_journal_data_release_gate.py b/tests/ci/test_journal_data_release_gate.py
new file mode 100644
index 0000000000..c063500448
--- /dev/null
+++ b/tests/ci/test_journal_data_release_gate.py
@@ -0,0 +1,149 @@
+"""The journal-data release gate must run its probes instead of skipping them."""
+
+# allow: no-sut-import — exercises the actual workflow and its JUnit validator.
+
+import os
+from pathlib import Path
+import subprocess
+import sys
+from xml.etree import ElementTree
+
+import pytest
+import yaml
+
+
+ROOT = Path(__file__).resolve().parents[2]
+WORKFLOW = ROOT / ".github/workflows/journal-data-integration.yml"
+REQUIRED = {
+ "test_openalex_sources",
+ "test_doaj_journals",
+ "test_predatory_list",
+ "test_jabref_abbreviations",
+ "test_openalex_institutions",
+ "test_build_journal_quality_db",
+ "test_runtime_accessor_can_score_real_journal",
+ "test_dashboard_queries_against_real_db",
+}
+
+
[email protected](scope="module")
+def job():
+ return yaml.safe_load(WORKFLOW.read_text())["jobs"]["download-and-build"]
+
+
+def _steps(job):
+ return {s["id"]: s for s in job["steps"] if "id" in s}
+
+
+def _run(script, directory, *, extra_env=None):
+ return subprocess.run(
+ ["bash", "-e", "-o", "pipefail", "-c", script],
+ cwd=directory,
+ env={
+ **os.environ,
+ "PATH": f"{Path(sys.executable).parent}:{os.environ.get('PATH', '')}",
+ **(extra_env or {}),
+ },
+ capture_output=True,
+ text=True,
+ timeout=20,
+ check=False,
+ )
+
+
+def test_real_integration_mode_and_supported_python_are_explicit(job):
+ assert job["env"]["LDR_TESTING_WITH_MOCKS"] == "false"
+ assert "if" not in job and not job.get("continue-on-error")
+ versions = [
+ s["with"]["python-version"]
+ for s in job["steps"]
+ if "python-version" in s.get("with", {})
+ ]
+ assert versions == ["3.14", "3.14"]
+ steps = _steps(job)
+ tests = steps["tests"]
+ assert tests["shell"] == "bash"
+ assert "if" not in tests and not tests.get("continue-on-error")
+ assert (
+ "tests/integration/test_journal_quality_release_gate.py" in tests["run"]
+ )
+ assert "--junitxml=test-results/journal-quality.xml" in tests["run"]
+ assert steps["validate-results"]["if"] == "always()"
+ assert not steps["validate-results"].get("continue-on-error")
+ upload = next(
+ s
+ for s in job["steps"]
+ if s.get("uses", "").startswith("actions/upload-artifact@")
+ )
+ assert upload["if"] == "always()"
+ assert upload["with"]["path"] == "test-results/journal-quality.*"
+
+
+ "outcome",
+ [
+ "passed",
+ "all-skipped",
+ "one-skipped",
+ "failure",
+ "error",
+ "missing-case",
+ "empty",
+ "missing-report",
+ "malformed",
+ ],
+)
+def test_actual_validator_requires_every_probe_to_pass(job, tmp_path, outcome):
+ report = tmp_path / "test-results/journal-quality.xml"
+ if outcome != "missing-report":
+ report.parent.mkdir()
+ if outcome == "malformed":
+ report.write_text("<testsuites>")
+ else:
+ suite = ElementTree.Element("testsuite")
+ names = sorted(REQUIRED)
+ if outcome == "missing-case":
+ names = names[:-1]
+ elif outcome == "empty":
+ names = []
+ for i, name in enumerate(names):
+ case = ElementTree.SubElement(suite, "testcase", name=name)
+ if outcome == "all-skipped" or (
+ outcome == "one-skipped" and i == 0
+ ):
+ ElementTree.SubElement(case, "skipped")
+ elif outcome in {"failure", "error"} and i == 0:
+ ElementTree.SubElement(case, outcome)
+ ElementTree.ElementTree(suite).write(report)
+ result = _run(_steps(job)["validate-results"]["run"], tmp_path)
+ assert (result.returncode == 0) is (outcome == "passed"), (
+ result.stdout + result.stderr
+ )
+
+
[email protected]("pytest_status", [0, 1, 5])
+def test_pytest_failure_cannot_be_hidden_by_diagnostic_tee(
+ job, tmp_path, pytest_status
+):
+ binary = tmp_path / "bin"
+ binary.mkdir()
+ pdm = binary / "pdm"
+ pdm.write_text(f"#!/bin/sh\nexit {pytest_status}\n")
+ pdm.chmod(0o755)
+ result = _run(
+ _steps(job)["tests"]["run"],
+ tmp_path,
+ extra_env={"PATH": f"{binary}:{os.environ.get('PATH', '')}"},
+ )
+ assert result.returncode == pytest_status, result.stdout + result.stderr
+
+
+def test_release_gate_keeps_journal_validation_required():
+ workflow = yaml.safe_load(
+ (ROOT / ".github/workflows/release-gate.yml").read_text()
+ )
+ jobs = workflow["jobs"]
+ journal = jobs["journal-data-integration"]
+ assert journal["uses"] == "$/.github/workflows/journal-data-integration.yml"
+ assert "if" not in journal and not journal.get("continue-on-error")
+ assert "journal-data-integration" in jobs["release-gate-summary"]["needs"]
diff --git a/tests/integration/test_journal_quality_release_gate.py b/tests/integration/test_journal_quality_release_gate.py
index f1629ecc20..da41d8a7b8 100644
--- a/tests/integration/test_journal_quality_release_gate.py
+++ b/tests/integration/test_journal_quality_release_gate.py
@@ -224,11 +224,14 @@ def test_doaj_journals(downloaded_data_dir: Path):
f = downloaded_data_dir / "doaj_journals.json"
assert f.exists()
- data = json.loads(f.read_text())
- assert isinstance(data, dict)
- assert len(data) >= MIN_DOAJ_JOURNALS
-
- sample = next(iter(data.values()))
+ payload = json.loads(f.read_text())
+ # The writer and db.py::_load_doaj exchange a wrapped mapping.
+ journals = payload["journals"]
+ assert isinstance(journals, dict)
+ assert len(journals) >= MIN_DOAJ_JOURNALS
+ assert len(journals) == meta["counts"]["doaj"]
+
+ sample = next(iter(journals.values()))
# Field names consumed by the DOAJ pass in db.py::_populate_sources.
assert "name" in sample
assert "publisher" in sample
@@ -262,8 +265,14 @@ def test_jabref_abbreviations(downloaded_data_dir: Path):
f = downloaded_data_dir / "jabref_abbreviations.json.gz"
assert f.exists()
with gzip.open(f, "rt", encoding="utf-8") as fh:
- data = json.load(fh)
- assert len(data) >= MIN_ABBREVIATIONS
+ payload = json.load(fh)
+ mappings = payload["abbrev_to_full"]
+ assert isinstance(mappings, dict)
+ assert len(mappings) >= MIN_ABBREVIATIONS
+ assert len(mappings) == meta["counts"]["jabref"]
+ abbreviation, full_name = next(iter(mappings.items()))
+ assert isinstance(abbreviation, str) and abbreviation
+ assert isinstance(full_name, str) and full_name
def test_openalex_institutions(downloaded_data_dir: Path):