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.

Two reasons main's CI is red that no pull request introduced (#248)

Fabio Rovai0fc56167e01b
diff --git a/Cargo.lock b/Cargo.lock
index 7c88efdd..df2c566c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2811,7 +2811,7 @@ dependencies = [
[[package]]
name = "open-ontologies"
-version = "1.5.0"
+version = "1.6.0"
dependencies = [
"anyhow",
"arrow 54.3.1",
diff --git a/Cargo.toml b/Cargo.toml
index 666e2a2c..7b702b97 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "open-ontologies"
-version = "1.5.0"
+version = "1.6.0"
edition = "2024"
description = "AI-native ontology engine: an MCP server and CLI for building, validating, querying and reasoning over RDF and OWL, with a native SHIQ tableaux reasoner, SHACL validation and SPARQL. Single binary, no JVM."
license = "MIT"
diff --git a/tests/fol_prove_certified_test.rs b/tests/fol_prove_certified_test.rs
index 188c7c0b..350ecf17 100644
--- a/tests/fol_prove_certified_test.rs
+++ b/tests/fol_prove_certified_test.rs
@@ -3,12 +3,34 @@
use std::path::PathBuf;
use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::{Mutex, MutexGuard};
use open_ontologies::graph::GraphStore;
use open_ontologies::tstp::{prove_export, ProveOptions, Prover};
static NEXT: AtomicU64 = AtomicU64::new(0);
+/// Cargo runs the tests in this file as parallel THREADS of one process, and
+/// `$OO_RESOLUTION` is process-wide. One test sets it to a path that does not
+/// exist, on purpose, to see the absent branch; the others read it to find the
+/// checker. Being the sole WRITER does not make that safe when the readers are
+/// its own siblings: the writer's window overlapped a reader twice on 21
+/// September 2026, and the reader reported `checker_absent` and a verdict of
+/// `refutation_fully_replayed` where `refutation_certified` was expected.
+///
+/// So every test that depends on how the checker is found takes this lock.
+/// They then run one at a time, which costs a few seconds and removes a flake
+/// that looks exactly like a real regression in the certified path.
+///
+/// `lock().unwrap_or_else(|e| e.into_inner())`: a test that panics while
+/// holding the lock poisons it, and the next test would then fail for a
+/// reason that has nothing to do with what it checks.
+static CHECKER_ENV: Mutex<()> = Mutex::new(());
+
+fn checker_env() -> MutexGuard<'static, ()> {
+ CHECKER_ENV.lock().unwrap_or_else(|e| e.into_inner())
+}
+
fn scratch() -> PathBuf {
let d = std::env::temp_dir().join(format!("oo-prove-cert-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed)));
std::fs::create_dir_all(&d).unwrap();
@@ -42,6 +64,7 @@ const RL_GOAL: &str = "<http://example.org/ontology/ies-building#Building>\t<htt
#[test]
fn an_rl_goal_is_certified_by_the_theorem_with_no_user_action() {
+ let _env = checker_env();
if !tools() { return; }
let j = run(RL, RL_GOAL);
assert_eq!(j["problem_form"], "cnf", "an RL ontology must go to the prover as clauses: {j}");
@@ -60,6 +83,7 @@ const DL_GOAL: &str = "<http://www.co-ode.org/ontologies/pizza/pizza.owl#America
#[test]
fn a_dl_ontology_stays_an_opinion_and_the_report_names_the_axiom_that_cost_it() {
+ let _env = checker_env();
if !Prover::Vampire.available() { return; }
let j = run(DL, DL_GOAL);
assert_eq!(j["problem_form"], "fof", "a superclass existential forces FOF: {j}");
@@ -75,11 +99,13 @@ fn a_dl_ontology_stays_an_opinion_and_the_report_names_the_axiom_that_cost_it()
#[test]
fn the_certified_word_cannot_appear_without_the_checker() {
+ let _env = checker_env();
// Same RL goal, checker pointed at a path that does not exist. An explicit
// OO_RESOLUTION is an instruction, not a hint, so there is no fallback: the
// replay still runs, the certificate field says the checker was absent,
// and the WORD is not printed. This test is the sole writer of OO_RESOLUTION in
- // its process.
+ // its process, and it holds `checker_env()` so no sibling can read the
+ // variable while it is pointed at nothing.
if !Prover::Vampire.available() { return; }
let had = std::env::var("OO_RESOLUTION").ok();
unsafe { std::env::set_var("OO_RESOLUTION", "/nonexistent/oo-resolution") };
diff --git a/tests/verdict_vocabulary_test.rs b/tests/verdict_vocabulary_test.rs
index 160ae282..4de2cf92 100644
--- a/tests/verdict_vocabulary_test.rs
+++ b/tests/verdict_vocabulary_test.rs
@@ -26,6 +26,7 @@
//! `run_checker`. There is no other way to get one, which is the point.
use std::path::{Path, PathBuf};
+use std::sync::atomic::{AtomicU64, Ordering};
use open_ontologies::closure_diff::Warrant;
use open_ontologies::projection_entailment::{self as pe, CertKind, CheckerStatus, GoalVerdict};
@@ -62,7 +63,22 @@ fn script_saying(code: i32, theorem: &str) -> PathBuf {
std::fs::create_dir_all(&dir).unwrap();
let ext = if cfg!(windows) { "cmd" } else { "sh" };
let slug: String = theorem.chars().filter(|c| c.is_alphanumeric()).collect();
- let p = dir.join(format!("exit{code}_{slug}.{ext}"));
+ // A FRESH path per call, not one keyed on (code, theorem).
+ //
+ // Cargo runs these tests as parallel threads of one process, and two of
+ // them ask for the same (0, "OOCert.certificate_sound") script. Keyed on
+ // the pair they got the same FILE, so one thread rewrote a script while
+ // the other was executing it. On Linux that is ETXTBSY: the spawn fails,
+ // `run_checker` reports the checker as absent, and
+ // `only_a_zero_exit_produces_an_acceptance` fails an assertion about exit
+ // codes for a reason that has nothing to do with exit codes. It passed on
+ // macOS every time, which is why it read as a CI defect.
+ //
+ // A counter costs one file per call and removes the class rather than the
+ // instance: no future pair of callers can collide either.
+ static NEXT_SCRIPT: AtomicU64 = AtomicU64::new(0);
+ let serial = NEXT_SCRIPT.fetch_add(1, Ordering::Relaxed);
+ let p = dir.join(format!("exit{code}_{slug}_{serial}.{ext}"));
// The fake PRINTS its theorem, because a real checker does and the mint now
// reads it. A script that exits zero in silence named nothing and correctly
// mints nothing; accepting with one would be testing the old contract.