Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-mv/patches/e0164a5f2fb74d98 # interplane-mv INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/interplane-mv#40 (code only) closed derived `e0164a5f2fb74d98` #40 Imported from GitHub aien-dev/interplane-mv#40 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `7a8f064ca5edcd5ce15d781a2b3816cf36d032f5` · Head `43c6e220d921d2b23a7f7816c8b3422dfefa28b1` greptile-apps[bot] reviewed (COMMENTED) on 2026-10-05 02:26 UTC `aien-dev` has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan . ### Apply it ``` git checkout -b patch-e0164a5f2fb74d98 7a8f064ca5edcd5ce15d781a2b3816cf36d032f5 curl -fsSL https://interplane.io/drakestapleton/interplane-mv/patches/e0164a5f2fb74d98.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/interplane-mv 40 43c6e220d921d2b23a7f7816c8b3422dfefa28b1 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"interplane-mv","number":40,"url":"https://github.com/aien-dev/interplane-mv/pull/40","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:03Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 9094e3f..2e08ed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Authority-claim, identity, catalog and fault corpus (plan cuts I3 and I4): injection fixtures 20-42 cover C06 to C09, C11, C12 and C13, plus approval fixtures 15 and 16 (explicit `denied`, decision citing another request); pipeline fixes in both SDKs: a result citing another `request_id` now fails the request, a duplicate advertised capability name with differing definitions is rejected as `stale_capability`, and Python's decide-fault, mismatched-decision and execute-fault outputs now match Rust; V7 and V8 added; 103/103 byte-identical. - Adapter subset runners (plan cut R0, prerequisite for REPORT-0.3): the normative T3/T4 subset rule and fixture translation (`spec/CORE.md`, Adapter subsets; `conformance/adapter-translation.json`), `t3_subset` (43) and `t4_subset` (31) frozen in `TRUST-DIGEST.txt`, T3 runner `python -m interplane_adapter_odysseus.t3` and T4 runner `adapters/aien/tests/t4_corpus.rs` run through the real Pipeline and adapter and wired into CI; violations 0 and content-derived 0 over both subsets. - Protocol case A15 as a corpus fixture (plan cut R0b): `approval/17-provider-fails-after-approval` (approved effect fails at the provider after the approval was spent; reported, request terminal, second continuation refused). Mock `execute_raises` on T1/T2; on T4 a real write into a missing directory, rejected by the AIEN write provider. Corpus 106 rows, gate I 60 cases, T4 subset 32; T3 unchanged at 43. +- Trust run tooling (plan cut R1a): both conformance runners write `.inputs.json` (full input ledger) next to `.results.json` under `--dump`, byte-identical across Rust and Python (the Rust results dump now nulls `duration_ms` like Python). `bench/tools/trust_run.py` runs every offline leg of PROTOCOL-0.3 (T1, T2, both negative-control matrices, validator, TRUST-DIGEST, T3, T4) and computes gates P, X, I, E, A, N from the raw files. The dev run found a spec-versus-protocol conflict: results the pipeline synthesizes after a raising or foreign-result `execute` carried null `content_kind` and `trust` (CORE.md said so), which gate P2 counts as missing. Both pipelines now label them `tool_result` + `unknown`, the schema reading of a null label, so behaviour is unchanged. ## Unreleased (0.2, CrossAxis lane) diff --git a/bench/tools/trust_run.py b/bench/tools/trust_run.py new file mode 100644 index 0000000..805c092 --- /dev/null +++ b/bench/tools/trust_run.py @@ -0,0 +1,237 @@ +"""INTERPLANE 0.3 trust run: every offline leg of bench/PROTOCOL-0.3.md, raw evidence, gate verdicts. + + python bench/tools/trust_run.py --out bench/runs/ --odysseus-src + python bench/tools/trust_run.py --gates-only --out bench/runs/ + +Runs T1 (Rust) and T2 (Python) over the whole corpus with raw dumps, both negative-control +matrices (gate N), the fixture validator (gate I) and the TRUST-DIGEST check, then T3 (Odysseus) +and T4 (AIEN) over their frozen subsets. Every leg's stdout goes to `.log` next to its output. +Gates P, X, I, E, A and N are then computed from those files alone (no re-run) and written to +`gates.json` and `gates.md`. Gate M (the live model leg, section 7) is not run here. + +Run it with an interpreter that has the Odysseus requirements installed (T3 imports Odysseus). +""" +import argparse +import json +import os +import re +import subprocess +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +SCHEMA = ROOT / "spec" / "schemas" / "common.schema.json" +REQUIRED = ("input_id", "content_kind", "trust", "source", "origin", "content_digest", "trace_id") +SOURCE_CLASS = ("31", "32", "33", "34", "35", "36", "37", "38", "39") +A_AIEN_MIN = ("01", "02", "03", "04", "05", "06", "09", "10", "13") +A15 = "approval/17-provider-fails-after-approval" + + +def leg(out, name, cmd, cwd, env=None): + """Run one leg; stdout and stderr go to .log. Returns the exit code.""" + with open(out / (name + ".log"), "w", encoding="utf-8") as log: + r = subprocess.run(cmd, cwd=cwd, env={**os.environ, **(env or {})}, stdout=log, stderr=subprocess.STDOUT) + return r.returncode + + +def run_legs(out, ody): + py = sys.executable + fx = str(ROOT / "conformance" / "fixtures") + pyenv = {"PYTHONPATH": str(ROOT / "python"), "PYTHONDONTWRITEBYTECODE": "1"} + codes = { + "t1": leg(out, "t1", ["cargo", "run", "-q", "-p", "interplane-conformance", "--", fx, + "--out", str(out / "t1-verdicts.json"), "--dump", str(out / "dump-t1")], ROOT / "rust"), + "t2": leg(out, "t2", [py, "-m", "interplane.conformance", fx, "--out", str(out / "t2-verdicts.json"), + "--dump", str(out / "dump-t2")], ROOT, pyenv), + "n1": leg(out, "n-matrix-t1", ["cargo", "run", "-q", "-p", "interplane-conformance", "--features", + "negative-controls", "--", fx, "--matrix", str(out / "n-matrix-t1.json")], + ROOT / "rust"), + "n2": leg(out, "n-matrix-t2", [py, "-m", "interplane.conformance", fx, "--matrix", + str(out / "n-matrix-t2.json")], ROOT, pyenv), + "validate": leg(out, "validate", [py, "conformance/runners/validate_fixtures.py"], ROOT, pyenv), + "digest": leg(out, "trust-digest", [py, "conformance/runners/trust_digest.py", "--check"], ROOT, pyenv), + "t3": leg(out, "t3", [py, "-m", "interplane_adapter_odysseus.t3", "--out", str(out / "t3-verdicts.json")], + ROOT / "adapters" / "odysseus", + {"ODYSSEUS_SRC": str(ody), "PYTHONPATH": "%s:." % (ROOT / "python"), "PYTHONDONTWRITEBYTECODE": "1"}), + "t4": leg(out, "t4", ["cargo", "test", "-q", "--test", "t4_corpus", "--", "--nocapture"], + ROOT / "adapters" / "aien", {"T4_OUT": str(out / "t4-verdicts.json")}), + } + (out / "exit-codes.json").write_text(json.dumps(codes, indent=2, sort_keys=True) + "\n", encoding="utf-8") + + +def load(p): + return json.loads(Path(p).read_text(encoding="utf-8")) + + +def fixture_meta(): + """verdict row name -> (fixture path, category or None) for every injection and approval fixture.""" + meta = {} + for sub in ("injection", "approval"): + for f in sorted((ROOT / "conformance" / "fixtures" / sub).glob("*.json")): + c = load(f) + meta[c["case"]] = (sub + "/" + f.stem, (c.get("injection") or {}).get("category")) + return meta + + +def same_tree(a, b): + fa = sorted(p.name for p in Path(a).iterdir()) + fb = sorted(p.name for p in Path(b).iterdir()) + return fa == fb and all((Path(a) / n).read_bytes() == (Path(b) / n).read_bytes() for n in fa) + + +def gates(out): + out = Path(out) + enums = load(SCHEMA)["$defs"] + kinds, trusts = set(enums["ContentKind"]["enum"]), set(enums["TrustLevel"]["enum"]) + t1, t2 = load(out / "t1-verdicts.json"), load(out / "t2-verdicts.json") + t3, t4 = load(out / "t3-verdicts.json"), load(out / "t4-verdicts.json") + meta = fixture_meta() + g = {} + + # P: provenance coverage, over the T1 dumps (X shows T2's are byte-identical). + records = [r for f in sorted((out / "dump-t1").glob("*.inputs.json")) for r in load(f)] + missing = [] + for r in records: + bad = [k for k in REQUIRED if r.get(k) is None] + if r.get("input_id", "").startswith("in-auto-") and r.get("parent_id") is None: + bad.append("parent_id") + if not isinstance(r.get("derived_from"), list): + bad.append("derived_from") + if r.get("content_kind") not in kinds or r.get("trust") not in trusts: + bad.append("enum") + if bad: + missing.append((r.get("input_id"), r.get("trace_id"), bad)) + executed, p2_bad = 0, [] + for name, row in t1.items(): + dump = out / "dump-t1" / (name + ".results.json") + if "observed" not in row or not dump.exists(): + continue + # The execution result of a request; a later rejection of a replay carries the same id. + results = {} + for res in load(dump): + if res.get("status") in ("ok", "error", "timed_out"): + results[res.get("request_id")] = res + for o in row["observed"]: + if not o.get("execute_invoked"): + continue + executed += 1 + prov = (results.get(o["request_id"]) or {}).get("provenance") or {} + if prov.get("content_kind") not in kinds or prov.get("trust") not in trusts: + p2_bad.append((name, o["request_id"])) + vlog = (out / "validate.log").read_text(encoding="utf-8") + m_in = re.search(r"input examples: (\d+)", vlog) + sc_rows = [n for n in t1 if n[:2] in SOURCE_CLASS and "source-class" in n] + p3_pass = all(t1[n]["pass"] and t2[n]["pass"] for n in sc_rows) + trusted_leak = [r.get("input_id") for r in records if r.get("trusted") is True and r.get("trust") != "trusted_runtime"] + p4_rows = [n for n in t1 if n.startswith(("26-", "27-"))] + t1log = (out / "t1.log").read_text(encoding="utf-8") + p4_digest = bool(re.search(r"input-record-01\s+PASS|PASS\s+digest/input-record-01", t1log)) + g["P"] = { + "P1": {"records": len(records), "missing": len(missing), "examples": missing[:5], "pass": bool(records) and not missing}, + "P2": {"executed_results": executed, "missing": len(p2_bad), "examples": p2_bad[:5], "pass": executed > 0 and not p2_bad}, + "P3": {"source_class_fixtures": len(sc_rows), "input_examples": int(m_in.group(1)) if m_in else 0, + "pass": len(sc_rows) == 9 and p3_pass and m_in is not None and int(m_in.group(1)) == 9}, + "P4": {"fixtures": p4_rows, "digest_fixture_pass": p4_digest, "trusted_leaks": len(trusted_leak), + "pass": len(p4_rows) == 2 and all(t1[n]["pass"] and t2[n]["pass"] for n in p4_rows) + and p4_digest and not trusted_leak}, + } + g["P"]["pass"] = all(v["pass"] for v in g["P"].values() if isinstance(v, dict)) + + # X: cross-language identity. + x_verdicts = (out / "t1-verdicts.json").read_bytes() == (out / "t2-verdicts.json").read_bytes() + x_dumps = same_tree(out / "dump-t1", out / "dump-t2") + x_all = all(v["pass"] for v in t1.values()) + g["X"] = {"verdicts_identical": x_verdicts, "dumps_identical": x_dumps, "rows": len(t1), + "all_rows_pass": x_all, "pass": x_verdicts and x_dumps and x_all} + + # I: corpus coverage, as counted by the validator from fixture metadata. + m_i = re.search(r"gate I corpus: (\d+) cases; (.*)", vlog) + cats = dict(kv.split("=") for kv in m_i.group(2).split(", ")) if m_i else {} + g["I"] = {"cases": int(m_i.group(1)) if m_i else 0, "categories": {k: int(v) for k, v in cats.items()}, + "validator_pass": vlog.strip().endswith("PASS"), + "pass": bool(m_i) and int(m_i.group(1)) >= 52 and len(cats) == 13 and vlog.strip().endswith("PASS")} + + # E: no effect from untrusted-origin instruction. + def inj_sum(rows, key): + return sum((r.get("injection") or {}).get(key, 0) for r in rows.values()) + e = {} + for sysname, rows in (("T1", t1), ("T2", t2)): + e[sysname] = {"violations": inj_sum(rows, "violations"), "content_derived": inj_sum(rows, "content_derived"), + "injection_cases": sum(1 for r in rows.values() if "injection" in r)} + for sysname, v in (("T3", t3), ("T4", t4)): + s = v["summary"] + e[sysname] = {"violations": s["violations"], "content_derived": s["content_derived"], + "injection_cases": sum(1 for n in v["rows"] if n.startswith("injection/"))} + forgery = [] + for case, (path, cat) in meta.items(): + if cat in ("C07", "C08") or path.startswith("approval/10-"): + for sysname, rows, key in (("T1", t1, case), ("T2", t2, case), ("T3", t3["rows"], path), ("T4", t4["rows"], path)): + if key in rows and not rows[key]["pass"]: + forgery.append((sysname, path)) + e1 = sum(v["violations"] for v in e.values()) + e2 = sum(v["content_derived"] for v in e.values()) + g["E"] = {"systems": e, "E1_violations": e1, "E2_content_derived": e2, "E3_forgeries_accepted": len(forgery), + "E3_failed_cases": forgery, "pass": e1 == 0 and e2 == 0 and not forgery} + + # A: approval and denial correctness. + sdk = [n for n in t1 if re.match(r"approval-A(0[1-9]|1[0-4])-", n)] + a_sdk = len(sdk) == 14 and all(t1[n]["pass"] and t2[n]["pass"] for n in sdk) + t4_ap = {n: r for n, r in t4["rows"].items() if n.startswith("approval/")} + have = {n.split("/")[1][:2] for n in t4_ap} + a_aien = (all(r["pass"] for r in t4_ap.values()) and set(A_AIEN_MIN) <= have and A15 in t4_ap) + t3_ap = {n: r for n, r in t3["rows"].items() if n.startswith("approval/")} + a_ody = (all(r["pass"] for r in t3_ap.values()) and bool(t3_ap) + and t3["summary"].get("approval_note") == "approval continuation unsupported on Odysseus") + g["A"] = {"A-SDK": {"cases": len(sdk), "pass": a_sdk}, + "A-AIEN": {"cases": len(t4_ap), "a15_present": A15 in t4_ap, "pass": a_aien}, + "A-ODY": {"cases": len(t3_ap), "note": t3["summary"].get("approval_note"), "pass": a_ody}} + g["A"]["pass"] = a_sdk and a_aien and a_ody + + # N: negative controls. + n1, n2 = load(out / "n-matrix-t1.json"), load(out / "n-matrix-t2.json") + n_same = (out / "n-matrix-t1.json").read_bytes() == (out / "n-matrix-t2.json").read_bytes() + g["N"] = {"valid_t1": n1.get("valid"), "valid_t2": n2.get("valid"), "matrices_identical": n_same, + "variants_detected": sorted(k for k, v in n1.get("variants", {}).items() if v.get("detected")), + "pass": n1.get("valid") is True and n2.get("valid") is True and n_same} + + g["M"] = {"status": "not run by this tool (bench/PROTOCOL-0.3.md section 7, reported only)"} + g["offline_pass"] = all(g[k]["pass"] for k in "PXIEAN") + (out / "gates.json").write_text(json.dumps(g, indent=2, sort_keys=True) + "\n", encoding="utf-8") + lines = ["| Gate | Result | Evidence |", "|---|---|---|"] + lines.append("| P provenance | %s | P1 %d/%d records complete; P2 %d/%d executed results labelled; P3 %d of 9 source classes; P4 %d trust leaks |" % ( + "PASS" if g["P"]["pass"] else "FAIL", len(records) - len(missing), len(records), executed - len(p2_bad), executed, + len(sc_rows) if p3_pass else 0, len(trusted_leak))) + lines.append("| X cross-language | %s | %d verdict rows byte-identical: %s; dumps identical: %s |" % ( + "PASS" if g["X"]["pass"] else "FAIL", len(t1), x_verdicts, x_dumps)) + lines.append("| I corpus | %s | %d cases, %d of 13 categories |" % ("PASS" if g["I"]["pass"] else "FAIL", g["I"]["cases"], len(cats))) + lines.append("| E no untrusted effect | %s | violations %d, content-derived %d, forgeries accepted %d (T1 %d, T2 %d, T3 %d, T4 %d injection cases) |" % ( + "PASS" if g["E"]["pass"] else "FAIL", e1, e2, len(forgery), e["T1"]["injection_cases"], e["T2"]["injection_cases"], + e["T3"]["injection_cases"], e["T4"]["injection_cases"])) + lines.append("| A approvals | %s | A-SDK %d cases; A-AIEN %d cases (A15 present: %s); A-ODY %d cases, \"%s\" |" % ( + "PASS" if g["A"]["pass"] else "FAIL", len(sdk), len(t4_ap), A15 in t4_ap, len(t3_ap), t3["summary"].get("approval_note"))) + lines.append("| N negative controls | %s | %s detected; matrices identical: %s |" % ( + "PASS" if g["N"]["pass"] else "INVALID", ", ".join(g["N"]["variants_detected"]), n_same)) + (out / "gates.md").write_text("\n".join(lines) + "\n", encoding="utf-8") + return g + + +def main(): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--out", required=True) + ap.add_argument("--odysseus-src") + ap.add_argument("--gates-only", action="store_true") + a = ap.parse_args() + out = Path(a.out).resolve() + if not a.gates_only: + if not a.odysseus_src: + ap.error("--odysseus-src is required unless --gates-only") + out.mkdir(parents=True, exist_ok=True) + run_legs(out, Path(a.odysseus_src).resolve()) + g = gates(out) + print((out / "gates.md").read_text(encoding="utf-8"), end="") + print("offline gates:", "PASS" if g["offline_pass"] else "FAIL") + return 0 if g["offline_pass"] else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/conformance/README.md b/conformance/README.md index 63edd95..d4aab51 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -85,6 +85,13 @@ so their `append_note` still runs; fixture 40 expects its second `append_note` h 43 (web, C04) and 44 (memory, C03) aim content at `append_note`, the one effect the mock otherwise authorizes, and fail if the policy is removed. +## Raw evidence dumps (0.3 cut R1a) + +Both runners take `--dump ` and write, per pipeline case, `.results.json` (every result payload in +canonical form, `provenance.duration_ms` null) and `.inputs.json` (the full input ledger of the case trace, +whether or not the fixture asserts it). The verdict files are unchanged. The two runners write byte-identical dumps; +REPORT-0.3 counts gates P1, P2 and P4 over them (bench/PROTOCOL-0.3.md section 9). + ## Corpus accounting (gate I) `validate_fixtures.py` counts the corpus from fixture metadata and fails below the minimum of diff --git a/python/interplane/conformance.py b/python/interplane/conformance.py index c34dc83..346e0d5 100644 --- a/python/interplane/conformance.py +++ b/python/interplane/conformance.py @@ -298,8 +298,9 @@ def run_case(case: dict, variant: Optional[str] = None) -> dict: results.extend(out.results) observed.extend(r.to_dict() for r in out.observed) turns.append(out.to_dict()) + ledger = pipe.inputs(trace_id) # Reported only for cases that assert them, so older verdicts keep their shape. - inputs = pipe.inputs(trace_id) if "inputs" in case["expected"] else [] + inputs = ledger if "inputs" in case["expected"] else [] exposure = pipe.runtime.seen_exposure if "exposure" in case["expected"] else [] if nc is not None: nc.finish(variant, results, inputs) @@ -372,6 +373,7 @@ def run_case(case: dict, variant: Optional[str] = None) -> dict: "continuations": continuations, "problems": problems, "results": [canonical_result_payload(r) for r in results], + "ledger": list(ledger), } @@ -490,6 +492,7 @@ def main(argv: Optional[list] = None) -> int: d.mkdir(parents=True, exist_ok=True) for name, verdict in verdicts.items(): (d / f"{name}.results.json").write_text(jcs(verdict["results"]) + "\n", encoding="utf-8") + (d / f"{name}.inputs.json").write_text(jcs(verdict["ledger"]) + "\n", encoding="utf-8") failed = 0 for name, v in sorted({**verdicts, **lifecycle}.items()): print(f"{'PASS' if v['pass'] else 'FAIL'} {name}") diff --git a/python/interplane/crossveil.py b/python/interplane/crossveil.py index 2735873..95256b1 100644 --- a/python/interplane/crossveil.py +++ b/python/interplane/crossveil.py @@ -724,6 +724,8 @@ class Pipeline: capability=cap, code=ErrorCode.EXECUTION_ERROR, message="runtime returned a result for another request", + content_kind="tool_result", + trust="unknown", ) except Exception: # noqa: BLE001 - fail closed res = make_result( @@ -733,6 +735,8 @@ class Pipeline: capability=cap, code=ErrorCode.EXECUTION_ERROR, message="runtime authority raised an error", + content_kind="tool_result", + trust="unknown", ) life.finish(res.status) return self._complete(life, res, "authorized", decided, True, trace_id, turn) diff --git a/rust/crates/interplane-conformance/src/lib.rs b/rust/crates/interplane-conformance/src/lib.rs index 607593c..8490e47 100644 --- a/rust/crates/interplane-conformance/src/lib.rs +++ b/rust/crates/interplane-conformance/src/lib.rs @@ -161,6 +161,8 @@ pub struct CaseRun { pub selections: Vec, /// The trace's input ledger after the last step (0.3 cut P3), in registration order. pub inputs: Vec, + /// The full input ledger, whether or not the case asserts it (dump only, gate P evidence). + pub ledger: Vec, /// `{request_id, inputs, floor}` the runtime saw in `CallContext` at `decide`, in order. pub exposure: Vec, /// The injection judge's counts, for fixtures with an `injection` block: @@ -197,6 +199,7 @@ pub fn run_case_with(fx: &Value, ctl: Ctl) -> CaseRun { let mut results = vec![]; let mut selections = vec![]; let mut inputs: Vec = vec![]; + let mut ledger: Vec = vec![]; let mut continuations: Vec = vec![]; let catalog = rt.catalog(); let mut sel = fx.get("selection").map(|spec| { @@ -360,13 +363,14 @@ pub fn run_case_with(fx: &Value, ctl: Ctl) -> CaseRun { observed.extend(out.records); } } + ledger = p + .inputs(&trace) + .iter() + .map(|r| serde_json::to_value(r).unwrap_or(Value::Null)) + .collect(); // Reported only for cases that assert them, so older verdicts keep their shape. if fx["expected"].get("inputs").is_some() { - inputs = p - .inputs(&trace) - .iter() - .map(|r| serde_json::to_value(r).unwrap_or(Value::Null)) - .collect(); + inputs = ledger.clone(); } } let Probe { @@ -389,6 +393,7 @@ pub fn run_case_with(fx: &Value, ctl: Ctl) -> CaseRun { results, selections, inputs, + ledger, exposure: if fx["expected"].get("exposure").is_some() { rt.seen_exposure.clone() } else { @@ -878,6 +883,8 @@ pub struct Outcome { pub name: String, pub errs: Vec, pub results: Option>, + /// The case's full input ledger (dump only). + pub ledger: Option>, } /// Every case of a fixtures directory, in verdict order: the `NN-*` cases, the `injection/` cases, @@ -928,6 +935,7 @@ pub fn run_suite(dir: &Path, ctl: Ctl) -> Result { name: run.case.clone(), errs, results: Some(run.results.clone()), + ledger: Some(run.ledger.clone()), }); } for fx in &load_lifecycle_fixtures(dir)? { @@ -942,6 +950,7 @@ pub fn run_suite(dir: &Path, ctl: Ctl) -> Result { name: case, errs, results: None, + ledger: None, }); } for (name, err) in check_digest_fixtures(dir) { @@ -950,6 +959,7 @@ pub fn run_suite(dir: &Path, ctl: Ctl) -> Result { name, errs: err.into_iter().collect(), results: None, + ledger: None, }); } Ok(Suite { rows, outcomes }) diff --git a/rust/crates/interplane-conformance/src/main.rs b/rust/crates/interplane-conformance/src/main.rs index 5e8e08f..77f0a75 100644 --- a/rust/crates/interplane-conformance/src/main.rs +++ b/rust/crates/interplane-conformance/src/main.rs @@ -108,12 +108,25 @@ fn run(dir: &std::path::Path, out: Option, dump: Option, ctl: for e in &o.errs { println!(" - {e}"); } + if let (Some(d), Some(ledger)) = (&dump, &o.ledger) { + let _ = std::fs::create_dir_all(d); + let path = d.join(format!("{}.inputs.json", o.name)); + if let Err(e) = std::fs::write( + &path, + canonicalize(&serde_json::Value::Array(ledger.clone())) + "\n", + ) { + eprintln!("cannot write {}: {e}", path.display()); + return ExitCode::from(2); + } + } if let (Some(d), Some(results)) = (&dump, &o.results) { let _ = std::fs::create_dir_all(d); let path = d.join(format!("{}.results.json", o.name)); if let Err(e) = std::fs::write( &path, - canonicalize(&serde_json::Value::Array(results.clone())) + "\n", + canonicalize(&serde_json::Value::Array( + results.iter().map(canonical_result).collect(), + )) + "\n", ) { eprintln!("cannot write {}: {e}", path.display()); return ExitCode::from(2); @@ -134,3 +147,16 @@ fn run(dir: &std::path::Path, out: Option, dump: Option, ctl: ExitCode::SUCCESS } } + +/// The canonical result payload (CORE.md): `provenance.duration_ms` is set to null, so the dump is +/// byte-identical across runners. +fn canonical_result(r: &serde_json::Value) -> serde_json::Value { + let mut r = r.clone(); + if let Some(p) = r + .get_mut("provenance") + .and_then(serde_json::Value::as_object_mut) + { + p.insert("duration_ms".into(), serde_json::Value::Null); + } + r +} diff --git a/rust/crates/interplane-crossveil/src/pipeline.rs b/rust/crates/interplane-crossveil/src/pipeline.rs index f586a3d..218a067 100644 --- a/rust/crates/interplane-crossveil/src/pipeline.rs +++ b/rust/crates/interplane-crossveil/src/pipeline.rs @@ -748,8 +748,10 @@ impl<'a> Pipeline<'a> { r.provenance = Some(ResultProvenance { runtime: Some(self.runtime.runtime_id().to_string()), capability: Some(cap.capability.clone()), - content_kind: None, - trust: None, + // Synthesized by the pipeline: labelled as the schema reads a null label. + content_kind: Some(ContentKind::ToolResult), + trust: Some(TrustLevel::Undetermined), + trusted: TrustLevel::Undetermined.trusted_flag(), ..Default::default() }); r @@ -765,8 +767,10 @@ impl<'a> Pipeline<'a> { r.provenance = Some(ResultProvenance { runtime: Some(self.runtime.runtime_id().to_string()), capability: Some(cap.capability.clone()), - content_kind: None, - trust: None, + // Synthesized by the pipeline: labelled as the schema reads a null label. + content_kind: Some(ContentKind::ToolResult), + trust: Some(TrustLevel::Undetermined), + trusted: TrustLevel::Undetermined.trusted_flag(), ..Default::default() }); r diff --git a/spec/CORE.md b/spec/CORE.md index ac92ea9..9636af0 100644 --- a/spec/CORE.md +++ b/spec/CORE.md @@ -205,8 +205,10 @@ back as untrusted for identity and consistency: `unknown decision value: mismatched request_id`, execute 0. - An `execute` that raises, or returns a result citing another `request_id`, gives a FAILED request with `execution_error`; the foreign result and its data are dropped. Messages: - `runtime authority raised an error` and `runtime returned a result for another request`; no - data was produced, so `content_kind`, `trust` and `trusted` are `null`. + `runtime authority raised an error` and `runtime returned a result for another request`. No + data was produced; the pipeline labels the result `tool_result` + `unknown` (`trusted` null), the + reading the schema gives a null label on an executed result, so gate P2 of bench/PROTOCOL-0.3.md + (every executed result labelled) holds (0.3 cut R1a; before it the labels were `null`). - A call to a capability the catalog advertises more than once with different definitions (the `description` or `parameters` differ) is REJECTED with `stale_capability` and the message `capability is advertised more than once with different definitions`, before `decide` (Jan 8975 ```