Phase 3 — vault exact recall index: - Replace O(N) np.array_equal scan with hash-based exact-match index - Add optional max_entries with deterministic FIFO eviction - Index rebuilds on reproject for consistency Phase 4 — Rust versor_apply parity: - Fix CGA metric signature (+,+,+,+,-) and blade ordering to match Python - Implement versor_apply_closed with null-vector preservation, f64 unitize, and construction seed fallback matching Python closure semantics - Gate Rust dispatch behind CORE_BACKEND=rust; Python remains default - Add f64 geometric product for closure-path precision Phase 5 — cognitive quality pack expansion: - Expand lexicon from 55 to 70 entries (evidence, inference, procedure, verification, distinction, relation, thought, understanding, judgment, principle, order, connectives) - Improve semantic templates for cause, procedure, comparison, recall, verification intents - Expand eval cases from 20 to 45 across all categories Validation: 491 tests pass, 45 eval cases at 100% all metrics.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""Language-pack cache isolation tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from language_packs.compiler import load_mounted_packs, load_pack, load_pack_entries
|
|
|
|
|
|
def test_load_pack_returns_defensive_manifold_copies() -> None:
|
|
_manifest_a, manifold_a = load_pack("en_core_cognition_v1")
|
|
_manifest_b, manifold_b = load_pack("en_core_cognition_v1")
|
|
|
|
original_len = len(manifold_b)
|
|
manifold_a.insert_transient("cache_probe_token", manifold_a.get_versor("truth"))
|
|
|
|
assert len(manifold_a) == original_len + 1
|
|
assert len(manifold_b) == original_len
|
|
assert not manifold_b.is_transient("cache_probe_token")
|
|
|
|
|
|
def test_load_mounted_packs_returns_defensive_manifold_copies() -> None:
|
|
packs = ("en_minimal_v1", "en_core_cognition_v1")
|
|
mounted_a = load_mounted_packs(packs)
|
|
mounted_b = load_mounted_packs(packs)
|
|
|
|
original_len = len(mounted_b)
|
|
mounted_a.insert_transient("mounted_cache_probe_token", mounted_a.get_versor("truth"))
|
|
|
|
assert len(mounted_a) == original_len + 1
|
|
assert len(mounted_b) == original_len
|
|
assert not mounted_b.is_transient("mounted_cache_probe_token")
|
|
|
|
|
|
def test_load_pack_entries_returns_new_list_from_cached_tuple() -> None:
|
|
entries_a = load_pack_entries("en_core_cognition_v1")
|
|
entries_b = load_pack_entries("en_core_cognition_v1")
|
|
|
|
entries_a.pop()
|
|
|
|
assert len(entries_a) == len(entries_b) - 1
|
|
assert entries_b[-1].entry_id == "en-core-cog-070"
|