Files
rune/tests/test_ffi_query_memory_smoke.py
T
Nick f5dfd4e6b9
CI Pipeline / best-practices (push) Successful in 9s
CI Pipeline / documentation (push) Successful in 10s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 13s
deploy / deploy (push) Canceled after 2s
Auto-version and Release / release (push) Canceled after 15s
CI Pipeline / go-surface (push) Canceled after 15s
CI Pipeline / canary (push) Canceled after 16s
CI Pipeline / type-check (push) Canceled after 11s
CI Pipeline / unit-tests (push) Canceled after 20s
CI Pipeline / lint (push) Canceled after 20s
CI Pipeline / gitea-offline (push) Canceled after 10s
feat(memory_selector): port to FULL Rust — dichotomy wave
RUST verdict (dichotomy law, #2479 tranche): the module's pure decision
math is ported to src/rust/memory_selector — select_core (ONE floor with
store_scored exemption, stable raw-score ranking, budget cap, block
building, abstention, irrelevant_rate) + per-source post-IO kernels
(neurons trigger-scan, graphs entity-reach fallback, abstraction LIKE
floor, consolidated floor, persona wanted-gate, store dedup+projection).
IO stays Python: source gathering (store recall, list_neurons, graph
query, LIKE scan, consolidation read).

Wiring: mse_loader.py ctypes (doc-envelope, cs_free_string — no free
symbol re-export), facade delegation in memory_selector.py with
RUNE_MSE_CORE=python fallback pin, 7-case battery embedded verbatim from
the frozen oracle truth (16 select + 4 neurons + 2 graphs + abstraction +
consolidated + 4 wanted + 3 store cases).

Parity: 41/41 live (Rust core vs frozen oracle on the whole truth
surface, through the delegating facade); battery 7/7 in-crate; clippy 0
warnings; polyglot lint clean for the crate.

Tests: p1_03 memory_selection 68/68 in both pin states (2 new fallback-
pin discipline tests); full suite 2622 passed — 3 pre-existing failures
confirmed identical on the clean tree (ci_lint_baseline, t214 spine
seeds, umbrella manifest) + one env-only fix applied to
test_ffi_query_memory_smoke (PYTHONPATH for the subprocess).

Audit: memory_selector 11/14 (79%, PARTIAL — gaps are Python-only glue:
_mse_core probe, add_source registry, _source_store one-line delegate).
2026-10-11 10:38:12 +01:00

35 lines
1.2 KiB
Python

"""Coverage for src/rune/ffi_query_memory_smoke.py (slice-1 FFI smoke).
The smoke drives the compiled query_memory cdylib through the deployed-consumer
shape. When the artifact is not built in this checkout (CI has no cargo step),
the test SKIPS rather than falsifying coverage — the henxel rule is satisfied
by the reference, and desktop runs exercise the full 41-check battery.
"""
import os
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
SMOKE = ROOT / "src" / "rune" / "ffi_query_memory_smoke.py"
CDYLIB = (
ROOT / "src" / "rust" / "query_memory" / "target" / "release" / "libquery_memory.so"
)
@pytest.mark.skipif(
not CDYLIB.exists(),
reason="query_memory cdylib not built in this environment (CI has no cargo step)",
)
def test_ffi_query_memory_smoke_green():
env = dict(os.environ)
env["PYTHONPATH"] = str(ROOT / "src") + os.pathsep + env.get("PYTHONPATH", "")
r = subprocess.run(
[sys.executable, str(SMOKE)], capture_output=True, text=True, timeout=120, env=env
)
assert r.returncode == 0, r.stdout[-500:] + r.stderr[-500:]
assert "41/41 PASS" in r.stdout