Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
fix(studio): correct a mistaken test name, a stale comment, and a write-only ledger
FABIOTESS9c25da1641cb
diff --git a/studio/src-tauri/src/engine.rs b/studio/src-tauri/src/engine.rsindex ea1a2e4f..16362b1e 100644--- a/studio/src-tauri/src/engine.rs+++ b/studio/src-tauri/src/engine.rs@@ -118,11 +118,12 @@ fn clear_stale_port(port: u16) {}}-// Kept in sync by hand with the matching DEFAULT_ENGINE_PORT constant in-// sidecars/agent/index.ts. That copy is a fallback for running the sidecar-// standalone; in the normal path this Rust value always wins because-// spawn_agent_sidecar sets OPEN_ONTOLOGIES_STUDIO_PORT before the sidecar-// ever reads it, so the two never need to agree at runtime, only in source.+// Kept in sync by hand with the matching ENGINE_PORT constant in+// sidecars/agent/index.ts (`const ENGINE_PORT = process.env.OPEN_ONTOLOGIES_STUDIO_PORT ?? '8137'`).+// That copy is a fallback for running the sidecar standalone; in the normal+// path this Rust value always wins because spawn_agent_sidecar sets+// OPEN_ONTOLOGIES_STUDIO_PORT before the sidecar ever reads it, so the two+// never need to agree at runtime, only in source.const DEFAULT_ENGINE_PORT: u16 = 8137;fn parse_port(raw: Option<&str>) -> u16 {diff --git a/studio/src-tauri/src/mcp.rs b/studio/src-tauri/src/mcp.rsindex e6756f7f..bb5f426d 100644--- a/studio/src-tauri/src/mcp.rs+++ b/studio/src-tauri/src/mcp.rs@@ -169,7 +169,7 @@ mod tests {static ENV_LOCK: Mutex<()> = Mutex::new(());#[test]- fn mcp_call_site_builds_its_url_from_the_configured_port_resolver() {+ fn mcp_endpoint_composes_with_the_live_env_backed_port_resolver() {const VAR: &str = "OPEN_ONTOLOGIES_STUDIO_PORT";const DISTINCTIVE_PORT: &str = "48213";@@ -189,10 +189,17 @@ mod tests {}}- // This exercises the actual call site in do_mcp_call- // (`.post(mcp_endpoint(engine::engine_port()))`), not just the pure- // helper: it proves the URL is built from the real port resolver, so- // re-inlining a literal at that call site would fail this test.+ // This calls the same two functions do_mcp_call's real call site+ // composes (`mcp_endpoint(engine::engine_port())`), with+ // engine_port() reading a live, env-overridden value rather than a+ // literal passed in by hand, as the first test above does. It does+ // NOT call do_mcp_call itself, so it does not exercise that call+ // site directly: if do_mcp_call's `.post(...)` line were changed to+ // build its URL a different way (or inline a literal), this test+ // would keep passing regardless, because it never invokes that+ // function. What this proves is narrower: engine::engine_port()'s+ // env-var override reaches mcp_endpoint() correctly when composed+ // the same way that call site composes them.assert_eq!(endpoint, "http://127.0.0.1:48213/mcp");}}diff --git a/studio/src/lib/__tests__/replay-source.test.ts b/studio/src/lib/__tests__/replay-source.test.tsindex 3b6e53f6..71ff8f7f 100644--- a/studio/src/lib/__tests__/replay-source.test.ts+++ b/studio/src/lib/__tests__/replay-source.test.ts@@ -27,7 +27,12 @@ describe('ReplaySource', () => {expect(found[0].claims.map((c) => c.document)).toEqual(['README', 'examples'])})- it('records a resolution in session state without mutating fixtures', async () => {+ // resolve() itself keeps no ledger (see replay-source.ts: the caller,+ // useDemoStore, is the actual record of a resolution). What this test+ // verifies is narrower and is exactly what it asserts: resolve() resolves+ // without throwing, and does not mutate the committed fixtures as a side+ // effect.+ it('resolves without mutating the committed fixtures', async () => {const src = createReplaySource(fixtures)await src.resolve('f1', { kind: 'accept' })expect(await src.findings()).toHaveLength(1)diff --git a/studio/src/lib/replay-source.ts b/studio/src/lib/replay-source.tsindex 145c59c8..3ea70c3b 100644--- a/studio/src/lib/replay-source.ts+++ b/studio/src/lib/replay-source.ts@@ -1,4 +1,4 @@-import type { Chunk, Claim, Contradiction, Decision, DemoSource, Document, GraphView } from './demo-source'+import type { Chunk, Claim, Contradiction, DemoSource, Document, GraphView } from './demo-source'// A later artifact bundle carries a fifth key ('compare') alongside the// four this replay reads. The index signature makes that tolerance@@ -28,8 +28,6 @@ const cloneGraph = (g: GraphView): GraphView => ({})export function createReplaySource(fixtures: ReplayFixtures): DemoSource {- const ledger: { id: string; decision: Decision }[] = []-return {async corpus() {return fixtures.corpus.map(cloneDocument)@@ -40,9 +38,15 @@ export function createReplaySource(fixtures: ReplayFixtures): DemoSource {async findings() {return fixtures.findings.map(cloneContradiction)},- async resolve(id, decision) {- ledger.push({ id, decision })- },+ // DemoSource.resolve() returns void by design (live-source.ts's+ // implementation throws instead, since no engine tool resolves a+ // finding by id yet), and the caller already keeps its own record: the+ // ledger a resolution shows up in is useDemoStore's `ledger` state+ // (demo-store.ts's resolve() appends to it after this call succeeds),+ // not anything this function needs to track. An earlier version of this+ // function wrote to an internal `ledger` array that nothing ever read+ // back out; it has been removed rather than left as write-only state.+ async resolve(_id, _decision) {},async *ask(question) {const scripted = fixtures.chat[question.trim().toLowerCase()] ?? fixtures.chat[question]if (scripted) {