Some checks failed
Secret scan / gitleaks (push) Failing after 8s
Mirror source to Forgejo / mirror (push) Has been skipped
Release Candidate / Validate promotion and preview release (push) Has been cancelled
Tests / Static Analysis (push) Has been cancelled
Tests / Warm Conan & ccache (linux-arm64) (push) Has been cancelled
Tests / Warm Conan & ccache (macos-arm64) (push) Has been cancelled
Tests / Warm Conan & ccache (linux-x86_64) (push) Has been cancelled
Tests / Warm Conan & ccache (macos-x86_64) (push) Has been cancelled
Tests / Warm Conan & ccache (windows-x86_64) (push) Has been cancelled
Tests / warm (push) Has been cancelled
Tests / Tests (linux-arm64) (push) Has been cancelled
Tests / Tests (macos-arm64) (push) Has been cancelled
Tests / Tests (linux-x86_64-asan) (push) Has been cancelled
Tests / Tests (linux-x86_64-ubsan) (push) Has been cancelled
Tests / Tests (linux-x86_64) (push) Has been cancelled
Tests / Tests (windows-x86_64) (push) Has been cancelled
* test(ci): stabilize main matrix (#112) Signed-off-by: trvon <me@trevon.dev> * ci(release): preview experimental promotion (#111) Signed-off-by: trvon <me@trevon.dev> * ci(release): reconcile draft promotion safely (#113) * ci(release): reconcile draft promotion Create promotion visibility independently of release readiness. Leave existing PRs untouched to preserve concurrent maintainer edits. Validate against current main without masking candidate rejection. Signed-off-by: trvon <me@trevon.dev> * ci: isolate hook Git environments Prevent temporary Git fixtures from modifying the calling worktree. Clear repository-local hook variables before the unchanged build gates, and isolate validator and fixture Git subprocesses from caller overrides. Exercise linked-worktree config, ref and index preservation offline. Signed-off-by: trvon <me@trevon.dev> --------- Signed-off-by: trvon <me@trevon.dev> * fix(ci): reject invalid candidate evidence Explain missing main history without mutating refs or weakening promotion validation. Match experiment boolean and aggregation parsing, respect candidate-limit precedence, and return issues for malformed configuration or metric values. Signed-off-by: trvon <me@trevon.dev> * fix: preserve completion and retrieval contracts Propagate derivation SQL failures, invalidate KG status caches, and avoid unused preview reads. Align explicit hash validation and export standalone client dependencies. Keep secret exceptions fixture-scoped and remove undefined behavior from status fixtures. Signed-off-by: trvon <me@trevon.dev> * fix: fence asynchronous enrichment completion Coordinate graph and NL commits before acknowledging enrichment. Atomically classify embedding reuse, fence repair status writes, and preserve newer vectors on old failures. Upgrade content readiness triggers and keep repository counters coherent. Six affected ASan suites pass; this does not provide restart replay or generation-scoped vector storage. Signed-off-by: trvon <me@trevon.dev> * fix: bound semantic graph output reservation Use retained neighbors for admission and node capacity instead of mixing corpus and pair counts. Preserve single-neighbor output and avoid quadratic reservation. Characterization regression fails three assertions before the fix; full component ASan suite passes afterward. Signed-off-by: trvon <me@trevon.dev> * fix: fence standalone embedding repair completion Mint attempt tokens before reading canonical repair input and publish only current persisted document embeddings. Do not skip stale physical vectors. Make SQLite preparation fault injection connection-local and deterministic. Full component and metadata ASan suites pass. Signed-off-by: trvon <me@trevon.dev> * fix: preserve enrichment failure reporting Admit pending embedding attempts before provider failures while preserving completed results. Route title no-op acknowledgement through the writer so flush reports SQL failures and duplicate jobs can retry. Four affected full ASan suites pass; host configuration hashes unchanged. Signed-off-by: trvon <me@trevon.dev> * test: align explicit hash prefix boundaries Reject five characters and accept the supported six-character minimum. Full hybrid_search suite passes. Separate daemon shutdown sanitizer failure remains under investigation despite a passing targeted rerun. Signed-off-by: trvon <me@trevon.dev> * test: align UI hash validation boundary Signed-off-by: trvon <me@trevon.dev> --------- Signed-off-by: trvon <me@trevon.dev>
87 lines
4.4 KiB
Python
87 lines
4.4 KiB
Python
"""Preflight checks for retrieval experiments; shared with optional local xplan."""
|
|
|
|
from collections.abc import Mapping
|
|
from typing import Any
|
|
import math
|
|
|
|
|
|
def _enabled(value: Any, default: bool) -> bool:
|
|
normalized = str(value).lower()
|
|
if normalized in {"1", "true", "yes", "on"}:
|
|
return True
|
|
if normalized in {"0", "false", "no", "off"}:
|
|
return False
|
|
return default
|
|
|
|
|
|
def _positive_integer(value: Any) -> int:
|
|
number = int(value)
|
|
if isinstance(value, bool) or number <= 0 or (isinstance(value, float) and number != value):
|
|
raise ValueError("expected a positive integer")
|
|
return number
|
|
|
|
|
|
def _finite_number(value: Any) -> float:
|
|
try:
|
|
return float(value) if not isinstance(value, bool) else math.nan
|
|
except (ValueError, TypeError, OverflowError):
|
|
return math.nan
|
|
|
|
|
|
def validate_retrieval_configuration(
|
|
env: Mapping[str, str], params: Mapping[str, Any], factors: Mapping[str, Any]
|
|
) -> list[str]:
|
|
"""Reject comparisons whose declared treatment cannot match effective execution.
|
|
|
|
PHSS is a rerank pool, not an HNSW traversal-work bound. The computed raw k
|
|
is a lower bound: weak-query fanout can increase it further at runtime.
|
|
"""
|
|
issues: list[str] = []
|
|
if "ann_candidate_budget" in factors and _enabled(env.get("YAMS_VECTOR_VEC0_PHSS_ENABLED"), False):
|
|
try:
|
|
# Runtime scales defaults first, then applies individual result overrides.
|
|
if "YAMS_VECTOR_MAX_RESULTS" in env:
|
|
document_limit = _positive_integer(env["YAMS_VECTOR_MAX_RESULTS"])
|
|
else:
|
|
scale = float(env.get("YAMS_CANDIDATE_MULTIPLIER", "1"))
|
|
document_limit = _positive_integer(int(150 * scale))
|
|
aggregation = env.get("YAMS_SEARCH_CHUNK_AGGREGATION", "weighted_top_k_avg")
|
|
# The C++ compatibility parser accepts MAX/max, not arbitrary mixed case.
|
|
multiplier = 1 if aggregation in {"max", "MAX"} else 3
|
|
raw_limit = document_limit * multiplier
|
|
configured = _positive_integer(env.get("YAMS_VECTOR_VEC0_PHSS_CANDIDATES", "64"))
|
|
effective = max(raw_limit, configured)
|
|
if _positive_integer(factors["ann_candidate_budget"]) != effective:
|
|
issues.append(f"declared PHSS pool differs from effective minimum {effective} "
|
|
f"(raw chunk k={raw_limit}); use distinct effective budgets")
|
|
except (ValueError, TypeError, OverflowError):
|
|
issues.append("invalid PHSS budget configuration; expected finite positive numeric values")
|
|
|
|
if params.get("require_narrowing"):
|
|
engine = params.get("vector_search_engine", env.get("YAMS_VECTOR_SEARCH_ENGINE", ""))
|
|
if engine not in {"simeon_pq_adc", "simeon_pq"}:
|
|
issues.append("fast narrowing requires simeon_pq_adc with observed work counters")
|
|
# Artifact loading and held-out calibration generation are not implemented.
|
|
# Do not accept a filename as evidence that the worker consumed calibration.
|
|
issues.append("certified narrowing plans are parked until held-out, policy-bound "
|
|
"calibration generation and worker artifact loading are implemented; "
|
|
"hardcoded observation counts are not calibration")
|
|
|
|
if params.get("latency_mode") == "product" and _enabled(env.get("YAMS_SEARCH_STAGE_TRACE"), True):
|
|
issues.append("product latency cannot include stage-trace counterfactual work")
|
|
return issues
|
|
|
|
|
|
def validate_retrieval_metrics(metrics: Mapping[str, Any], params: Mapping[str, Any]) -> list[str]:
|
|
"""Require evidence that an advertised mechanism actually executed."""
|
|
if params.get("require_shadow_evaluation"):
|
|
for key in ("topology_shadow_evaluation_rate", "topology_candidate_rescue_attempt_rate",
|
|
"topology_route_work_observation_rate"):
|
|
rate = _finite_number(metrics.get(key, 0.0))
|
|
if not math.isfinite(rate) or not 0.0 < rate <= 1.0:
|
|
return [f"shadow-cost arm lacks {key}; a load attempt or global fallback is not routed work"]
|
|
if params.get("require_exact_shadow_control"):
|
|
work = _finite_number(metrics.get("topology_candidate_rescue_exact_distance_evaluations_sum", 0.0))
|
|
if not math.isfinite(work) or work <= 0.0:
|
|
return ["traced shadow arm did not execute its exact control"]
|
|
return []
|