Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

Launch relative certificate checkers at their verified location

Rudy Celekli8d262d7a16e6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6646495d..8e426ffb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to Open Ontologies are documented here.
### Fixed
+- Launch explicitly selected and environment-configured certificate checkers by their verified location, including paths relative to the current directory.
+
- Keep the last active ontology intact when parsing a replacement source, cache, or refresh fails; publish successful replacements in one graph transaction.
- Bound wildcard repository filtering to pattern/filename pairs so repeated stars cannot stall `onto_repo_list`.
- Sanitize quotes and ASCII control bytes in mapped IRI components so valid structured data does not fail RDF ingestion.
diff --git a/python/src/open_ontologies_lite/horn/certify.py b/python/src/open_ontologies_lite/horn/certify.py
index 2f93b7f9..6b48de22 100644
--- a/python/src/open_ontologies_lite/horn/certify.py
+++ b/python/src/open_ontologies_lite/horn/certify.py
@@ -125,7 +125,9 @@ def find_checker(name: str = "oo-horn", explicit: str | Path | None = None) -> P
# site-wide default rather than a per-call instruction.
p = Path(explicit)
if p.is_file() and os.access(p, os.X_OK):
- return p
+ # Keep a verified relative path from becoming a bare PATH lookup.
+ # Preserve symlink identity; only anchor it to the current directory.
+ return p.absolute()
raise CheckerUnavailable(
name,
[str(p)],
@@ -137,7 +139,9 @@ def find_checker(name: str = "oo-horn", explicit: str | Path | None = None) -> P
p = Path(from_env)
looked.append(f"{env}={from_env}")
if p.is_file() and os.access(p, os.X_OK):
- return p
+ # Keep a verified relative path from becoming a bare PATH lookup.
+ # Preserve symlink identity; only anchor it to the current directory.
+ return p.absolute()
repo = _repo_candidate(name)
if repo is not None:
looked.append(str(repo))
diff --git a/python/tests/test_horn_checker_relative.py b/python/tests/test_horn_checker_relative.py
new file mode 100644
index 00000000..4c3c9d1a
--- /dev/null
+++ b/python/tests/test_horn_checker_relative.py
@@ -0,0 +1,32 @@
+"""The executable we locate must be the executable we launch."""
+import sys
+import pytest
+from open_ontologies_lite.horn.certify import check_horn, find_checker
+
[email protected]("source", ["explicit", "environment", "path", "absolute"])
+def test_located_checker_executes_from_selected_location(tmp_path, monkeypatch, source):
+ monkeypatch.chdir(tmp_path)
+ binary = tmp_path / "oo-horn"
+ try:
+ binary.symlink_to(sys.executable)
+ except (OSError, NotImplementedError) as exc:
+ pytest.skip(f"executable symlink fixture unavailable: {exc}")
+ (tmp_path / "check").write_text('import json,sys; print(json.dumps({"ok": False})); sys.exit(1)', encoding="utf-8")
+ # Python runs the owned script named "check" with the checker's actual argv.
+ # This exercises transport, not the Lean certification algorithm.
+ explicit = None
+ monkeypatch.delenv("OO_HORN", raising=False)
+ monkeypatch.setenv("PATH", str(tmp_path / "unrelated-bin"))
+ if source == "explicit":
+ explicit = "./oo-horn"
+ elif source == "environment":
+ monkeypatch.setenv("OO_HORN", "./oo-horn")
+ elif source == "path":
+ monkeypatch.setenv("PATH", ".")
+ else:
+ explicit = str(binary)
+ located = find_checker(explicit=explicit)
+ assert located.is_file()
+ report = check_horn("certificate", checker=explicit)
+ assert report["status"] == "rejected", report
+ assert report["checked"] is True and report["verdict"] is None