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/d8cebbfb682726c6 # 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#83 (code only) closed derived `d8cebbfb682726c6` #83 Imported from GitHub aien-dev/interplane-mv#83 (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 `8600657425a457b69234e768e95ee8ba435c6ec2` · Head `c66be90362fed3831c425786980bcf8a233f8911` - wrote on - APPROVE. fmt and clippy -D warnings clean in provenance and adapters/aien; provenance tests pass (24 slice tests). No em dashes, no Python, no binaries, no secrets. Verified: testrun.rs checks all derive from retained, digest-bound records (grant/ack facts via ledger::facts, task.json, source-pin, stdout/stderr digests). test_run_mismatch compares target_blob_sha256_after to ack disk_sha256 and content_sha256, requires exit 0 and test_exit_before != 0. Checks run after the ledger and before fixture.class (lib.rs). link:native is labelled missing when absent. Gate cannot pass vacuously (row ok-line grep, exact verdict arm, any tamper copy that passes dies). Fixture is C + make only. Receipt records the daemon binary sha and a labelled sovereign_core_rev. Non-blocking notes: - Brief asks native_claim_contradicted to fire on a DONE ack with compose_native:false. Not implemented (no testrun.rs path reads the ack for it; the ack records carry no such field). The recall-record check covers the claim; docs should say the ack is not consulted. - stderr digest is only compared if test_stderr is retained; an absent or not-retained stderr file lets any stderr_sha256 hex pass (stdout is required). - row-receipt.json and the daemon records contain /home/drakestapleton paths (daemon-owned records are digest-bound so cannot be redacted; row-receipt.json could be). - compose_recall is digest-bound but not cross-checked to the five ledger records, so a hand-written recall with compose_native:true passes. Covered by the unsigned-export limit. Independent review (Sonnet worker, VAC lane) ### Apply it ``` git checkout -b patch-d8cebbfb682726c6 8600657425a457b69234e768e95ee8ba435c6ec2 curl -fsSL https://interplane.io/drakestapleton/interplane-mv/patches/d8cebbfb682726c6.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 83 c66be90362fed3831c425786980bcf8a233f8911 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"interplane-mv","number":83,"url":"https://github.com/aien-dev/interplane-mv/pull/83","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:12Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a94b6d..4ad5a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,6 +171,7 @@ jobs: - name: fixture verdicts from the CLI run: | test "$(cargo run -q --locked -- verify fixtures/synthetic-full-chain)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn" + test "$(cargo run -q --locked -- verify fixtures/synthetic-fix-the-test)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn" test "$(cargo run -q --locked -- verify fixtures/synthetic-weak-receipt)" = "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=record_effect_receipt/1:weak" test "$(cargo run -q --locked -- verify fixtures/real-waldo-aien-chain)" = "PASS complete effect=aien-ledger-slice/1:strong proposal=model_generation/2 candidate=none" test "$(cargo run -q --locked -- verify fixtures/real-waldo-tokenizer-json)" = "PASS_LABELLED_INCOMPLETE missing=link:effect,link:interplane" diff --git a/CURRENT_STATE.md b/CURRENT_STATE.md index c8d899a..0bcde6b 100644 --- a/CURRENT_STATE.md +++ b/CURRENT_STATE.md @@ -11,6 +11,8 @@ Pinned sources: |---|---|---|---|---| | Odysseus | odysseus-dev/odysseus | 2992bf6 (2026-10-01) | dev | AGPL-3.0 | | AIEN sovereign core | aien-dev/aien-sovereign-core | 9b5e6e8 (2026-10-08 adapter pin; was 7580039 at the 2026-10-04 re-audit) | main | AGPL-3.0-or-later | + +VAC M3b (2026-10-08): the adapter still pins 9b5e6e8 for its crates. The fix-the-test slice gate (adapters/aien/scripts/test-fix-the-test.sh) was run against a daemon built from sovereign-core 47f1014 (#346: `ComposeRecall` reports `compose_native` and `omega_sha`; the daemon prints `Compose: native (omega )`), CPU only, native compose linked from omega 6c6180c. Receipt: adapters/aien/evidence/fix-the-test-2026-10-08/receipt.json. The model turn of that run is scripted. | AIEN aegis-runtime | aien-dev/aegis-runtime | f4e8709 (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | | AIEN protocols | aien-dev/aien-protocols | 3a4cdbe (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | | AIEN architecture | aien-dev/aien-architecture | 6c95697 (2026-10-04 re-audit: still origin/main) | main | AGPL-3.0-or-later | diff --git a/STATUS.md b/STATUS.md index f164594..c54b883 100644 --- a/STATUS.md +++ b/STATUS.md @@ -26,7 +26,7 @@ byte-identical) · `qualified` (measured against a real model/backend). | Source-class coverage (0.3 cut P4) | conformant | conformant | cases 31-40 | one fixture per source class asserting every InputRecord field; mock gains `read_document`, `load_skill`, `call_provider`; skills and tool descriptions are `external_untrusted`; host registers model_generated input | | Conformance runner | implemented | implemented | 45/45 both (40 cases + 5 lifecycle, verdicts byte-identical) | `--dump` writes canonical results per case | | Interplane Probe | qualified | qualified | - | both run live against Qwen3.5-9B/Ollama 0.34.0 with identical verdicts (reports under qualification/reports) | -| AIEN adapter | tested (on the real EffectAuthority path; approved writes through the authenticated daemon ledger route; pinned sovereign-core 9b5e6e8 (live gate: adapters/aien/scripts/test-live-daemon.sh; earlier 4d4dfd4: #296 daemon-minted grants only, #295 signed requirements goal; #262, #260); was 10 pipeline tests in 0.1) | - | - | ADR 0003; real aien-mcp SpeculativeLane + aegis gate; aien-cli SafetyEngine not linkable (private); AGPL | +| AIEN adapter | tested (fix-the-test slice: adapters/aien/scripts/test-fix-the-test.sh, verdict PASS_LABELLED_INCOMPLETE, evidence/fix-the-test-2026-10-08; on the real EffectAuthority path; approved writes through the authenticated daemon ledger route; pinned sovereign-core 9b5e6e8 (live gate: adapters/aien/scripts/test-live-daemon.sh; earlier 4d4dfd4: #296 daemon-minted grants only, #295 signed requirements goal; #262, #260); was 10 pipeline tests in 0.1) | - | - | ADR 0003; real aien-mcp SpeculativeLane + aegis gate; aien-cli SafetyEngine not linkable (private); AGPL | | Odysseus adapter | - | tested (70 tests vs odysseus@2992bf6) | - | executes read_file/ls/glob/grep via Odysseus handlers; approval continuation unsupported, every continuation refused (cut A4); AGPL | | Before/after receipt (0.1 goal) | - | qualified | 2 runs, reproduced | examples/receipt | | CrossAxis gate, 0.2 pre-registered (37 pairs, qwen3.5:9b on Ollama) | - | qualified: FAIL | bench/runs/qual-20261004T2207Z | T 0.877 PASS, S PASS (B 0.730 vs A 0.676), O1 0.865 FAIL, O2 0/5 FAIL; model did not use the discovery tool. See docs/REPORT-0.2.md. 0.2x held-out campaign (bench/PROTOCOL-0.2x.md) not run: runner prepared; arm 3 negative controls N1 and N2 (denied and approval-pending calls cause no expansion and no execution) tested offline in bench/tools/test_runner_offline.py | diff --git a/adapters/aien/README.md b/adapters/aien/README.md index 82a133d..2ebe334 100644 --- a/adapters/aien/README.md +++ b/adapters/aien/README.md @@ -303,11 +303,56 @@ What it does not prove: the exported records carry no signatures, so the verifie from a hand-written file (`provenance/BINDING.md`, Trust); the model turn is scripted, so the verdict is labelled incomplete (no authorship claim); the desk MAC for `ComposeAuthorize` stays default-off (not changed here; this path authenticates by the desk-key MAC regardless); CPU reference backend only; the -daemon does not report whether the native compose library is linked or which revision it was built -from, so the receipt records those as caller-asserted or `UNVERIFIED`. +daemon (before sovereign-core #346) does not report whether the native compose library is linked or which revision it was +built from, so the receipt records those as caller-asserted or `UNVERIFIED`; a daemon with #346 reports +`compose_native` and `omega_sha`, which the fix-the-test slice below carries and checks. Recorded run: `evidence/live-gate-2026-10-08/receipt.json` (CPU, debug `aien-cli` sha256 9704f29f..., sovereign-core 9b5e6e8 caller-asserted, omega 6c6180c). It ran `LIVE_ROWS="row1_ x1_ x2_ x3_ x4_"` (5 tests); rows 2-8, 10 and 11 passed against the same binary in an earlier unrecorded-by-this-gate run (14 of 14), not by this receipt. +## Fix-the-test slice + +`scripts/test-fix-the-test.sh` (also run at the end of `test-live-daemon.sh` unless `SKIP_SLICE=1`) is the +first product-shaped run on top of the live gate: an agent step fixes a deliberately failing test, and the +whole run is verified offline. + +``` +AIEN_BIN= OUT= scripts/test-fix-the-test.sh # one live row, about 8.5 min on CPU +``` + +The fixture `fixtures/fix_the_test/` is a tiny C project: `clamp()` returns `lo` where it must return `hi`, +so `make test` fails before the fix (GNU make exits 2 on a failing recipe; the gate requires non-zero) and +exits 0 after. `TASK.md` carries the task id and the exact test command; `solution/clamp.c` is harness +material (not copied into the task workspace). No binaries are committed. + +The live row `slice1_fix_the_test_lands_and_tests_pass` (`tests/compose_ledger.rs`, `#[ignore]`d) copies the +fixture to a workspace, `git init`s and commits it, runs `make test` (expected red), then drives a +SCRIPTED `write_file` proposal whose content is the corrected `src/clamp.c` through the existing adapter and +the daemon's `ComposeApprovedProposal` path (desk-key MAC, durable claim, grant, intent, ack), waits for +`DONE`, and runs `make test` again (expected green). `src/fix_the_test.rs` builds the task, source-pin and +`vac-test-run/1` records; the exporter retains them next to the daemon's ledger records, and the daemon's +raw `ComposeRecall` report, which since sovereign-core #346 says whether the compose library is native. +The gate then runs `provenance verify` and, on hard-linked copies, requires a named refusal for a changed +exit code, a swapped stdout digest, a wrong target blob, a dropped test run, a tampered source pin and a +forged native claim (`provenance/BINDING.md`, "Fix-the-test slice"). + +Expected verdict: `PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong +proposal=scripted_turn`; with a daemon that does not report `compose_native` it is `missing=link:model_turn,link:native` +(labelled, never complete). Never `PASS complete`: the model turn is scripted. + +What it proves: the approval is bound to the exact bytes written; the write went through the daemon's +ledger; the tests were run after the write and their output is retained and digest-checked; the source +pin matches the grant's `prior_sha256` (the bytes the daemon replaced are the bytes of the pinned commit's +file); the bundle's native claim agrees with the daemon's own report. + +What it does not prove: the model turn is scripted (no authorship claim); the records are unsigned exports, +so the verifier cannot tell an export from a hand-written file; the test run is harness evidence, not a +daemon effect (the daemon only writes, `bash_eval` stays `NOT_EXECUTED`); nothing ties the second test run +to the workspace state beyond the digest of the target file and the harness's own commit; the desk MAC for +`ComposeAuthorize` stays default-off (not changed here); CPU reference backend only. + +Recorded run: `evidence/fix-the-test-2026-10-08/` (receipt and the small bundle files; the 2.4 GB weights are +hard links in the original and are not copied). + ## Build and test ``` diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/COMPANION.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/COMPANION.json new file mode 100644 index 0000000..1f0c8f4 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/COMPANION.json @@ -0,0 +1,142 @@ +{ + "aien": { + "candidate_id": null, + "executable": "aien-cli", + "executable_sha256": "a62a88b4a33b3805c3a95e6b56755a53aeb5cee22c60731a0bd8aef2632ee476", + "native": { + "claimed": true, + "omega_sha": "6c6180cf378075b61291f4565d226eba38b4decd" + }, + "note": "no frozen AIEN candidate: no candidate_manifest record; CPU-reference backend as printed in the daemon log; whether the compose library was native-linked is reported only when the daemon returns compose_native (sovereign-core #346); aien.native then names it" + }, + "completeness": { + "missing": [ + "link:model_turn" + ], + "reason": "the INTERPLANE model turn is scripted by the test: nothing links this model to the effect's content", + "state": "incomplete" + }, + "effect": { + "approval_binding": "aien.approval.v2", + "binding": "aien-ledger-slice/1", + "proposal_origin": "scripted_turn" + }, + "export": { + "chat_template": null, + "format": "huggingface" + }, + "fixture": { + "class": "real", + "note": "Real daemon; the five ledger records are the daemon's own ComposeRecall output (pretty-printed only); daemon_run.json and the 3-message trace are written by the test harness, including their timestamps. The model turn is SCRIPTED by the test (the tool call is a test constant), so authorship of the proposal is not claimed; the model only loaded." + }, + "interplane": { + "request_id": "w1", + "trace_id": "ledger" + }, + "kind": "interplane-provenance-companion", + "lineage": { + "kind": "unknown_pretraining", + "origin": { + "model_id": "unsloth/Llama-3.2-1B-Instruct", + "model_id_source": "caller-asserted (AIEN_LEDGER_MODEL_ID or default; not checked against the model directory)", + "note": "weights as downloaded; no training evidence is held", + "revision": "5a8abab4a5d6f164389b1079fb721cfab8d7126c" + } + }, + "load_support": { + "declared": "supported_structural" + }, + "records": { + "aien_load_log": { + "bytes": 1554, + "path": "records/aien/daemon-load.log", + "sha256": "d1b50249ae6e5da030486e4cbd2fc87ff59d7f241a64d092829d25f1e2eeddfb" + }, + "compose_recall": { + "bytes": 12616, + "path": "records/aien/compose-recall.json", + "sha256": "c1b26938bd239fc38631c8ff39c2840393b329992ca70d4645dd3adc6f266b5e" + }, + "daemon_run": { + "bytes": 492, + "path": "records/aien/daemon-run.json", + "sha256": "af38f3db124ca5365679ec4209a87f95df654a4d055181a2227162005862682c" + }, + "export_config": { + "bytes": 894, + "path": "records/export/config.json", + "sha256": "dfb67fd8afe73a1c75245824ef9d64a6ba8983025447e3bf76aa1ea57ee46152" + }, + "export_tokenizer": { + "bytes": 17209920, + "path": "records/export/tokenizer.json", + "sha256": "6b9e4e7fb171f92fd137b777cc2714bf87d11576700a1dcd7a399e7bbe39537b" + }, + "export_weights": { + "bytes": 2471645608, + "path": "records/export/model.safetensors", + "sha256": "1ff795ff6a07e6a68085d206fb84417da2f083f68391c2843cd2b8ac6df8538f" + }, + "interplane_trace": { + "bytes": 6243, + "path": "records/interplane/trace.json", + "sha256": "53855bf5835fd87ccf9abdfbb1c2eadbbcc9738461db2ca70794dcc0e78ab32b" + }, + "ledger_ack": { + "bytes": 777, + "path": "records/aien/ledger-ack.json", + "sha256": "36e0fba19387b981e5f9a979a88e65842cb14c15207ada984ef00bd912f5c5e5" + }, + "ledger_claim": { + "bytes": 522, + "path": "records/aien/ledger-claim.json", + "sha256": "828e8b1645a29f6b134eeef792c23969515785df48739d6ac36baa2d87331fd3" + }, + "ledger_committed": { + "bytes": 482, + "path": "records/aien/ledger-committed.json", + "sha256": "0733d0b8a6ace38fb739faaee00b102347281873a1ebc580d877a09b9dca58cd" + }, + "ledger_grant": { + "bytes": 1211, + "path": "records/aien/ledger-grant.json", + "sha256": "c34f3eee1bc8614cff0942cae241f2de9c062c496a7967e75dd17c9f084bc35d" + }, + "ledger_intent": { + "bytes": 814, + "path": "records/aien/ledger-intent.json", + "sha256": "825170ebbc191d9e01210ae04d1b8f43e606e121efd72dcce09c4d3104097293" + }, + "source_pin": { + "bytes": 236, + "path": "records/task/source-pin.json", + "sha256": "257ca3d6e0066b87127c4d7621b987ef34a55017234db5387b54716270250917" + }, + "task": { + "bytes": 166, + "path": "records/task/task.json", + "sha256": "5b7c7e56ee4a9c27e43c4b1eaaa927b4dcb090640ba82ed3c1e53fbbc1f29737" + }, + "test_run_record": { + "bytes": 768, + "path": "records/task/test-run.json", + "sha256": "aed0dd53fae0fa7621d1c5580816e54fe2d6a8c222d06532c1a338bc895e95db" + }, + "test_stderr": { + "bytes": 0, + "path": "records/task/test-stderr.txt", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "test_stdout": { + "bytes": 164, + "path": "records/task/test-stdout.txt", + "sha256": "8138649dee23d7f8a22dfeae6a63398a1479cab6fbbd967f76ef87eaeda45ae1" + } + }, + "schema": 0, + "test_run": { + "binding": "vac-test-run/1", + "record": "test_run_record", + "task_id": "fix-the-test/clamp-1" + } +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/compose-recall.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/compose-recall.json new file mode 100644 index 0000000..677fa99 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/compose-recall.json @@ -0,0 +1,388 @@ +{ + "cited": [ + { + "cls": 6, + "digest": "23d4b0bd3a6272b27d53ee6c56ff191daeba910d2555fb9ea8f67751de1c4a26", + "id": 6, + "kind": 65554, + "links": [ + 0, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_submission\":\"accepted\",\"executor\":{\"pid\":827279,\"start\":20040999},\"request_id\":\"w1\",\"trace_id\":\"ledger\"}", + "verified": true + }, + { + "cls": 6, + "digest": "5f2f6a7c66cb7d8da77d20805079d92fd71c2e1c79578eeadef9c1065836cd2a", + "id": 7, + "kind": 65554, + "links": [ + 6, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approved_submission\":\"in_flight\",\"claim\":6}", + "verified": true + }, + { + "cls": 3, + "digest": "719cb8d50e277e27df6a19b2f5ad4ab762ce3f532117060a8707eec01eaf6b8a", + "id": 8, + "kind": 65537, + "links": [ + 0, + 0, + 0, + 0 + ], + "note": null, + "subject": 1, + "tag": 2, + "text": null, + "verified": true + }, + { + "cls": 4, + "digest": "74e25f31f4456c8d3ebb7c8da9dbe768ba728c2e410f7357064eea2e1211752e", + "id": 9, + "kind": 65540, + "links": [ + 8, + 1, + 5, + 0 + ], + "note": null, + "subject": 3, + "tag": 3, + "text": null, + "verified": true + }, + { + "cls": 4, + "digest": "97ef43281c511802e1e7121370f8d047488f1d9bca364e9f91e1761acf1ce501", + "id": 10, + "kind": 65540, + "links": [ + 8, + 1, + 5, + 0 + ], + "note": null, + "subject": 2, + "tag": 3, + "text": null, + "verified": true + }, + { + "cls": 4, + "digest": "58ea105df196e010c51316914978f3f7e5b07f49799acc9d3a53a89652b47d0e", + "id": 11, + "kind": 65540, + "links": [ + 10, + 1, + 2, + 3 + ], + "note": null, + "subject": 4, + "tag": 3, + "text": null, + "verified": true + }, + { + "cls": 4, + "digest": "9207185c6cfcd819417744ba72a39da7bf242b9a313842f76b579bc4a2346867", + "id": 12, + "kind": 65540, + "links": [ + 11, + 4, + 0, + 0 + ], + "note": null, + "subject": 5, + "tag": 3, + "text": null, + "verified": true + }, + { + "cls": 2, + "digest": "043fbac2837dd1e0f0e47f1355a5a575dde52ea509e7ee1224edb3eab407a588", + "id": 13, + "kind": 65553, + "links": [ + 10, + 8, + 0, + 0 + ], + "note": null, + "subject": 5, + "tag": 8, + "text": null, + "verified": true + }, + { + "cls": 2, + "digest": "222968a7aa806dfe4d65c25f738ea06e4c392708acdbc08b8ceb0143a1277fd9", + "id": 14, + "kind": 65553, + "links": [ + 9, + 8, + 0, + 0 + ], + "note": null, + "subject": 5, + "tag": 8, + "text": null, + "verified": true + }, + { + "cls": 6, + "digest": "9bb1125a05a32bdc6e8d61cbd358aa7c69bb0bcea1f55ca384d276fe49416a14", + "id": 15, + "kind": 65554, + "links": [ + 11, + 13, + 14, + 12 + ], + "note": null, + "subject": 5, + "tag": 8, + "text": null, + "verified": true + }, + { + "cls": 6, + "digest": "10f7374cbcb473352a3ec54bdaecb5ebd6e14dd329f2999f490374882d6bcd03", + "id": 16, + "kind": 65555, + "links": [ + 13, + 15, + 0, + 0 + ], + "note": null, + "subject": 5, + "tag": 0, + "text": null, + "verified": true + }, + { + "cls": 6, + "digest": "47a05a2a1b909b68d03f8329a9cdb9be2ab9838b5c3072d7c2d06e73ecb3baee", + "id": 17, + "kind": 65556, + "links": [ + 14, + 15, + 0, + 0 + ], + "note": null, + "subject": 5, + "tag": 1, + "text": null, + "verified": true + }, + { + "cls": 6, + "digest": "339ad321e5d73adb91269412a52c4ae2e4919b0ad2aebb4211471e8e05532163", + "id": 18, + "kind": 65554, + "links": [ + 6, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approved_submission\":\"committed\",\"claim\":6,\"evidence\":{\"compose_proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"cx_evidence\":15,\"cx_promotion\":16,\"task\":16572432152021077981}}", + "verified": true + }, + { + "cls": 6, + "digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "id": 19, + "kind": 65556, + "links": [ + 16, + 15, + 6, + 0 + ], + "note": "authorization", + "subject": 0, + "tag": 3, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_grant\":1,\"approved_proposal_sha256\":\"98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e\",\"approver\":\"drake\",\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"cx_evidence\":15,\"cx_promotion\":16,\"desk_key_id\":\"97c3b30524d50c9f\",\"path\":\"src/clamp.c\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"replay_claim\":6,\"request_id\":\"w1\",\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"trace_id\":\"ledger\",\"workspace\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws\"}", + "verified": true + }, + { + "cls": 6, + "digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "id": 20, + "kind": 65554, + "links": [ + 19, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor\":{\"pid\":827256,\"start\":20040993},\"path\":\"src/clamp.c\",\"phase\":\"intent\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"tool\":\"write_file\"}", + "verified": true + }, + { + "cls": 6, + "digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "id": 21, + "kind": 65554, + "links": [ + 20, + 19, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"disk_error\":null,\"disk_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor_reported\":{\"bytes\":176,\"error\":null,\"written_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\"},\"intent\":20,\"path\":\"src/clamp.c\",\"phase\":\"ack\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"state\":\"DONE\",\"tool\":\"write_file\"}", + "verified": true + } + ], + "compose_dir": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/compose", + "compose_native": true, + "host": [ + { + "cls": 6, + "digest": "23d4b0bd3a6272b27d53ee6c56ff191daeba910d2555fb9ea8f67751de1c4a26", + "id": 6, + "kind": 65554, + "links": [ + 0, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_submission\":\"accepted\",\"executor\":{\"pid\":827279,\"start\":20040999},\"request_id\":\"w1\",\"trace_id\":\"ledger\"}", + "verified": true + }, + { + "cls": 6, + "digest": "5f2f6a7c66cb7d8da77d20805079d92fd71c2e1c79578eeadef9c1065836cd2a", + "id": 7, + "kind": 65554, + "links": [ + 6, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approved_submission\":\"in_flight\",\"claim\":6}", + "verified": true + }, + { + "cls": 6, + "digest": "339ad321e5d73adb91269412a52c4ae2e4919b0ad2aebb4211471e8e05532163", + "id": 18, + "kind": 65554, + "links": [ + 6, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approved_submission\":\"committed\",\"claim\":6,\"evidence\":{\"compose_proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"cx_evidence\":15,\"cx_promotion\":16,\"task\":16572432152021077981}}", + "verified": true + }, + { + "cls": 6, + "digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "id": 19, + "kind": 65556, + "links": [ + 16, + 15, + 6, + 0 + ], + "note": "authorization", + "subject": 0, + "tag": 3, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_grant\":1,\"approved_proposal_sha256\":\"98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e\",\"approver\":\"drake\",\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"cx_evidence\":15,\"cx_promotion\":16,\"desk_key_id\":\"97c3b30524d50c9f\",\"path\":\"src/clamp.c\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"replay_claim\":6,\"request_id\":\"w1\",\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"trace_id\":\"ledger\",\"workspace\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws\"}", + "verified": true + }, + { + "cls": 6, + "digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "id": 20, + "kind": 65554, + "links": [ + 19, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor\":{\"pid\":827256,\"start\":20040993},\"path\":\"src/clamp.c\",\"phase\":\"intent\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"tool\":\"write_file\"}", + "verified": true + }, + { + "cls": 6, + "digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "id": 21, + "kind": 65554, + "links": [ + 20, + 19, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"disk_error\":null,\"disk_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor_reported\":{\"bytes\":176,\"error\":null,\"written_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\"},\"intent\":20,\"path\":\"src/clamp.c\",\"phase\":\"ack\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"state\":\"DONE\",\"tool\":\"write_file\"}", + "verified": true + } + ], + "machine_id": "ef3da1bb2ea3017674b603ee223617f7636e2b7cb6f9650092848f189532d5bc", + "missing": [], + "omega_sha": "6c6180cf378075b61291f4565d226eba38b4decd", + "prefix": null, + "prefix_digest": null, + "records_total": 21 +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-load.log b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-load.log new file mode 100644 index 0000000..739955b --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-load.log @@ -0,0 +1,15 @@ +⚡ Starting AIEN Sovereign Runtime Daemon... + KV pool: 8589934592 bytes (8.00 GiB) = 8192 blocks x 16 tokens x 16 layers x 8 kv heads x 64 head_dim x 2 (K,V) x 4 bytes; context 131072 tokens from model max_sequence_length (config.json max_position_embeddings) + KV pool memory check: needs 8589934592 bytes (8.00 GiB), MemAvailable 96630882304 bytes (89.99 GiB) + Backend: NativeTransformerBackend/CPU-reference (Omega GPU engine not linked, explicit fallback) + Model: checkpoint loaded from /home/drakestapleton/.cache/huggingface/hub/models--unsloth--Llama-3.2-1B-Instruct/snapshots/5a8abab4a5d6f164389b1079fb721cfab8d7126c/model.safetensors (tokenizer loaded, model_id=5a8abab4a5d6f164389b1079fb721cfab8d7126c, config=unsloth/Llama-3.2-1B-Instruct (config.json), model_sha256=1ff795ff6a07e6a68085d206fb84417da2f083f68391c2843cd2b8ac6df8538f, tokenizer_sha256=6b9e4e7fb171f92fd137b777cc2714bf87d11576700a1dcd7a399e7bbe39537b) + KV: one pooled KV shared by runtime and backend + Tokenizer: llama3 (Llama 3 instruct) chat template, stop ids [128001, 128008, 128009] +✓ Binding socket at /home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/aien.sock + Warm-up: 1 token in 21891 ms over 124 prompt tokens (discarded) +Authorize MAC: off (authorize is authenticated by the OS user only) +Compose: native (omega 6c6180cf378075b61291f4565d226eba38b4decd) +Reconcile: no compose home yet +Replay reconcile: no compose home yet +ALLEN: not engaged (AIEN_ALLEN_SUBJECT unset); no identity claim +Cortex mark: mark created for a new home (seq 1, records 5) diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-run.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-run.json new file mode 100644 index 0000000..62330ee --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/daemon-run.json @@ -0,0 +1,10 @@ +{ + "boot_id": "8ff5f413-7f55-4bfa-999b-a80f3145d5de", + "executable_sha256": "a62a88b4a33b3805c3a95e6b56755a53aeb5cee22c60731a0bd8aef2632ee476", + "kind": "aien-daemon-run", + "note": "written by the run harness from /proc//stat and the spawned child pid, not by the daemon", + "pid": 827279, + "socket": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/aien.sock", + "start_ticks": 20040999, + "workspace": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws" +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-ack.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-ack.json new file mode 100644 index 0000000..a548a22 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-ack.json @@ -0,0 +1,17 @@ +{ + "cls": 6, + "digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "id": 21, + "kind": 65554, + "links": [ + 20, + 19, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"disk_error\":null,\"disk_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor_reported\":{\"bytes\":176,\"error\":null,\"written_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\"},\"intent\":20,\"path\":\"src/clamp.c\",\"phase\":\"ack\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"state\":\"DONE\",\"tool\":\"write_file\"}", + "verified": true +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-claim.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-claim.json new file mode 100644 index 0000000..56df1f0 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-claim.json @@ -0,0 +1,17 @@ +{ + "cls": 6, + "digest": "23d4b0bd3a6272b27d53ee6c56ff191daeba910d2555fb9ea8f67751de1c4a26", + "id": 6, + "kind": 65554, + "links": [ + 0, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_submission\":\"accepted\",\"executor\":{\"pid\":827279,\"start\":20040999},\"request_id\":\"w1\",\"trace_id\":\"ledger\"}", + "verified": true +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-committed.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-committed.json new file mode 100644 index 0000000..2c5ce58 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-committed.json @@ -0,0 +1,17 @@ +{ + "cls": 6, + "digest": "339ad321e5d73adb91269412a52c4ae2e4919b0ad2aebb4211471e8e05532163", + "id": 18, + "kind": 65554, + "links": [ + 6, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"approved_submission\":\"committed\",\"claim\":6,\"evidence\":{\"compose_proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"cx_evidence\":15,\"cx_promotion\":16,\"task\":16572432152021077981}}", + "verified": true +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-grant.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-grant.json new file mode 100644 index 0000000..c2e2400 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-grant.json @@ -0,0 +1,17 @@ +{ + "cls": 6, + "digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "id": 19, + "kind": 65556, + "links": [ + 16, + 15, + 6, + 0 + ], + "note": "authorization", + "subject": 0, + "tag": 3, + "text": "{\"approval_id\":\"aien-approval:w1:8751637374eb2313\",\"approval_key\":\"52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469\",\"approved_grant\":1,\"approved_proposal_sha256\":\"98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e\",\"approver\":\"drake\",\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"cx_evidence\":15,\"cx_promotion\":16,\"desk_key_id\":\"97c3b30524d50c9f\",\"path\":\"src/clamp.c\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"replay_claim\":6,\"request_id\":\"w1\",\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"trace_id\":\"ledger\",\"workspace\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws\"}", + "verified": true +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-intent.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-intent.json new file mode 100644 index 0000000..c1cc50b --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/aien/ledger-intent.json @@ -0,0 +1,17 @@ +{ + "cls": 6, + "digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "id": 20, + "kind": 65554, + "links": [ + 19, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 4, + "text": "{\"authorization\":19,\"content_sha256\":\"95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2\",\"executor\":{\"pid\":827256,\"start\":20040993},\"path\":\"src/clamp.c\",\"phase\":\"intent\",\"prior_sha256\":\"a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7\",\"proposal_sha256\":\"e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6\",\"provenance\":{\"allen_agent\":\"none\",\"generation_record\":null},\"target\":\"/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c\",\"tool\":\"write_file\"}", + "verified": true +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/interplane/trace.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/interplane/trace.json new file mode 100644 index 0000000..3b34a27 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/interplane/trace.json @@ -0,0 +1,183 @@ +[ + { + "destination": { + "id": "aien", + "kind": "runtime" + }, + "interplane_version": "0.1", + "message_id": "m-1", + "payload": { + "arguments": { + "content": "#include \"clamp.h\"\n\n/* Limit v to the range lo..hi. */\nint clamp(int v, int lo, int hi)\n{\n if (v < lo)\n return lo;\n if (v > hi)\n return hi;\n return v;\n}\n", + "path": "src/clamp.c" + }, + "kind": "tool_request", + "provenance": { + "coercion": "none", + "dialect": "openai", + "dialect_version": "1", + "exposure": { + "floor": "user_supplied", + "inputs": [ + "in-user" + ] + }, + "model": "scripted", + "parser_version": "1.0.0", + "raw_name": "write_file", + "source_call_id": "w1", + "source_digest": "sha256:1e9e5223ddfe7245046fbb8fa2c79fc9af55cb353abe6015f6539572edd31c25", + "source_turn": 0 + }, + "request_id": "w1", + "tool": { + "name": "write_file", + "namespace": null + } + }, + "source": { + "id": "scripted-test-model", + "kind": "model" + }, + "timestamp": "2026-10-08T19:18:08Z", + "trace_id": "ledger" + }, + { + "destination": { + "id": "scripted-test-model", + "kind": "model" + }, + "interplane_version": "0.1", + "message_id": "m-2", + "parent_id": "m-1", + "payload": { + "data": null, + "decision": { + "approval": { + "approval_id": "aien-approval:w1:8751637374eb2313", + "expires_at": null, + "scope": "8751637374eb231383c0570c4371d23189da3e20eb24e510dba75a90b3520837" + }, + "authority": { + "decision_id": null, + "policy_engine": "aien-mcp.EffectClassAuthority", + "runtime": "aien" + }, + "capability": "write_file", + "constraints": [], + "decision": "requires_approval", + "kind": "decision", + "reason": "tool `write_file` needs approval (effect bits 0x8)", + "request_id": "w1", + "runtime_state": { + "values": [ + "effect_class=WorldMutation", + "staged=true", + "intent_digest=8751637374eb231383c0570c4371d23189da3e20eb24e510dba75a90b3520837" + ], + "vocabulary": "aien.effect_intent" + } + }, + "error": { + "code": "approval_required", + "message": "approval required: aien-approval:w1:8751637374eb2313", + "retryable": false + }, + "kind": "result", + "provenance": { + "capability": "write_file", + "content_kind": null, + "duration_ms": null, + "runtime": "aien", + "trust": null, + "trusted": null + }, + "request_id": "w1", + "status": "requires_approval" + }, + "source": { + "id": "aien", + "kind": "runtime" + }, + "timestamp": "2026-10-08T19:18:08Z", + "trace_id": "ledger" + }, + { + "destination": { + "id": "scripted-test-model", + "kind": "model" + }, + "interplane_version": "0.1", + "message_id": "m-3", + "parent_id": "m-1", + "payload": { + "data": { + "receipt": { + "ack_digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "ack_record_id": 21, + "approval_id": "aien-approval:w1:8751637374eb2313", + "approved_proposal_sha256": "98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e", + "approver": "drake", + "boundary": "boundary = authenticated daemon handoff (ComposeApprovedProposal: desk MAC, durable replay claim) -> compose verify + AEGIS -> J-Space branch -> World commit -> Cortex promotion/evidence -> daemon-written grant on compose_proposal_sha256 -> effect intent -> write -> ack; the production effect path, not WALDO provenance", + "compose_proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "content_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "disk_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "grant_digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "grant_id": 19, + "handoff": { + "aegis_pass_mask": 1, + "approval_key": "52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469", + "approved_grant": 19, + "branch_count": 1, + "committed": true, + "cx_evidence": 15, + "cx_goal": 8, + "cx_promotion": 16, + "desk_key_id": "97c3b30524d50c9f", + "grant_links": [ + 16, + 15 + ], + "outcome": 1, + "proposer": "hook:approved-proposal", + "record_digest": "65b38acf9f6dc9abcc37c1c789e63ea4b54cc95ef5fdddc874e00019dc396d35", + "replay_claim": 6, + "state": "COMMITTED", + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "task": 16572432152021077981, + "winner": 0, + "winner_digest": "82efa0fda8e8e23fc7efd966f24af79cfc8e850cee2e3e889d87bea6c68c6774" + }, + "intent_digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "intent_id": 20, + "path": "src/clamp.c", + "prior_sha256": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "request_id": "w1", + "state": "DONE", + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "trace_id": "ledger" + } + }, + "decision": null, + "error": null, + "kind": "result", + "provenance": { + "capability": "write_file", + "content_kind": "tool_result", + "duration_ms": 0, + "runtime": "aien", + "trust": "trusted_runtime", + "trusted": true + }, + "request_id": "w1", + "status": "ok" + }, + "source": { + "id": "aien", + "kind": "runtime" + }, + "timestamp": "2026-10-08T19:18:09Z", + "trace_id": "ledger" + } +] \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/source-pin.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/source-pin.json new file mode 100644 index 0000000..55316fa --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/source-pin.json @@ -0,0 +1,7 @@ +{ + "commit": "369834ec1b5921ca72fce87ba8382bbec1cd257d", + "kind": "vac-source-pin", + "repo": "fix_the_test", + "target_blob_sha256": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "target_path": "src/clamp.c" +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/task.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/task.json new file mode 100644 index 0000000..fbde89e --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/task.json @@ -0,0 +1,9 @@ +{ + "kind": "vac-task", + "repo_commit": "369834ec1b5921ca72fce87ba8382bbec1cd257d", + "task_id": "fix-the-test/clamp-1", + "test_cmd": [ + "make", + "test" + ] +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-run.json b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-run.json new file mode 100644 index 0000000..b78f1e0 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-run.json @@ -0,0 +1,22 @@ +{ + "argv": [ + "make", + "test" + ], + "before": { + "stderr_sha256": "dfd215f5f062b921624ca20eb2c4a6d18132ad1041617746436d6f206a462be8", + "stdout_sha256": "bcdeaeb942c4048972b25972c90b777ac1e17c801bb3e136d93e2bf9492ebef6" + }, + "cwd_rel": ".", + "duration_ms": 38, + "exit_code": 0, + "kind": "vac-test-run", + "started_unix_ms": 1791487089132, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_sha256": "8138649dee23d7f8a22dfeae6a63398a1479cab6fbbd967f76ef87eaeda45ae1", + "target_blob_sha256_after": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "task_id": "fix-the-test/clamp-1", + "test_exit_before": 2, + "tree_commit_after": "c11f474412427fe80db94a9b331876dc8ef67ba8", + "v": 1 +} \ No newline at end of file diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-stderr.txt b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-stdout.txt b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-stdout.txt new file mode 100644 index 0000000..7d28b10 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/bundle/records/task/test-stdout.txt @@ -0,0 +1,8 @@ +mkdir -p build +cc -Wall -Wextra -O0 -o build/test_clamp src/clamp.c test/test_clamp.c +./build/test_clamp +ok inside +ok below +ok above +ok at_low +ok at_high diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/negative-verdicts.txt b/adapters/aien/evidence/fix-the-test-2026-10-08/negative-verdicts.txt new file mode 100644 index 0000000..2c3dd8d --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/negative-verdicts.txt @@ -0,0 +1,7 @@ +control PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn +changed_exit_code FAIL test_run_mismatch: exit_code=1 (a fix must pass: exit 0) +swapped_stdout_digest FAIL test_run_mismatch: stdout_sha256 vs retained test_stdout +wrong_target_blob FAIL test_run_mismatch: target_blob_sha256_after vs ledger_ack.disk_sha256 +dropped_test_run FAIL test_run_missing: task/source_pin/test_run_record present but no test_run section +tampered_source_pin FAIL source_pin_mismatch: source_pin.target_blob_sha256 vs ledger_grant.prior_sha256 +forged_native FAIL native_claim_contradicted: claimed native but no compose_recall report with compose_native diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/receipt.json b/adapters/aien/evidence/fix-the-test-2026-10-08/receipt.json new file mode 100644 index 0000000..01baa39 --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/receipt.json @@ -0,0 +1,44 @@ +{ + "kind": "interplane-aien-fix-the-test-receipt", + "adapter_commit": "dbe608e135130aaa91b687fdc0ce99ea69b055b1", + "adapter_dirty": false, + "aien_cli_sha256": "a62a88b4a33b3805c3a95e6b56755a53aeb5cee22c60731a0bd8aef2632ee476", + "verifier_sha256": "f4a0385dd9ba739f03affe2ff1dceeda06bd87a064a41aaaf09310049fb315aa", + "sovereign_core_rev": "47f1014a1aa0cf54b732132c6958bc142e91c20b", + "omega_lock": "6c6180cf378075b61291f4565d226eba38b4decd", + "backend": "CPU reference (as printed in the daemon log)", + "task": { + "task_id": "fix-the-test/clamp-1", + "source_commit": "369834ec1b5921ca72fce87ba8382bbec1cd257d", + "tree_commit_after": "c11f474412427fe80db94a9b331876dc8ef67ba8", + "test_exit_before": 2, + "test_exit_after": 0, + "target_blob_sha256_before": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "target_blob_sha256_after": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2" + }, + "native": { + "claimed": true, + "omega_sha": "6c6180cf378075b61291f4565d226eba38b4decd" + }, + "native_label": "proven: daemon reports compose_native=true and the verifier checked the retained report", + "verdict": "PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn", + "bundle_companion_sha256": "f5b553b5b8026527f7bdc768f1d39cbe778ae751f314fa49e191f2c221ba11aa", + "negative_checks": [ + "control PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn", + "changed_exit_code FAIL test_run_mismatch: exit_code=1 (a fix must pass: exit 0)", + "swapped_stdout_digest FAIL test_run_mismatch: stdout_sha256 vs retained test_stdout", + "wrong_target_blob FAIL test_run_mismatch: target_blob_sha256_after vs ledger_ack.disk_sha256", + "dropped_test_run FAIL test_run_missing: task/source_pin/test_run_record present but no test_run section", + "tampered_source_pin FAIL source_pin_mismatch: source_pin.target_blob_sha256 vs ledger_grant.prior_sha256", + "forged_native FAIL native_claim_contradicted: claimed native but no compose_recall report with compose_native" + ], + "started": "2026-10-08T19:11:39Z", + "finished": "2026-10-08T19:20:49Z", + "limits": [ + "the model turn is scripted: proposal authorship is not claimed", + "the test run is harness evidence, not a daemon effect; the daemon only wrote the file", + "records are unsigned exports; the verifier cannot tell an export from a hand-written file", + "desk MAC for ComposeAuthorize stays default-off (not changed here)", + "make exits 2 (not 1) on a failing recipe: the gate requires non-zero before and 0 after" + ] +} diff --git a/adapters/aien/evidence/fix-the-test-2026-10-08/row-receipt.json b/adapters/aien/evidence/fix-the-test-2026-10-08/row-receipt.json new file mode 100644 index 0000000..d440cce --- /dev/null +++ b/adapters/aien/evidence/fix-the-test-2026-10-08/row-receipt.json @@ -0,0 +1,147 @@ +{ + "boundary": "boundary = authenticated daemon handoff (ComposeApprovedProposal: desk MAC, durable replay claim) -> compose verify + AEGIS -> J-Space branch -> World commit -> Cortex promotion/evidence -> daemon-written grant on compose_proposal_sha256 -> effect intent -> write -> ack; the production effect path, not WALDO provenance", + "daemon": { + "aien_bin": "/home/drakestapleton/workspace/vac/aien-cli-m3b", + "home": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/compose", + "log": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/daemon.log", + "start_ms": 389197 + }, + "journal": [ + { + "digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "id": 19, + "note": "authorization", + "text": { + "approval_id": "aien-approval:w1:8751637374eb2313", + "approval_key": "52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469", + "approved_grant": 1, + "approved_proposal_sha256": "98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e", + "approver": "drake", + "content_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "cx_evidence": 15, + "cx_promotion": 16, + "desk_key_id": "97c3b30524d50c9f", + "path": "src/clamp.c", + "prior_sha256": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "provenance": { + "allen_agent": "none", + "generation_record": null + }, + "replay_claim": 6, + "request_id": "w1", + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "trace_id": "ledger", + "workspace": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws" + }, + "verified": true + }, + { + "digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "id": 20, + "note": "effect", + "text": { + "authorization": 19, + "content_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "executor": { + "pid": 827256, + "start": 20040993 + }, + "path": "src/clamp.c", + "phase": "intent", + "prior_sha256": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "provenance": { + "allen_agent": "none", + "generation_record": null + }, + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "tool": "write_file" + }, + "verified": true + }, + { + "digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "id": 21, + "note": "effect", + "text": { + "authorization": 19, + "content_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "disk_error": null, + "disk_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "executor_reported": { + "bytes": 176, + "error": null, + "written_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2" + }, + "intent": 20, + "path": "src/clamp.c", + "phase": "ack", + "provenance": { + "allen_agent": "none", + "generation_record": null + }, + "state": "DONE", + "tool": "write_file" + }, + "verified": true + } + ], + "receipt": { + "ack_digest": "bb08f949b357f04ec5efa74d9dad283e081bb6a97a05ba0f020fd5245e394602", + "ack_record_id": 21, + "approval_id": "aien-approval:w1:8751637374eb2313", + "approved_proposal_sha256": "98bb5ec47ff537fa6cc27dccad702b86c4c3bbd409fedd65ad48099035ff963e", + "approver": "drake", + "boundary": "boundary = authenticated daemon handoff (ComposeApprovedProposal: desk MAC, durable replay claim) -> compose verify + AEGIS -> J-Space branch -> World commit -> Cortex promotion/evidence -> daemon-written grant on compose_proposal_sha256 -> effect intent -> write -> ack; the production effect path, not WALDO provenance", + "compose_proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "content_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "disk_sha256": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "grant_digest": "a82c2d448a007544aef7eaf355a35ebdad9380bdbd7e52ab84cb40d17bcfb218", + "grant_id": 19, + "handoff": { + "aegis_pass_mask": 1, + "approval_key": "52c3fbd9b07eb9a8df015eff2cb1712c791a7098302e1dfcd1c2c19b79fd6469", + "approved_grant": 19, + "branch_count": 1, + "committed": true, + "cx_evidence": 15, + "cx_goal": 8, + "cx_promotion": 16, + "desk_key_id": "97c3b30524d50c9f", + "grant_links": [ + 16, + 15 + ], + "outcome": 1, + "proposer": "hook:approved-proposal", + "record_digest": "65b38acf9f6dc9abcc37c1c789e63ea4b54cc95ef5fdddc874e00019dc396d35", + "replay_claim": 6, + "state": "COMMITTED", + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "task": 16572432152021077981, + "winner": 0, + "winner_digest": "82efa0fda8e8e23fc7efd966f24af79cfc8e850cee2e3e889d87bea6c68c6774" + }, + "intent_digest": "05b14a8884539827a708c31fc6fcdedcfc1205d75c06df515763a168950e5f71", + "intent_id": 20, + "path": "src/clamp.c", + "prior_sha256": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "proposal_sha256": "e3f48e7e932952d3c7016a3751837d37a81f84f39dced24d6bd89ddd6afc3be6", + "request_id": "w1", + "state": "DONE", + "target": "/home/drakestapleton/handoffs/vac/M3b-slice-out/rows/slice1/ws/src/clamp.c", + "trace_id": "ledger" + }, + "records_after": 21, + "records_before": 5, + "row": "slice1", + "source_commit": "369834ec1b5921ca72fce87ba8382bbec1cd257d", + "target_blob_sha256_after": "95bdc0c9571d94ecf70cfbef4ab2e34a499876f1839f0ca084be9941ae6536a2", + "target_blob_sha256_before": "a13f814d50eb8ab97531f19a22726034ef3347ef233f8385863b397bf236a8f7", + "task_id": "fix-the-test/clamp-1", + "test_exit_after": 0, + "test_exit_before": 2, + "tree_commit_after": "c11f474412427fe80db94a9b331876dc8ef67ba8", + "verdict": "PASS" +} \ No newline at end of file diff --git a/adapters/aien/fixtures/fix_the_test/.gitignore b/adapters/aien/fixtures/fix_the_test/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/adapters/aien/fixtures/fix_the_test/Makefile b/adapters/aien/fixtures/fix_the_test/Makefile new file mode 100644 index 0000000..3813938 --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/Makefile @@ -0,0 +1,13 @@ +CC ?= cc +CFLAGS ?= -Wall -Wextra -O0 + +build/test_clamp: src/clamp.c src/clamp.h test/test_clamp.c + mkdir -p build + $(CC) $(CFLAGS) -o $@ src/clamp.c test/test_clamp.c + +.PHONY: test clean +test: build/test_clamp + ./build/test_clamp + +clean: + rm -rf build diff --git a/adapters/aien/fixtures/fix_the_test/TASK.md b/adapters/aien/fixtures/fix_the_test/TASK.md new file mode 100644 index 0000000..68d8d1c --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/TASK.md @@ -0,0 +1,11 @@ +# Task: fix the failing test + +task_id: fix-the-test/clamp-1 +test_command: make test +target_file: src/clamp.c + +`make test` exits non-zero (GNU make reports 2 for a failing recipe) because `clamp()` returns `lo` where it must return `hi` when the value is +above the range. Fix `src/clamp.c` (replace the whole file). The test must not be edited. + +The scripted run proposes `solution/clamp.c` as the whole new `src/clamp.c`. `solution/` is +harness material: it is not copied into the task workspace. diff --git a/adapters/aien/fixtures/fix_the_test/solution/clamp.c b/adapters/aien/fixtures/fix_the_test/solution/clamp.c new file mode 100644 index 0000000..4ecef61 --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/solution/clamp.c @@ -0,0 +1,11 @@ +#include "clamp.h" + +/* Limit v to the range lo..hi. */ +int clamp(int v, int lo, int hi) +{ + if (v < lo) + return lo; + if (v > hi) + return hi; + return v; +} diff --git a/adapters/aien/fixtures/fix_the_test/src/clamp.c b/adapters/aien/fixtures/fix_the_test/src/clamp.c new file mode 100644 index 0000000..374e6e2 --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/src/clamp.c @@ -0,0 +1,11 @@ +#include "clamp.h" + +/* Limit v to the range lo..hi. */ +int clamp(int v, int lo, int hi) +{ + if (v < lo) + return lo; + if (v > hi) + return lo; + return v; +} diff --git a/adapters/aien/fixtures/fix_the_test/src/clamp.h b/adapters/aien/fixtures/fix_the_test/src/clamp.h new file mode 100644 index 0000000..21958aa --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/src/clamp.h @@ -0,0 +1,4 @@ +#ifndef CLAMP_H +#define CLAMP_H +int clamp(int v, int lo, int hi); +#endif diff --git a/adapters/aien/fixtures/fix_the_test/test/test_clamp.c b/adapters/aien/fixtures/fix_the_test/test/test_clamp.c new file mode 100644 index 0000000..a8b832d --- /dev/null +++ b/adapters/aien/fixtures/fix_the_test/test/test_clamp.c @@ -0,0 +1,24 @@ +#include +#include "../src/clamp.h" + +static int failures; + +static void check(const char *name, int got, int want) +{ + if (got != want) { + printf("FAIL %s: got %d, want %d\n", name, got, want); + failures++; + } else { + printf("ok %s\n", name); + } +} + +int main(void) +{ + check("inside", clamp(5, 0, 10), 5); + check("below", clamp(-3, 0, 10), 0); + check("above", clamp(42, 0, 10), 10); + check("at_low", clamp(0, 0, 10), 0); + check("at_high", clamp(10, 0, 10), 10); + return failures ? 1 : 0; +} diff --git a/adapters/aien/scripts/test-fix-the-test.sh b/adapters/aien/scripts/test-fix-the-test.sh new file mode 100755 index 0000000..3f98184 --- /dev/null +++ b/adapters/aien/scripts/test-fix-the-test.sh @@ -0,0 +1,146 @@ +#!/usr/bin/env bash +# Fix-the-test slice gate (VAC M3b) for the INTERPLANE AIEN adapter. +# +# Runs the live row `slice1_fix_the_test_lands_and_tests_pass` against a real `aien-cli daemon` +# (~6.5 min on the CPU reference backend): the fixture's `make test` fails, a SCRIPTED proposal +# carrying the corrected file goes through the daemon's approved ledger, `make test` passes. The +# exported bundle is then judged by the offline provenance verifier and tampered copies must each +# be refused with their specific code. It cannot pass vacuously: a missing row, a failed test, a +# missing bundle or an unexpected verdict fails it. +# +# Expected verdict for a scripted run (never `PASS complete`, the model turn is scripted): +# daemon reports compose_native (sovereign-core #346 or later): +# PASS_LABELLED_INCOMPLETE missing=link:model_turn effect=aien-ledger-slice/1:strong proposal=scripted_turn +# daemon without the field (older build): the same with missing=link:model_turn,link:native +# +# Inputs (environment): AIEN_BIN (required), OUT (required, fresh), AIEN_LEDGER_MODEL_DIR (default: +# the unsloth Llama-3.2-1B-Instruct snapshot), SOVEREIGN_CORE_REV (caller-asserted), OMEGA_LOCK_REV. +# No process is killed here; the daemon is the test's own. +set -euo pipefail + +here="$(cd "$(dirname "$0")" && pwd)" +adapter="$(cd "$here/.." && pwd)" +repo="$(cd "$adapter/../.." && pwd)" +die() { echo "SLICE GATE FAIL: $*" >&2; exit 1; } + +: "${AIEN_BIN:?AIEN_BIN must name the aien-cli binary}" +: "${OUT:?OUT must name the output directory}" +[ -x "$AIEN_BIN" ] || die "AIEN_BIN not executable: $AIEN_BIN" +command -v jq >/dev/null || die "jq is required" +command -v make >/dev/null || die "make is required" +model_dir="${AIEN_LEDGER_MODEL_DIR:-$HOME/.cache/huggingface/hub/models--unsloth--Llama-3.2-1B-Instruct/snapshots/5a8abab4a5d6f164389b1079fb721cfab8d7126c}" +for f in model.safetensors tokenizer.json config.json; do + [ -f "$model_dir/$f" ] || die "model dir lacks $f: $model_dir" +done +if command -v quietlock >/dev/null && ! quietlock check >/dev/null 2>&1; then + die "quiet flag is held (quietlock check): no long run now" +fi +mkdir -p "$OUT" +OUT="$(cd "$OUT" && pwd)" +[ ! -e "$OUT/rows" ] || die "$OUT/rows exists: use a fresh OUT (a sealed run is never overwritten)" +started="$(date -u +%FT%TZ)" + +# 1. The live row. +log="$OUT/live.log" +set +e +(cd "$adapter" && AIEN_BIN="$AIEN_BIN" AIEN_LEDGER_MODEL_DIR="$model_dir" LEDGER_OUT="$OUT/rows" \ + cargo test --locked --test compose_ledger -- --ignored --test-threads=1 slice1_) >"$log" 2>&1 +rc=$? +set -e +[ "$rc" -eq 0 ] || { tail -5 "$log" >&2; die "live row exited $rc (log $log)"; } +grep -q '^test slice1_fix_the_test_lands_and_tests_pass \.\.\. ok$' "$log" || die "the slice row did not run and pass" +[ "$(grep -c '^test .* \.\.\. FAILED$' "$log" || true)" -eq 0 ] || die "a live test failed" + +# 2. The verifier on the exported bundle. +bundle="$OUT/rows/slice1/bundle" +[ -f "$bundle/COMPANION.json" ] || die "the row exported no bundle: $bundle/COMPANION.json" +verify() { (cd "$repo/provenance" && cargo run -q --locked --release -- verify "$1" 2>&1 || true) | tail -1; } +strong="effect=aien-ledger-slice/1:strong proposal=scripted_turn" +native_claimed="$(jq -r '.aien.native.claimed // "absent"' "$bundle/COMPANION.json")" +case "$native_claimed" in + true) want="PASS_LABELLED_INCOMPLETE missing=link:model_turn $strong"; native_label="proven: daemon reports compose_native=true and the verifier checked the retained report";; + false) want="PASS_LABELLED_INCOMPLETE missing=link:model_turn,link:native $strong"; native_label="link:native missing: the daemon reports a STUB compose library";; + absent) want="PASS_LABELLED_INCOMPLETE missing=link:model_turn,link:native $strong"; native_label="link:native missing: this daemon build does not report compose_native";; + *) die "unreadable aien.native.claimed: $native_claimed";; +esac +verdict="$(verify "$bundle")" +[ "$verdict" = "$want" ] || die "unexpected verdict on the slice bundle: $verdict (wanted: $want)" +before_exit="$(jq -r .test_exit_before "$OUT/rows/slice1/receipt.json")" +after_exit="$(jq -r .test_exit_after "$OUT/rows/slice1/receipt.json")" +[ "$before_exit" != "0" ] && [ "$before_exit" != "null" ] || die "test exit before the fix was $before_exit (must be non-zero)" +[ "$after_exit" = "0" ] || die "test exit after the fix was $after_exit (must be 0)" + +# 3. Tamper checks on hard-linked copies (a changed file is always written fresh, never in place). +neg="$OUT/negative" +mkdir -p "$neg" +fork() { rm -rf "$neg/$1"; cp -al "$bundle" "$neg/$1"; } +manifest() { # bundle jq-filter [jq args...]: rewrite COMPANION.json + local d="$1" f="$2"; shift 2 + jq "$@" "$f" "$d/COMPANION.json" >"$d/COMPANION.tmp" && mv "$d/COMPANION.tmp" "$d/COMPANION.json" +} +recpath() { jq -r ".records.$2.path" "$1/COMPANION.json"; } +restamp() { # bundle record: set the manifest's sha256 and size to the file as it is now + local d="$1" n="$2" p; p="$(recpath "$d" "$n")" + manifest "$d" '.records[$n].sha256=$s | .records[$n].bytes=$b' --arg n "$n" \ + --arg s "$(sha256sum "$d/$p" | cut -d' ' -f1)" --argjson b "$(wc -c <"$d/$p")" +} +editrec() { # bundle record jq-filter [jq args...]: edit a JSON record as a fresh file, restamp + local d="$1" n="$2" f="$3" p; shift 3; p="$(recpath "$d" "$n")" + jq "$@" "$f" "$d/$p" >"$d/$p.new"; rm "$d/$p"; mv "$d/$p.new" "$d/$p" + restamp "$d" "$n" +} +expect() { # name bundle code + local v; v="$(verify "$2")" + case "$v" in "FAIL $3:"*) echo "negative $1: $v";; *) die "negative $1: wanted FAIL $3, got: $v";; esac + echo "$1 $v" >>"$neg/verdicts.txt" +} +: >"$neg/verdicts.txt" +fork control +[ "$(verify "$neg/control")" = "$verdict" ] || die "negative control: an untouched copy no longer verifies" +echo "control $verdict" >>"$neg/verdicts.txt" +other="9999999999999999999999999999999999999999999999999999999999999999" +fork exit_code; editrec "$neg/exit_code" test_run_record '.exit_code = 1'; expect changed_exit_code "$neg/exit_code" test_run_mismatch +fork stdout_digest; editrec "$neg/stdout_digest" test_run_record '.stdout_sha256 = $o' --arg o "$other"; expect swapped_stdout_digest "$neg/stdout_digest" test_run_mismatch +fork blob_after; editrec "$neg/blob_after" test_run_record '.target_blob_sha256_after = $o' --arg o "$other"; expect wrong_target_blob "$neg/blob_after" test_run_mismatch +fork dropped; manifest "$neg/dropped" 'del(.test_run)'; expect dropped_test_run "$neg/dropped" test_run_missing +fork pin; editrec "$neg/pin" source_pin '.target_blob_sha256 = $o' --arg o "$other"; expect tampered_source_pin "$neg/pin" source_pin_mismatch +fork forged_native +if [ "$native_claimed" = "true" ]; then + # a native claim whose evidence (the retained ComposeRecall report) is removed + manifest "$neg/forged_native" 'del(.records.compose_recall)' +else + # native:true asserted over a stub or absent recall report, with the missing-label edited to match + manifest "$neg/forged_native" '.aien.native = {claimed: true, omega_sha: "6c6180cf378075b61291f4565d226eba38b4decd"} | .completeness.missing -= ["link:native"]' +fi +expect forged_native "$neg/forged_native" native_claim_contradicted + +# 4. Receipt. +finished="$(date -u +%FT%TZ)" +omega="${OMEGA_LOCK_REV:-}" +if [ -z "$omega" ] && [ -n "${AIEN_OMEGA_COMPOSE_DIR:-}" ]; then + omega="$(git -C "$AIEN_OMEGA_COMPOSE_DIR" rev-parse HEAD 2>/dev/null || true)" +fi +dirty=false; [ -z "$(git -C "$repo" status --porcelain -- adapters provenance 2>/dev/null)" ] || dirty=true +jq -n \ + --arg adapter_commit "$(git -C "$repo" rev-parse HEAD)" --argjson adapter_dirty "$dirty" \ + --arg bin_sha "$(sha256sum "$AIEN_BIN" | cut -d' ' -f1)" \ + --arg verifier_sha "$(sha256sum "${CARGO_TARGET_DIR:-$repo/provenance/target}/release/interplane-provenance" 2>/dev/null | cut -d' ' -f1)" \ + --arg sc_rev "${SOVEREIGN_CORE_REV:-UNVERIFIED}" --arg omega "${omega:-UNVERIFIED}" \ + --arg verdict "$verdict" --arg native_label "$native_label" \ + --argjson run "$(jq '{task_id, source_commit, tree_commit_after, test_exit_before, test_exit_after, target_blob_sha256_before, target_blob_sha256_after}' "$OUT/rows/slice1/receipt.json")" \ + --argjson native "$(jq '.aien.native // null' "$bundle/COMPANION.json")" \ + --arg companion_sha "$(sha256sum "$bundle/COMPANION.json" | cut -d' ' -f1)" \ + --arg negatives "$(cat "$neg/verdicts.txt")" --arg started "$started" --arg finished "$finished" \ + '{kind: "interplane-aien-fix-the-test-receipt", adapter_commit: $adapter_commit, adapter_dirty: $adapter_dirty, + aien_cli_sha256: $bin_sha, verifier_sha256: $verifier_sha, sovereign_core_rev: $sc_rev, + omega_lock: $omega, backend: "CPU reference (as printed in the daemon log)", + task: $run, native: $native, native_label: $native_label, + verdict: $verdict, bundle_companion_sha256: $companion_sha, + negative_checks: ($negatives | split("\n") | map(select(length>0))), + started: $started, finished: $finished, + limits: ["the model turn is scripted: proposal authorship is not claimed", + "the test run is harness evidence, not a daemon effect; the daemon only wrote the file", + "records are unsigned exports; the verifier cannot tell an export from a hand-written file", + "desk MAC for ComposeAuthorize stays default-off (not changed here)", + "make exits 2 (not 1) on a failing recipe: the gate requires non-zero before and 0 after"]}' >"$OUT/receipt.json" +echo "SLICE GATE PASS: verdict: $verdict; receipt $OUT/receipt.json" diff --git a/adapters/aien/scripts/test-live-daemon.sh b/adapters/aien/scripts/test-live-daemon.sh index 9090bdd..ed49bc9 100755 --- a/adapters/aien/scripts/test-live-daemon.sh +++ b/adapters/aien/scripts/test-live-daemon.sh @@ -19,6 +19,7 @@ # recorded as caller-asserted (default UNVERIFIED) # OMEGA_LOCK_REV omega revision of the linked compose library; default: git rev-parse of # $AIEN_OMEGA_COMPOSE_DIR when set, else UNVERIFIED +# SKIP_SLICE 1: do not run the fix-the-test slice gate (scripts/test-fix-the-test.sh) at the end # CARGO_TARGET_DIR build dir # Exit 0 only when every check passed. No process is killed here; the daemons are the tests' own. set -euo pipefail @@ -52,10 +53,12 @@ if [ -n "$rows" ]; then fi # 1. The live tests. +# The fix-the-test slice row has its own gate (step 5); with no LIVE_ROWS filter it is skipped here. +skip_slice=""; [ -n "$rows" ] || skip_slice="--skip slice1_" log="$OUT/live.log" set +e (cd "$adapter" && AIEN_BIN="$AIEN_BIN" AIEN_LEDGER_MODEL_DIR="$model_dir" LEDGER_OUT="$OUT/rows" \ - cargo test --locked --test compose_ledger --test compose_ledger_attacks -- --ignored --test-threads=1 $rows) >"$log" 2>&1 + cargo test --locked --test compose_ledger --test compose_ledger_attacks -- --ignored --test-threads=1 $skip_slice $rows) >"$log" 2>&1 test_rc=$? set -e [ "$test_rc" -eq 0 ] || { tail -5 "$log" >&2; die "live tests exited $test_rc (log $log)"; } @@ -156,4 +159,8 @@ jq -n \ "desk MAC for ComposeAuthorize stays default-off (not changed here)", "native compose library linking is not reported by the daemon", "the model turn is scripted: proposal authorship is not claimed"]}' >"$OUT/receipt.json" +# 5. The fix-the-test slice (scripts/test-fix-the-test.sh): its own live row, bundle verdict, tamper checks and receipt. +if [ "${SKIP_SLICE:-0}" != "1" ]; then + OUT="$OUT/slice" "$here/test-fix-the-test.sh" || die "fix-the-test slice gate failed (set SKIP_SLICE=1 to run without it)" +fi echo "GATE PASS: $passed live tests, verdict: $verdict; receipt $OUT/receipt.json" diff --git a/adapters/aien/src/fix_the_test.rs b/adapters/aien/src/fix_the_test.rs new file mode 100644 index 0000000..2dc1133 --- /dev/null +++ b/adapters/aien/src/fix_the_test.rs @@ -0,0 +1,259 @@ +//! Harness side of the fix-the-test slice (VAC M3b): prepare a task workspace from the fixture, +//! run the task's test command, and build the retained records the provenance verifier checks +//! (`vac-task`, `vac-source-pin`, `vac-test-run/1`). Specification: provenance/BINDING.md. +//! +//! These records are HARNESS evidence. The AIEN daemon only writes the file; it does not run the +//! tests, so a test run is not a daemon effect and the records are unsigned exports. Nothing here +//! grants, approves or decides anything. +use crate::provenance_export::sha256_hex; +use serde_json::{json, Value}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +/// The file the scripted proposal replaces. +pub const TARGET: &str = "src/clamp.c"; + +/// A task workspace under git, before the fix. +#[derive(Debug, Clone)] +pub struct Prepared { + pub ws: PathBuf, + pub task_id: String, + pub argv: Vec, + /// Commit of the buggy tree. + pub commit: String, + /// SHA-256 of the buggy `src/clamp.c` (what the grant's `prior_sha256` must equal). + pub target_blob_sha256: String, + /// The corrected whole file the scripted proposal writes. + pub solution: String, +} + +/// What one run of the test command did. +#[derive(Debug, Clone)] +pub struct TestOutcome { + pub exit_code: i32, + pub stdout: Vec, + pub stderr: Vec, + pub started_unix_ms: u128, + pub duration_ms: u128, +} + +fn git(ws: &Path, args: &[&str]) -> Result { + let out = Command::new("git") + .arg("-C") + .arg(ws) + .args([ + "-c", + "user.name=vac-harness", + "-c", + "user.email=vac-harness@example.invalid", + ]) + .args(["-c", "commit.gpgsign=false"]) + .args(args) + .output() + .map_err(|e| format!("git {args:?}: {e}"))?; + if !out.status.success() { + return Err(format!( + "git {args:?}: {}", + String::from_utf8_lossy(&out.stderr) + )); + } + Ok(String::from_utf8_lossy(&out.stdout).trim().to_string()) +} + +fn copy_tree(from: &Path, to: &Path, skip: &[&str]) -> Result<(), String> { + std::fs::create_dir_all(to).map_err(|e| e.to_string())?; + for e in std::fs::read_dir(from).map_err(|e| format!("{}: {e}", from.display()))? { + let e = e.map_err(|e| e.to_string())?; + let name = e.file_name().to_string_lossy().into_owned(); + if skip.contains(&name.as_str()) { + continue; + } + let dst = to.join(&name); + if e.file_type().map_err(|e| e.to_string())?.is_dir() { + copy_tree(&e.path(), &dst, &[])?; + } else { + std::fs::copy(e.path(), &dst).map_err(|e| e.to_string())?; + } + } + Ok(()) +} + +/// `task_id: x` and `test_command: a b c` lines of `TASK.md`. +fn parse_task(md: &str) -> Result<(String, Vec), String> { + let field = |k: &str| { + md.lines() + .find_map(|l| l.strip_prefix(k).map(|v| v.trim().to_string())) + .filter(|v| !v.is_empty()) + .ok_or_else(|| format!("TASK.md has no {k}")) + }; + let argv: Vec = field("test_command:")? + .split_whitespace() + .map(str::to_string) + .collect(); + Ok((field("task_id:")?, argv)) +} + +/// Copy `fixture` (without `solution/` and `build/`) into `ws`, `git init` and commit it. +pub fn prepare(fixture: &Path, ws: &Path) -> Result { + let (task_id, argv) = parse_task( + &std::fs::read_to_string(fixture.join("TASK.md")).map_err(|e| format!("TASK.md: {e}"))?, + )?; + let solution = std::fs::read_to_string(fixture.join("solution/clamp.c")) + .map_err(|e| format!("solution/clamp.c: {e}"))?; + copy_tree(fixture, ws, &["solution", "build"])?; + git(ws, &["init", "-q"])?; + git(ws, &["add", "-A"])?; + git(ws, &["commit", "-q", "-m", "task start: failing test"])?; + let commit = git(ws, &["rev-parse", "HEAD"])?; + let buggy = std::fs::read(ws.join(TARGET)).map_err(|e| e.to_string())?; + Ok(Prepared { + ws: ws.to_path_buf(), + task_id, + argv, + commit, + target_blob_sha256: sha256_hex(&buggy), + solution, + }) +} + +/// Run the task's test command in the workspace and keep exactly what it printed. +pub fn run_tests(p: &Prepared) -> Result { + let started = std::time::SystemTime::now(); + let t0 = std::time::Instant::now(); + let out = Command::new(&p.argv[0]) + .args(&p.argv[1..]) + .current_dir(&p.ws) + .output() + .map_err(|e| format!("{:?}: {e}", p.argv))?; + Ok(TestOutcome { + exit_code: out.status.code().unwrap_or(-1), + stdout: out.stdout, + stderr: out.stderr, + started_unix_ms: started + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis()) + .unwrap_or(0), + duration_ms: t0.elapsed().as_millis(), + }) +} + +/// The records of one finished fix-the-test run. +#[derive(Debug, Clone)] +pub struct TestRunEvidence { + pub task: Value, + pub source_pin: Value, + pub test_run: Value, + pub stdout: Vec, + pub stderr: Vec, + pub task_id: String, + /// The test exit codes the harness saw. + pub exit_before: i32, + pub exit_after: i32, + pub tree_commit_after: String, +} + +/// Commit the fixed tree and build the three records. `before` ran before the proposal, `after` +/// after the daemon's ack; `blob_after` is the digest of the file as the test saw it. +pub fn evidence( + p: &Prepared, + before: &TestOutcome, + after: &TestOutcome, +) -> Result { + git(&p.ws, &["add", "-A"])?; + git( + &p.ws, + &[ + "commit", + "-q", + "-m", + "scripted fix applied through the daemon ledger", + ], + )?; + let tree_commit_after = git(&p.ws, &["rev-parse", "HEAD"])?; + let blob_after = sha256_hex(&std::fs::read(p.ws.join(TARGET)).map_err(|e| e.to_string())?); + let task = json!({"kind": "vac-task", "task_id": p.task_id, "repo_commit": p.commit, + "test_cmd": p.argv}); + let source_pin = json!({"kind": "vac-source-pin", "repo": "fix_the_test", "commit": p.commit, + "target_path": TARGET, "target_blob_sha256": p.target_blob_sha256}); + let test_run = json!({"kind": "vac-test-run", "v": 1, "task_id": p.task_id, "argv": p.argv, + "cwd_rel": ".", "exit_code": after.exit_code, "test_exit_before": before.exit_code, + "stdout_sha256": sha256_hex(&after.stdout), "stderr_sha256": sha256_hex(&after.stderr), + "started_unix_ms": after.started_unix_ms as u64, "duration_ms": after.duration_ms as u64, + "tree_commit_after": tree_commit_after, "target_blob_sha256_after": blob_after, + "before": {"stdout_sha256": sha256_hex(&before.stdout), "stderr_sha256": sha256_hex(&before.stderr)}}); + Ok(TestRunEvidence { + task, + source_pin, + test_run, + stdout: after.stdout.clone(), + stderr: after.stderr.clone(), + task_id: p.task_id.clone(), + exit_before: before.exit_code, + exit_after: after.exit_code, + tree_commit_after, + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn fixture() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures/fix_the_test") + } + + #[test] + fn task_fields_parse() { + let (id, argv) = parse_task("# T\n\ntask_id: a/b-1\ntest_command: make test\n").unwrap(); + assert_eq!( + (id.as_str(), argv), + ("a/b-1", vec!["make".into(), "test".into()]) + ); + assert!(parse_task("task_id: x\n").is_err()); + } + + #[test] + fn fixture_fails_before_and_passes_after_the_solution() { + let d = tempfile::tempdir().unwrap(); + let p = prepare(&fixture(), &d.path().join("ws")).unwrap(); + assert!( + !p.ws.join("solution").exists(), + "solution stays out of the workspace" + ); + let before = run_tests(&p).unwrap(); + assert_ne!( + before.exit_code, + 0, + "{}", + String::from_utf8_lossy(&before.stdout) + ); + std::fs::write(p.ws.join(TARGET), &p.solution).unwrap(); + let after = run_tests(&p).unwrap(); + assert_eq!( + after.exit_code, + 0, + "{}", + String::from_utf8_lossy(&after.stdout) + ); + let ev = evidence(&p, &before, &after).unwrap(); + assert_eq!(ev.test_run["exit_code"], 0); + assert_eq!( + ev.source_pin["target_blob_sha256"], + json!(p.target_blob_sha256) + ); + assert_eq!( + ev.test_run["target_blob_sha256_after"], + json!(sha256_hex(p.solution.as_bytes())) + ); + assert_ne!(ev.tree_commit_after, p.commit); + } + + #[test] + fn no_build_output_is_tracked() { + let d = tempfile::tempdir().unwrap(); + let p = prepare(&fixture(), &d.path().join("ws")).unwrap(); + run_tests(&p).unwrap(); + let tracked = git(&p.ws, &["ls-files"]).unwrap(); + assert!(!tracked.contains("build/"), "{tracked}"); + } +} diff --git a/adapters/aien/src/lib.rs b/adapters/aien/src/lib.rs index 5dff1a5..51bb55a 100644 --- a/adapters/aien/src/lib.rs +++ b/adapters/aien/src/lib.rs @@ -30,6 +30,7 @@ use interplane_crossveil::{CallContext, ObservedRecord, Pipeline, Refusal, Runti use serde_json::{json, Map, Value}; pub mod compose_ledger; +pub mod fix_the_test; pub mod provenance_export; pub use compose_ledger::{ hmac_sha256, ApprovalBinding, ComposeLedgerAuthority, DeskKey, LedgerClient, diff --git a/adapters/aien/src/provenance_export.rs b/adapters/aien/src/provenance_export.rs index 99c08f2..f445b45 100644 --- a/adapters/aien/src/provenance_export.rs +++ b/adapters/aien/src/provenance_export.rs @@ -7,6 +7,9 @@ //! INTERPLANE trace of this run, the model files the daemon loaded (hard link, or copy), and a //! `COMPANION.json` naming each by path, size and SHA-256. //! +//! Fix-the-test slice: with [`LiveRun::slice`] the bundle also carries the harness's task, source pin +//! and test-run records (`vac-test-run/1`, see `crate::fix_the_test`). +//! //! Honest labels, nothing invented: the proposal here is a SCRIPTED turn (the test wrote the tool //! call), so the manifest says `proposal_origin: scripted_turn` and the verdict can never be //! `PASS complete`; it is `PASS_LABELLED_INCOMPLETE missing=link:model_turn`. The model's training @@ -47,6 +50,8 @@ pub struct LiveRun<'a> { /// RFC 3339 times of the request and of completion (see [`rfc3339_utc`]). pub t_request: &'a str, pub t_done: &'a str, + /// The fix-the-test slice: task, source pin and test-run records (harness evidence). + pub slice: Option<&'a crate::fix_the_test::TestRunEvidence>, } /// What was written. @@ -246,6 +251,58 @@ pub fn export_bundle(run: &LiveRun<'_>) -> Result { pretty(&view(cited, ack)?), )?; + // The daemon states whether its compose library is native (sovereign-core #346). An older + // daemon returns neither field: then `aien.native` is absent and the verdict says so. + let native = recalled["compose_native"].as_bool().map(|claimed| { + let sha = recalled["omega_sha"].as_str().unwrap_or(""); + json!({"claimed": claimed, "omega_sha": sha}) + }); + if native.is_some() { + put( + run.out, + &mut records, + "compose_recall", + "records/aien/compose-recall.json", + pretty(&recalled), + )?; + } + if let Some(s) = run.slice { + put( + run.out, + &mut records, + "task", + "records/task/task.json", + pretty(&s.task), + )?; + put( + run.out, + &mut records, + "source_pin", + "records/task/source-pin.json", + pretty(&s.source_pin), + )?; + put( + run.out, + &mut records, + "test_run_record", + "records/task/test-run.json", + pretty(&s.test_run), + )?; + put( + run.out, + &mut records, + "test_stdout", + "records/task/test-stdout.txt", + s.stdout.clone(), + )?; + put( + run.out, + &mut records, + "test_stderr", + "records/task/test-stderr.txt", + s.stderr.clone(), + )?; + } let exe_sha = sha256_file(run.aien_bin)?; let boot_id = std::fs::read_to_string("/proc/sys/kernel/random/boot_id") .map(|s| s.trim().to_string()) @@ -346,7 +403,11 @@ pub fn export_bundle(run: &LiveRun<'_>) -> Result { ); } - let companion = json!({ + let mut missing = vec!["link:model_turn"]; + if run.slice.is_some() && native.as_ref().is_none_or(|n| n["claimed"] != true) { + missing.push("link:native"); + } + let mut companion = json!({ "kind": "interplane-provenance-companion", "schema": 0, "fixture": {"class": "real", "note": "Real daemon; the five ledger records are the daemon's own ComposeRecall output (pretty-printed only); daemon_run.json and the 3-message trace are written by the test harness, including their timestamps. The model turn is SCRIPTED by the test (the tool call is a test constant), so authorship of the proposal is not claimed; the model only loaded."}, "lineage": {"kind": "unknown_pretraining", @@ -355,14 +416,21 @@ pub fn export_bundle(run: &LiveRun<'_>) -> Result { "export": {"format": "huggingface", "chat_template": Value::Null}, "load_support": {"declared": "supported_structural"}, "aien": {"candidate_id": Value::Null, "executable": "aien-cli", "executable_sha256": exe_sha, - "note": "no frozen AIEN candidate: no candidate_manifest record; CPU-reference backend as printed in the daemon log; whether the compose library was native-linked is not reported by the daemon"}, + "note": "no frozen AIEN candidate: no candidate_manifest record; CPU-reference backend as printed in the daemon log; whether the compose library was native-linked is reported only when the daemon returns compose_native (sovereign-core #346); aien.native then names it"}, "interplane": {"trace_id": run.trace_id, "request_id": request_id}, "effect": {"binding": "aien-ledger-slice/1", "approval_binding": "aien.approval.v2", "proposal_origin": "scripted_turn"}, - "completeness": {"state": "incomplete", "missing": ["link:model_turn"], + "completeness": {"state": "incomplete", "missing": missing, "reason": "the INTERPLANE model turn is scripted by the test: nothing links this model to the effect's content"}, "records": Value::Object(records), }); + if let Some(n) = native { + companion["aien"]["native"] = n; + } + if let Some(s) = run.slice { + companion["test_run"] = json!({"binding": "vac-test-run/1", "task_id": s.task_id, + "record": "test_run_record"}); + } write(run.out, "COMPANION.json", &pretty(&companion))?; Ok(ExportReport { dir: run.out.to_path_buf(), @@ -413,6 +481,7 @@ mod tests { final_result: &v, t_request: "t", t_done: "t", + slice: None, }); assert!(r.unwrap_err().contains("never rewritten")); } diff --git a/adapters/aien/tests/compose_ledger.rs b/adapters/aien/tests/compose_ledger.rs index 1667708..d57a56a 100644 --- a/adapters/aien/tests/compose_ledger.rs +++ b/adapters/aien/tests/compose_ledger.rs @@ -375,6 +375,7 @@ fn export_provenance( res: &ToolResult, t_request: &str, t_done: &str, + slice: Option<&fix_the_test::TestRunEvidence>, ) { if std::env::var("LEDGER_OUT").is_err() { return; @@ -404,6 +405,7 @@ fn export_provenance( final_result: &final_result, t_request, t_done, + slice, }) .expect("provenance export"); println!("PROVENANCE_BUNDLE {}", rep.dir.display()); @@ -500,7 +502,7 @@ fn row1_approved_write_lands_and_is_done() { json!({"verdict": "PASS", "records_before": before, "records_after": after, "receipt": rc, "journal": recs, "file_sha256": hex(&written), "expected_sha256": hex(EXPECTED.as_bytes())}), ); - export_provenance(&d, &intent_v, &pending_v, &res, &t_request, &t_done); + export_provenance(&d, &intent_v, &pending_v, &res, &t_request, &t_done, None); } #[test] @@ -1320,3 +1322,87 @@ fn row11_released_grant_reminted_is_refused_by_the_daemon() { "remint_refusal": msg}), ); } + +/// The fix-the-test slice (VAC M3b): a task workspace with a deliberately failing test, a SCRIPTED +/// proposal whose content is the corrected file, written through the daemon's approved ledger; the +/// harness runs the task's test command before the proposal and after the daemon's ack. The test +/// run is harness evidence, not a daemon effect. With `LEDGER_OUT` set the run is exported as a +/// bundle (`slice1/bundle`) for `provenance verify`. +#[test] +#[ignore = "NOT_RUN unless AIEN_BIN names an aien-cli binary: run with --ignored"] +fn slice1_fix_the_test_lands_and_tests_pass() { + let _g = lock(); + let Some(d) = daemon("slice1") else { return }; + let c = d.client(); + let fixture = Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures/fix_the_test"); + let task = fix_the_test::prepare(&fixture, &d.ws()).expect("prepare the task workspace"); + let before_run = fix_the_test::run_tests(&task).expect("make test before"); + assert_ne!( + before_run.exit_code, + 0, + "the task must start red: {}", + String::from_utf8_lossy(&before_run.stdout) + ); + let before = count(&c); + let l = ledger(&d); + let mut rt = l.clone(); + let mut p = pipe(&mut rt, &l); + let (intent_v, pending_v) = propose(&mut p, 0, "w1", fix_the_test::TARGET, &task.solution); + let t_request = provenance_export::now_rfc3339(); + let (res, _) = approve(&mut p, &l, "w1"); + assert_eq!(res.status, ResultStatus::Ok, "{res:?}"); + let t_done = provenance_export::now_rfc3339(); + let rc = res.data["receipt"].clone(); + assert_eq!(rc["state"], "DONE"); + let written = std::fs::read(d.ws().join(fix_the_test::TARGET)).unwrap(); + assert_eq!( + written, + task.solution.as_bytes(), + "the daemon wrote the approved bytes" + ); + assert_eq!(rc["disk_sha256"], json!(hex(task.solution.as_bytes()))); + let ids: Vec = ["grant_id", "intent_id", "ack_record_id"] + .iter() + .map(|k| rc[*k].as_u64().unwrap()) + .collect(); + let recs = records(&c, &ids); + assert!(recs.iter().all(|r| r["verified"] == true)); + assert_eq!( + recs[0]["text"]["prior_sha256"], + json!(task.target_blob_sha256), + "the grant pins the bytes the fix replaced" + ); + let after_run = fix_the_test::run_tests(&task).expect("make test after"); + assert_eq!( + after_run.exit_code, + 0, + "the task must end green: {}", + String::from_utf8_lossy(&after_run.stdout) + ); + let evidence = fix_the_test::evidence(&task, &before_run, &after_run).unwrap(); + let after = count(&c); + let (claim, _) = claim_grant(&rc); + assert_eq!( + after - before, + ids[2] - claim + 1, + "handoff + grant + intent + ack" + ); + save( + &d, + "slice1", + json!({"verdict": "PASS", "records_before": before, "records_after": after, + "receipt": rc, "journal": recs, "task_id": evidence.task_id, + "test_exit_before": evidence.exit_before, "test_exit_after": evidence.exit_after, + "source_commit": task.commit, "tree_commit_after": evidence.tree_commit_after, + "target_blob_sha256_before": task.target_blob_sha256, "target_blob_sha256_after": hex(&written)}), + ); + export_provenance( + &d, + &intent_v, + &pending_v, + &res, + &t_request, + &t_done, + Some(&evidence), + ); +} diff --git a/provenance/BINDING.md b/provenance/BINDING.md index b3f5c3d..964babf 100644 --- a/provenance/BINDING.md +++ b/provenance/BINDING.md @@ -178,4 +178,69 @@ writes it. model", `approved.rs`). Authorship is therefore established upstream, in the same trace, by `model_generation/2`, not by the approved-write ledger records. - Model identity inside the approved-write records. They carry no model or tokenizer digests; the - daemon process identity is the bridge to the generation record (`model_generation/2`). \ No newline at end of file + daemon process identity is the bridge to the generation record (`model_generation/2`). +## Fix-the-test slice: test run, source pin, native claim (VAC M3b) + +Status: implemented in `src/testrun.rs`; tested in `tests/fix_the_test.rs` on the committed +`fixtures/synthetic-fix-the-test` (generated by `gen-synthetic fix-the-test-native`). These +sections ride on top of `aien-ledger-slice/1` and need it: a `test_run` section beside any other +effect binding is `malformed_companion`. They run after the ledger checks and before the +`fixture.class` check. + +**The test run is harness evidence, not a daemon effect.** The AIEN daemon only wrote the file +(`bash_eval` is `NOT_EXECUTED`). The run harness executed the task's test command before the +proposal and again after the daemon's ack, and retained what it saw. All of these records are +unsigned exports; the verifier cannot tell a harness export from a hand-written file. + +Retained records (named in `records`, raw files): + +| Record | Content | +|---|---| +| `task` | `{kind: "vac-task", task_id, repo_commit, test_cmd: [argv...]}` | +| `source_pin` | `{kind: "vac-source-pin", repo, commit, target_path, target_blob_sha256}`: the task's start commit and the SHA-256 of the target file before the fix | +| `test_run_record` | `{kind: "vac-test-run", v: 1, task_id, argv, cwd_rel, exit_code, test_exit_before, stdout_sha256, stderr_sha256, started_unix_ms, duration_ms, tree_commit_after, target_blob_sha256_after}` | +| `test_stdout`, `test_stderr` | the test command's output after the fix, byte for byte | +| `compose_recall` | the daemon's raw `ComposeRecall` report (carries `compose_native`, `omega_sha`) | + +`COMPANION.json` gains `"test_run": {"binding": "vac-test-run/1", "task_id": ..., "record": "test_run_record"}` +and, when the daemon reports it, `"aien": {..., "native": {"claimed": bool, "omega_sha": str}}`. + +### Checks (fixed order, first failure wins) + +1. **`test_run_missing`**: no `test_run` section while the archive names a `task`, `source_pin` or + `test_run_record` (a bundle that carries a task claims a fix, so dropping the section is not + silence); or the section's record, or `task`, is absent or not retained. +2. **`unsupported_test_run`**: `test_run.binding` is not `vac-test-run/1`, or the record's `kind`/`v` + is not `vac-test-run`/`1`. +3. **`source_pin_mismatch`**: `source_pin.kind` is not `vac-source-pin`; `source_pin.target_path` differs + from the grant's `path`; `source_pin.target_blob_sha256` differs from the grant's `prior_sha256` + (null for a new file also fails); `source_pin.commit` differs from `task.repo_commit`. +4. **`test_run_mismatch`**: `task_id` differs between the section, the record and `task`; `argv` differs + from `task.test_cmd`; `exit_code` is not 0 (the slice claims the test passes after the write); + `test_exit_before` is 0 (nothing was fixed) or missing; `target_blob_sha256_after` differs from the + ack's `disk_sha256` (the daemon's read-back) or the grant's `content_sha256`; `stdout_sha256` or + `stderr_sha256` is not hex or differs from the retained `test_stdout`/`test_stderr`. +5. **`native_claim_contradicted`**: see below. + +### Native claim, and what a missing one means + +`aien.native.claimed: true` is accepted only when the retained `compose_recall` report says +`compose_native: true` and its `omega_sha` (40 hex) equals `aien.native.omega_sha`; with no report, a +report of `false`, or another sha it is `native_claim_contradicted`. `claimed: false` is refused when +the report says native. A malformed `native` object is `malformed_companion`. + +In a bundle with a `test_run` section, `link:native` is **missing** (labelled, never complete) unless a +native claim was accepted: the field absent (a daemon older than sovereign-core #346) or `claimed: false`. +The verdict is then `PASS_LABELLED_INCOMPLETE missing=link:model_turn,link:native ...`. Bundles without a +`test_run` section are unchanged. `omega_sha` is the build's pinned expected sha, a build-time fact; a +library supplied by override is linked without a sha check (sovereign-core M3a report). + +What this check does not do: it reads only the retained `compose_recall` report. The ledger ack records +carry no `compose_native` field, so the ack is not consulted. The recall report is digest-bound but not +cross-checked against the five ledger records, so a producer who writes the bundle can hand-write a +recall report saying `compose_native: true`. That falls under the unsigned-export limit above: the +verifier detects inconsistent or altered evidence, not a producer that fabricates a consistent set. + +Does not prove: that the tests are good, that the proposal came from a model (it is scripted: +`link:model_turn` stays missing), that the harness is honest, or that nothing else touched the +workspace between the ack and the second test run. diff --git a/provenance/README.md b/provenance/README.md index b8b5ec7..7b00a53 100644 --- a/provenance/README.md +++ b/provenance/README.md @@ -42,7 +42,8 @@ truncated write), `digest_mismatch`, `unlabelled_missing`, `completeness_mismatc `unparseable_record`, `binding_mismatch`, `run_not_complete`, `lineage_conflict`, `conversion_mismatch`, `incompatible`, `load_support_mismatch`, `load_unsupported`, `invalid_envelope`, `not_in_trace`, `synthetic_complete`, `canonicalization_mismatch`, -`unsupported_binding`. +`unsupported_binding`, and for the fix-the-test slice (BINDING.md): `test_run_missing`, +`test_run_mismatch`, `unsupported_test_run`, `source_pin_mismatch`, `native_claim_contradicted`. A complete verdict whose AIEN link names no frozen candidate manifest (`candidate_id: null`) ends with `candidate=none`. Reading is strict: every JSON input (the manifest, each record, the JSON diff --git a/provenance/fixtures/synthetic-fix-the-test/COMPANION.json b/provenance/fixtures/synthetic-fix-the-test/COMPANION.json new file mode 100644 index 0000000..cad6f38 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/COMPANION.json @@ -0,0 +1,206 @@ +{ + "aien": { + "candidate_id": "CAND-SYNTH-0", + "executable": "aien-cli-native-release", + "executable_sha256": "be0196b6bf36be4eb97aaa63b23421b964ed5c62905c5dfa144b0618f3f216ec", + "native": { + "claimed": true, + "omega_sha": "6c6180cf378075b61291f4565d226eba38b4decd" + } + }, + "completeness": { + "missing": [ + "link:model_turn" + ], + "reason": "the INTERPLANE model turn is synthetic: nothing links this model to the effect's content", + "state": "incomplete" + }, + "effect": { + "approval_binding": "aien.approval.v2", + "binding": "aien-ledger-slice/1", + "proposal_origin": "scripted_turn" + }, + "export": { + "chat_template": "export_chat_template", + "conversion_tool": { + "checked": false, + "commit": "synthetic", + "name": "waldo model export --format huggingface" + }, + "format": "huggingface", + "model_revision": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74/5e7a0c1d2b3f4a59" + }, + "fixture": { + "class": "synthetic", + "generator": "provenance/src/synth.rs", + "note": "Every byte is synthetic. The export carries a Hugging Face tokenizer.json, which a real WALDO Hugging Face export does not; no AIEN process loaded this model and no runtime wrote this receipt." + }, + "interplane": { + "request_id": "call-prov-01", + "trace_id": "trace-prov-01" + }, + "kind": "interplane-provenance-companion", + "lineage": { + "corpus_license_assertions": [ + "CC0-1.0" + ], + "kind": "waldo_run", + "model_id": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74", + "run_id": "5e7a0c1d2b3f4a59", + "training_backend": { + "name": "pytorch", + "revision": "synthetic-worker-r0" + }, + "training_code": { + "checked": false, + "commit": "synthetic", + "repository": "github.com/openwaldo/waldo" + } + }, + "load_support": { + "declared": "supported_structural" + }, + "records": { + "aien_load_log": { + "bytes": 357, + "path": "records/aien/daemon-load.log", + "sha256": "9992c10693922a0397076a178286a8f6565e8fdd0a3ad8cb0ca9acd1ff4ba33d" + }, + "candidate_manifest": { + "bytes": 596, + "path": "records/aien/CAND-SYNTH-0.toml", + "sha256": "262ca8551313f6d42cde6eed4c229e81c2613cecc202784eaa52ca35f0acbfc2" + }, + "compose_recall": { + "bytes": 225, + "path": "records/aien/compose-recall.json", + "sha256": "5c4aefda19c79a90c7d80678915c16c11a39359414afa524a813703bfedf0db1" + }, + "daemon_run": { + "bytes": 344, + "path": "records/aien/daemon-run.json", + "sha256": "2a35005acd1d13bf5394b2f78e5643609f4256828ead93154ee40bc177a4e037" + }, + "export_chat_template": { + "bytes": 86, + "path": "records/export/chat_template.jinja", + "sha256": "b8ea5aa4e20237c9293fc855c1e93f4bfcfbcebba497b75d56771bf978e3987f" + }, + "export_config": { + "bytes": 359, + "path": "records/export/config.json", + "sha256": "09d7fb97a11a43d90794540b082f32db524e6989d8372aeb9d2f2d292124e97d" + }, + "export_tokenizer": { + "bytes": 550, + "path": "records/export/tokenizer.json", + "sha256": "e133d05dd5781f7667288e2834e68e8b0702134d477679b3651940455ea7c17c" + }, + "export_weights": { + "bytes": 160, + "path": "records/export/model.safetensors", + "sha256": "c0d9ed56f7631be1c67dad8eb6900c22019f0f74036ba256dab82e3eca601f9c" + }, + "interplane_trace": { + "bytes": 5939, + "path": "records/interplane/trace.json", + "sha256": "4ef1b739013ade6c48738aa3ce1246cc8639d859ebba52260bcf50e5869e2b60" + }, + "ledger_ack": { + "bytes": 564, + "path": "records/aien/ledger-ack.json", + "sha256": "33da5d016c090fa70e1d27ed58ac5bdc7014ad5a7d2209f15902170bd6e6b131" + }, + "ledger_claim": { + "bytes": 536, + "path": "records/aien/ledger-claim.json", + "sha256": "4c22eea8d5e5cd056a880a7cb4c03a96da436e98cc33e9755c627e045ad1daa5" + }, + "ledger_committed": { + "bytes": 462, + "path": "records/aien/ledger-committed.json", + "sha256": "9818203ac321eafe6b65d36d11c82561e71e0f991c1e0d75f510b0e69115eb56" + }, + "ledger_grant": { + "bytes": 1077, + "path": "records/aien/ledger-grant.json", + "sha256": "7ef285053217c1a7e49d68366bb0d3c33f8935f941f7d1bce4408a02b2758b16" + }, + "ledger_intent": { + "bytes": 688, + "path": "records/aien/ledger-intent.json", + "sha256": "f927894f62c005ff74ac310f0b7196416f16aa9eceaca5c151d6e9422a0d461f" + }, + "release_bom": { + "bytes": 1172, + "path": "records/export/BOM.json", + "sha256": "1f86892bceb5a3f7e5ee9d1c8afaee3890bdcb728f6ac4057391532196b4c572", + "waldo_sha256": "1b7c640f7c7ccb08fb3d8b59f365e7229b1a59bddf7dd44671f94c733ec25213" + }, + "run_weights": { + "bytes": 152, + "path": "records/waldo/model.safetensors", + "sha256": "c577e4eca87be69ec21ae758c3f81edb91d9fed486ba517d25da321da3e51a6f" + }, + "source_pin": { + "bytes": 237, + "path": "records/task/source-pin.json", + "sha256": "cf0b2d14eeeddf1f51342afd67402ee95212ca5bf41e7a355749cedaaade6ee4" + }, + "task": { + "bytes": 167, + "path": "records/task/task.json", + "sha256": "3ae07e71f1ca1a999de7a23e1e9b5516833258301137cad8aa83b14464d448ce" + }, + "test_run_record": { + "bytes": 574, + "path": "records/task/test-run.json", + "sha256": "329a1d7d3a449b733e20650340e26b7c2e08f5f88f976b2d11964913c5f13e30" + }, + "test_stderr": { + "bytes": 0, + "path": "records/task/test-stderr.txt", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "test_stdout": { + "bytes": 59, + "path": "records/task/test-stdout.txt", + "sha256": "8640ef0ceb5167562cb17526e5210f63e57de169cec5aa44af62ac51515d597f" + }, + "waldo_model_bom": { + "bytes": 952, + "path": "records/waldo/MODEL-BOM.json", + "sha256": "4831e493bf03d9ade6de3ebcc23b142caae4573642576f872ea654db2aea4332", + "waldo_sha256": "cb0d013088156cb472b3d9c7c65863b789efbc271baa9c8350dad1196b7c1c61" + }, + "waldo_plan": { + "bytes": 170, + "path": "records/waldo/PLAN.json", + "sha256": "a28a8f6f471d7bdf866146a010b22ad34cd31102c28f5c7642d2810dad09f870", + "waldo_sha256": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74" + }, + "waldo_preflight": { + "bytes": 70, + "path": "records/waldo/PREFLIGHT.json", + "sha256": "ab7a45f0aad32406b1361d799d3551fa35460ad5c7541498fae3c994a4bc97d4" + }, + "waldo_run": { + "bytes": 185, + "path": "records/waldo/RUN.json", + "sha256": "be02496c96536753f56b03fee91a037f5bdf4e262fd2d678adb43397ae60e4f7", + "waldo_sha256": "4ed1d6932df873dbaf5de248425dbc6b10e72eb60322bdcd5fdfae7ebee78cac" + }, + "waldo_run_bom": { + "bytes": 1180, + "path": "records/waldo/RUN-BOM.json", + "sha256": "7e97fe67211cc6976695f30eead40c7a727e53076a24c09f611d75dbddd5de17", + "waldo_sha256": "2afc802676a08df19a94facc7b287f99236b18aad1b88c9df14d0bd3019b10d2" + } + }, + "schema": 0, + "test_run": { + "binding": "vac-test-run/1", + "record": "test_run_record", + "task_id": "fix-the-test/clamp-1" + } +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/CAND-SYNTH-0.toml b/provenance/fixtures/synthetic-fix-the-test/records/aien/CAND-SYNTH-0.toml new file mode 100644 index 0000000..96aaf82 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/CAND-SYNTH-0.toml @@ -0,0 +1,13 @@ +# SYNTHETIC candidate manifest, CandidateManifestV1 subset (aien-architecture qualification/candidates). +schema = "CandidateManifestV1" +id = "CAND-SYNTH-0" +status = "synthetic" + +[executables] +aien-cli-native-release = "be0196b6bf36be4eb97aaa63b23421b964ed5c62905c5dfa144b0618f3f216ec" + +[model] +model-id = "synthetic-notes" +model-safetensors-sha256 = "c0d9ed56f7631be1c67dad8eb6900c22019f0f74036ba256dab82e3eca601f9c" +tokenizer-json-sha256 = "e133d05dd5781f7667288e2834e68e8b0702134d477679b3651940455ea7c17c" +config-json-sha256 = "09d7fb97a11a43d90794540b082f32db524e6989d8372aeb9d2f2d292124e97d" diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/compose-recall.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/compose-recall.json new file mode 100644 index 0000000..a3b3169 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/compose-recall.json @@ -0,0 +1,10 @@ +{ + "cited": [], + "compose_dir": "/synthetic/compose", + "compose_native": true, + "host": [], + "machine_id": "synthetic", + "missing": [], + "omega_sha": "6c6180cf378075b61291f4565d226eba38b4decd", + "records_total": 30 +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-load.log b/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-load.log new file mode 100644 index 0000000..b32ab0c --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-load.log @@ -0,0 +1,2 @@ +checkpoint loaded from /models/synthetic-notes/model.safetensors (tokenizer loaded, model_id=synthetic-notes, config=synthetic-notes (config.json), model_sha256=c0d9ed56f7631be1c67dad8eb6900c22019f0f74036ba256dab82e3eca601f9c, tokenizer_sha256=e133d05dd5781f7667288e2834e68e8b0702134d477679b3651940455ea7c17c) +✓ Binding socket at /synthetic/run/aien.sock diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-run.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-run.json new file mode 100644 index 0000000..918aec3 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/daemon-run.json @@ -0,0 +1,10 @@ +{ + "boot_id": "synthetic-boot", + "executable_sha256": "be0196b6bf36be4eb97aaa63b23421b964ed5c62905c5dfa144b0618f3f216ec", + "kind": "aien-daemon-run", + "note": "SYNTHETIC: written by the generator, not by a run harness", + "pid": 4242, + "socket": "/synthetic/run/aien.sock", + "start_ticks": 777000, + "workspace": "/synthetic/workspace" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-ack.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-ack.json new file mode 100644 index 0000000..8509ca4 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-ack.json @@ -0,0 +1,17 @@ +{ + "cls": 0, + "digest": "39f4e737e6a9f1a7cfbc7bd6ae87f2e70cdc2eed7b482774f62045b3af41154a", + "id": 29, + "kind": 0, + "links": [ + 28, + 27, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 0, + "text": "{\"authorization\":27,\"content_sha256\":\"e2ceb55af549ddde3808be9f04e9e0519350ab34456b2569b9074e8bcc0f9810\",\"disk_error\":null,\"disk_sha256\":\"e2ceb55af549ddde3808be9f04e9e0519350ab34456b2569b9074e8bcc0f9810\",\"intent\":28,\"path\":\"src/clamp.c\",\"phase\":\"ack\",\"state\":\"DONE\",\"tool\":\"write_file\"}", + "verified": true +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-claim.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-claim.json new file mode 100644 index 0000000..36905ba --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-claim.json @@ -0,0 +1,17 @@ +{ + "cls": 0, + "digest": "0c0f3ab53c31d2c6fd812c1aef4eab60083d76b7aaf84222ac26b5c682f1186d", + "id": 20, + "kind": 0, + "links": [ + 0, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 0, + "text": "{\"approval_id\":\"aien-approval:call-prov-01:synthetic\",\"approval_key\":\"b4cf33aefd83ca20fb7e3bc6fb0d525a651f983265ecee4975a7ffb72134a323\",\"approved_submission\":\"accepted\",\"executor\":{\"pid\":4242,\"start\":777000},\"request_id\":\"call-prov-01\",\"trace_id\":\"trace-prov-01\"}", + "verified": true +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-committed.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-committed.json new file mode 100644 index 0000000..cfc4822 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-committed.json @@ -0,0 +1,17 @@ +{ + "cls": 0, + "digest": "272971d0cd47990bb3b2f9b151e5312f36cf45b285b9114a77b8cb24211ae294", + "id": 26, + "kind": 0, + "links": [ + 20, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 0, + "text": "{\"approved_submission\":\"committed\",\"claim\":20,\"evidence\":{\"compose_proposal_sha256\":\"17dd23808c16be4a9bac27ab38779392b762033e57d0e82999ce7c6d2e296e63\",\"cx_evidence\":24,\"cx_promotion\":25,\"task\":1}}", + "verified": true +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-grant.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-grant.json new file mode 100644 index 0000000..b2d28e4 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-grant.json @@ -0,0 +1,17 @@ +{ + "cls": 0, + "digest": "30363bf8ccaf941756e09b39acda0513434f06db6a1b45925614b42163316a52", + "id": 27, + "kind": 0, + "links": [ + 25, + 24, + 20, + 0 + ], + "note": "authorization", + "subject": 0, + "tag": 0, + "text": "{\"approval_id\":\"aien-approval:call-prov-01:synthetic\",\"approval_key\":\"b4cf33aefd83ca20fb7e3bc6fb0d525a651f983265ecee4975a7ffb72134a323\",\"approved_grant\":1,\"approved_proposal_sha256\":\"78aeeea24fed0537be88fe8ea8a6d4eccc6642357ba88eaf946fda6c1bee1133\",\"approver\":\"drake\",\"content_sha256\":\"e2ceb55af549ddde3808be9f04e9e0519350ab34456b2569b9074e8bcc0f9810\",\"cx_evidence\":24,\"cx_promotion\":25,\"desk_key_id\":\"0123456789abcdef\",\"path\":\"src/clamp.c\",\"prior_sha256\":\"72788b28b75d6b431797614b49b94aa999d18aff7cd0025f9665474e0c3b42c9\",\"proposal_sha256\":\"17dd23808c16be4a9bac27ab38779392b762033e57d0e82999ce7c6d2e296e63\",\"replay_claim\":20,\"request_id\":\"call-prov-01\",\"target\":\"/synthetic/workspace/src/clamp.c\",\"trace_id\":\"trace-prov-01\",\"workspace\":\"/synthetic/workspace\"}", + "verified": true +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-intent.json b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-intent.json new file mode 100644 index 0000000..cc2dac9 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/aien/ledger-intent.json @@ -0,0 +1,17 @@ +{ + "cls": 0, + "digest": "6d6960003ec46ee172dccfd37d083f824cb571a0decd920f7ea6f3b77e0ab25e", + "id": 28, + "kind": 0, + "links": [ + 27, + 0, + 0, + 0 + ], + "note": "effect", + "subject": 0, + "tag": 0, + "text": "{\"authorization\":27,\"content_sha256\":\"e2ceb55af549ddde3808be9f04e9e0519350ab34456b2569b9074e8bcc0f9810\",\"executor\":{\"pid\":9,\"start\":9},\"path\":\"src/clamp.c\",\"phase\":\"intent\",\"prior_sha256\":\"72788b28b75d6b431797614b49b94aa999d18aff7cd0025f9665474e0c3b42c9\",\"proposal_sha256\":\"17dd23808c16be4a9bac27ab38779392b762033e57d0e82999ce7c6d2e296e63\",\"target\":\"/synthetic/workspace/src/clamp.c\",\"tool\":\"write_file\"}", + "verified": true +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/export/BOM.json b/provenance/fixtures/synthetic-fix-the-test/records/export/BOM.json new file mode 100644 index 0000000..5e09721 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/export/BOM.json @@ -0,0 +1,39 @@ +{ + "artifacts": [ + { + "bytes": 86, + "path": "chat_template.jinja", + "role": "interaction-template", + "sha256": "b8ea5aa4e20237c9293fc855c1e93f4bfcfbcebba497b75d56771bf978e3987f" + }, + { + "bytes": 359, + "path": "config.json", + "role": "configuration", + "sha256": "09d7fb97a11a43d90794540b082f32db524e6989d8372aeb9d2f2d292124e97d" + }, + { + "bytes": 160, + "path": "model.safetensors", + "role": "weights", + "sha256": "c0d9ed56f7631be1c67dad8eb6900c22019f0f74036ba256dab82e3eca601f9c" + }, + { + "bytes": 550, + "path": "tokenizer.json", + "role": "tokenizer", + "sha256": "e133d05dd5781f7667288e2834e68e8b0702134d477679b3651940455ea7c17c" + } + ], + "format": "huggingface", + "generated": "2026-10-06T00:00:00Z", + "kind": "openwaldo-bom", + "model_id": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74", + "name": "synthetic-notes", + "run_id": "5e7a0c1d2b3f4a59", + "schema": 1, + "source_bom_sha256": "cb0d013088156cb472b3d9c7c65863b789efbc271baa9c8350dad1196b7c1c61", + "source_id": "5e7a0c1d2b3f4a59", + "source_type": "run", + "subject": "model-release" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/export/chat_template.jinja b/provenance/fixtures/synthetic-fix-the-test/records/export/chat_template.jinja new file mode 100644 index 0000000..a242b05 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/export/chat_template.jinja @@ -0,0 +1,3 @@ +{% for m in messages %}<|{{ m.role }}|> +{{ m.content }} +{% endfor %}<|assistant|> diff --git a/provenance/fixtures/synthetic-fix-the-test/records/export/config.json b/provenance/fixtures/synthetic-fix-the-test/records/export/config.json new file mode 100644 index 0000000..41b5eb3 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/export/config.json @@ -0,0 +1,17 @@ +{ + "architectures": [ + "LlamaForCausalLM" + ], + "bos_token_id": 1, + "eos_token_id": 2, + "hidden_size": 4, + "intermediate_size": 8, + "max_position_embeddings": 16, + "model_type": "llama", + "num_attention_heads": 1, + "num_hidden_layers": 1, + "num_key_value_heads": 1, + "tie_word_embeddings": true, + "torch_dtype": "bfloat16", + "vocab_size": 8 +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/export/model.safetensors b/provenance/fixtures/synthetic-fix-the-test/records/export/model.safetensors new file mode 100644 index 0000000..f28b3fb Binary files /dev/null and b/provenance/fixtures/synthetic-fix-the-test/records/export/model.safetensors differ diff --git a/provenance/fixtures/synthetic-fix-the-test/records/export/tokenizer.json b/provenance/fixtures/synthetic-fix-the-test/records/export/tokenizer.json new file mode 100644 index 0000000..3220c22 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/export/tokenizer.json @@ -0,0 +1,37 @@ +{ + "added_tokens": [ + { + "content": "", + "id": 0, + "special": true + }, + { + "content": "", + "id": 1, + "special": true + }, + { + "content": "", + "id": 2, + "special": true + } + ], + "model": { + "type": "WordLevel", + "unk_token": "", + "vocab": { + "": 2, + "": 1, + "": 0, + "append": 6, + "hello": 3, + "note": 5, + "ok": 7, + "world": 4 + } + }, + "pre_tokenizer": { + "type": "Whitespace" + }, + "version": "1.0" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/interplane/trace.json b/provenance/fixtures/synthetic-fix-the-test/records/interplane/trace.json new file mode 100644 index 0000000..892a63f --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/interplane/trace.json @@ -0,0 +1,230 @@ +[ + { + "destination": { + "id": "aien", + "kind": "runtime" + }, + "interplane_version": "0.1", + "message_id": "m-1", + "parent_id": null, + "payload": { + "arguments": { + "content": "int clamp(int v, int lo, int hi)\n{\n if (v < lo)\n return lo;\n if (v > hi)\n return hi;\n return v;\n}\n", + "path": "src/clamp.c" + }, + "kind": "tool_request", + "provenance": { + "dialect": "openai", + "parser_version": "1" + }, + "request_id": "call-prov-01", + "tool": { + "name": "write_file", + "namespace": null + } + }, + "source": { + "id": "synthetic-notes", + "kind": "model" + }, + "timestamp": "2026-10-06T00:00:01Z", + "trace_id": "trace-prov-01" + }, + { + "destination": { + "id": "synthetic-notes", + "kind": "model" + }, + "interplane_version": "0.1", + "message_id": "m-2", + "parent_id": "m-1", + "payload": { + "data": { + "bytes_written": 121, + "path": "src/clamp.c", + "receipt": { + "ack_digest": "39f4e737e6a9f1a7cfbc7bd6ae87f2e70cdc2eed7b482774f62045b3af41154a", + "ack_record_id": 29, + "grant_digest": "30363bf8ccaf941756e09b39acda0513434f06db6a1b45925614b42163316a52", + "grant_id": 27, + "intent_digest": "6d6960003ec46ee172dccfd37d083f824cb571a0decd920f7ea6f3b77e0ab25e", + "intent_id": 28, + "request_id": "call-prov-01", + "state": "DONE", + "trace_id": "trace-prov-01" + } + }, + "decision": null, + "error": null, + "kind": "result", + "provenance": { + "capability": "write_file", + "content_kind": "tool_result", + "duration_ms": null, + "runtime": "aien", + "trust": "trusted_runtime", + "trusted": true + }, + "request_id": "call-prov-01", + "status": "ok" + }, + "source": { + "id": "aien", + "kind": "runtime" + }, + "timestamp": "2026-10-06T00:00:02Z", + "trace_id": "trace-prov-01" + }, + { + "destination": { + "id": "aien", + "kind": "runtime" + }, + "interplane_version": "0.1", + "message_id": "m-3", + "parent_id": null, + "payload": { + "arguments": { + "content": "note append", + "path": "notes/other.md" + }, + "kind": "tool_request", + "provenance": { + "dialect": "openai", + "parser_version": "1" + }, + "request_id": "call-prov-02", + "tool": { + "name": "write_file", + "namespace": null + } + }, + "source": { + "id": "synthetic-notes", + "kind": "model" + }, + "timestamp": "2026-10-06T00:00:03Z", + "trace_id": "trace-prov-01" + }, + { + "destination": { + "id": "synthetic-notes", + "kind": "model" + }, + "interplane_version": "0.1", + "message_id": "m-4", + "parent_id": "m-3", + "payload": { + "data": { + "bytes_written": 11, + "path": "notes/other.md", + "receipt": { + "ack_digest": "7454fe8237c3608d93828aad0dab2c2ce3140a94cc396645df2df97f628dd520", + "ack_record_id": 39, + "grant_digest": "049d77c78cfdc1c44517b51035cb6fa33a29eb1bf1de1e365d07588fff7f680c", + "grant_id": 37, + "intent_digest": "d827990166faff06e9dc15edb9698ce0298431dcba17adcc01c7d6e1e5d2a897", + "intent_id": 38, + "request_id": "call-prov-02", + "state": "DONE", + "trace_id": "trace-prov-01" + } + }, + "decision": null, + "error": null, + "kind": "result", + "provenance": { + "capability": "write_file", + "content_kind": "tool_result", + "duration_ms": null, + "runtime": "aien", + "trust": "trusted_runtime", + "trusted": true + }, + "request_id": "call-prov-02", + "status": "ok" + }, + "source": { + "id": "aien", + "kind": "runtime" + }, + "timestamp": "2026-10-06T00:00:04Z", + "trace_id": "trace-prov-01" + }, + { + "destination": { + "id": "aien", + "kind": "runtime" + }, + "interplane_version": "0.1", + "message_id": "m-5", + "parent_id": null, + "payload": { + "arguments": { + "content": "hello world", + "path": "notes/today.md" + }, + "kind": "tool_request", + "provenance": { + "dialect": "openai", + "parser_version": "1" + }, + "request_id": "call-prov-03", + "tool": { + "name": "write_file", + "namespace": null + } + }, + "source": { + "id": "synthetic-notes", + "kind": "model" + }, + "timestamp": "2026-10-06T00:00:05Z", + "trace_id": "trace-prov-01" + }, + { + "destination": { + "id": "synthetic-notes", + "kind": "model" + }, + "interplane_version": "0.1", + "message_id": "m-6", + "parent_id": "m-5", + "payload": { + "data": { + "bytes_written": 11, + "path": "notes/today.md", + "receipt": { + "ack_digest": "4091cf86d95eb01eefd5bcfe653b6d6150ea804b4f865c81e3aed67e82d145fa", + "ack_record_id": 49, + "grant_digest": "291f21f5d8379331a5f3c213f17670e51d95f718a174d56d821f41d431cdd382", + "grant_id": 47, + "intent_digest": "1a0cbb0010907ea8787f8741ded1c51aed855c9e5b005cf21789497560b5308b", + "intent_id": 48, + "request_id": "call-prov-03", + "state": "DONE", + "trace_id": "trace-prov-01" + } + }, + "decision": null, + "error": null, + "kind": "result", + "provenance": { + "capability": "write_file", + "content_kind": "tool_result", + "duration_ms": null, + "runtime": "aien", + "trust": "trusted_runtime", + "trusted": true + }, + "request_id": "call-prov-03", + "status": "ok" + }, + "source": { + "id": "aien", + "kind": "runtime" + }, + "timestamp": "2026-10-06T00:00:06Z", + "trace_id": "trace-prov-01" + } +] diff --git a/provenance/fixtures/synthetic-fix-the-test/records/task/source-pin.json b/provenance/fixtures/synthetic-fix-the-test/records/task/source-pin.json new file mode 100644 index 0000000..512a806 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/task/source-pin.json @@ -0,0 +1,7 @@ +{ + "commit": "1111111111111111111111111111111111111111", + "kind": "vac-source-pin", + "repo": "fix_the_test", + "target_blob_sha256": "72788b28b75d6b431797614b49b94aa999d18aff7cd0025f9665474e0c3b42c9", + "target_path": "src/clamp.c" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/task/task.json b/provenance/fixtures/synthetic-fix-the-test/records/task/task.json new file mode 100644 index 0000000..0c9bc41 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/task/task.json @@ -0,0 +1,9 @@ +{ + "kind": "vac-task", + "repo_commit": "1111111111111111111111111111111111111111", + "task_id": "fix-the-test/clamp-1", + "test_cmd": [ + "make", + "test" + ] +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/task/test-run.json b/provenance/fixtures/synthetic-fix-the-test/records/task/test-run.json new file mode 100644 index 0000000..e7347bf --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/task/test-run.json @@ -0,0 +1,18 @@ +{ + "argv": [ + "make", + "test" + ], + "cwd_rel": ".", + "duration_ms": 120, + "exit_code": 0, + "kind": "vac-test-run", + "started_unix_ms": 1791000000000, + "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "stdout_sha256": "8640ef0ceb5167562cb17526e5210f63e57de169cec5aa44af62ac51515d597f", + "target_blob_sha256_after": "e2ceb55af549ddde3808be9f04e9e0519350ab34456b2569b9074e8bcc0f9810", + "task_id": "fix-the-test/clamp-1", + "test_exit_before": 2, + "tree_commit_after": "2222222222222222222222222222222222222222", + "v": 1 +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/task/test-stderr.txt b/provenance/fixtures/synthetic-fix-the-test/records/task/test-stderr.txt new file mode 100644 index 0000000..e69de29 diff --git a/provenance/fixtures/synthetic-fix-the-test/records/task/test-stdout.txt b/provenance/fixtures/synthetic-fix-the-test/records/task/test-stdout.txt new file mode 100644 index 0000000..80aefd5 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/task/test-stdout.txt @@ -0,0 +1,5 @@ +ok inside +ok below +ok above +ok at_low +ok at_high diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/MODEL-BOM.json b/provenance/fixtures/synthetic-fix-the-test/records/waldo/MODEL-BOM.json new file mode 100644 index 0000000..ae676ad --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/waldo/MODEL-BOM.json @@ -0,0 +1,32 @@ +{ + "current_run_id": "5e7a0c1d2b3f4a59", + "kind": "openwaldo-bom", + "model_id": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74", + "name": "synthetic-notes", + "path_base": "model-root", + "plan_sha256": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74", + "runs": [ + { + "artifacts": [ + { + "bytes": 152, + "path": "runs/0001-pretrain-5e7a0c1d2b3f4a59/artifacts/model.safetensors", + "role": "weights", + "sha256": "c577e4eca87be69ec21ae758c3f81edb91d9fed486ba517d25da321da3e51a6f" + } + ], + "backend": { + "name": "pytorch", + "revision": "synthetic-worker-r0" + }, + "bom_sha256": "2afc802676a08df19a94facc7b287f99236b18aad1b88c9df14d0bd3019b10d2", + "id": "5e7a0c1d2b3f4a59", + "ordinal": 1, + "simulated": false, + "stage": "pretrain", + "state": "complete" + } + ], + "schema": 1, + "subject": "model" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/PLAN.json b/provenance/fixtures/synthetic-fix-the-test/records/waldo/PLAN.json new file mode 100644 index 0000000..dc0b9d9 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/waldo/PLAN.json @@ -0,0 +1,6 @@ +{ + "architecture_sha256": "865de587e331af8d5022d8d0ae64a1e73f5f0123a3a21d6bfac9cd612a6c1f53", + "kind": "waldo-model-plan", + "name": "synthetic-notes", + "schema": 1 +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/PREFLIGHT.json b/provenance/fixtures/synthetic-fix-the-test/records/waldo/PREFLIGHT.json new file mode 100644 index 0000000..2dd5171 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/waldo/PREFLIGHT.json @@ -0,0 +1,5 @@ +{ + "held_out_rows": [], + "kind": "waldo-preflight", + "schema": 1 +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN-BOM.json b/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN-BOM.json new file mode 100644 index 0000000..2488823 --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN-BOM.json @@ -0,0 +1,52 @@ +{ + "corpus_bom": { + "index": { + "commit": "0000000000000000000000000000000000000000", + "dirty": false, + "remote": "synthetic" + }, + "kind": "openwaldo-bom", + "license_policy": {}, + "licenses": { + "CC0-1.0": { + "bytes": 64, + "docs": 1, + "shards": 1, + "tokens": 20 + } + }, + "manifests": [], + "paths": [ + "synthetic/notes" + ], + "schema": 1, + "shards": [], + "subject": "corpus", + "totals": { + "bytes": 64, + "docs": 1, + "files": 1, + "tokens": 20 + } + }, + "corpus_bom_sha256": "a170741b90e1a59264e1116aa021fa2306358a20dece6e48b188d96084d4627e", + "execution": { + "backend": { + "name": "pytorch", + "revision": "synthetic-worker-r0" + }, + "framework": "pytorch" + }, + "id": "5e7a0c1d2b3f4a59", + "kind": "openwaldo-bom", + "model_id": "c894c3d7cface2bbb09acec55075aac6cd875ff2251fada62862ed85863cfd74", + "objective": "causal-lm", + "preflight": { + "bytes": 70, + "path": "PREFLIGHT.json", + "sha256": "ab7a45f0aad32406b1361d799d3551fa35460ad5c7541498fae3c994a4bc97d4" + }, + "schema": 1, + "stage": "pretrain", + "subject": "training-run" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN.json b/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN.json new file mode 100644 index 0000000..3d9eedb --- /dev/null +++ b/provenance/fixtures/synthetic-fix-the-test/records/waldo/RUN.json @@ -0,0 +1,7 @@ +{ + "bom_sha256": "2afc802676a08df19a94facc7b287f99236b18aad1b88c9df14d0bd3019b10d2", + "id": "5e7a0c1d2b3f4a59", + "kind": "waldo-training-run", + "schema": 1, + "state": "complete" +} diff --git a/provenance/fixtures/synthetic-fix-the-test/records/waldo/model.safetensors b/provenance/fixtures/synthetic-fix-the-test/records/waldo/model.safetensors new file mode 100644 index 0000000..e99491b Binary files /dev/null and b/provenance/fixtures/synthetic-fix-the-test/records/waldo/model.safetensors differ diff --git a/provenance/src/ledger.rs b/provenance/src/ledger.rs index 78ae257..1d68547 100644 --- a/provenance/src/ledger.rs +++ b/provenance/src/ledger.rs @@ -428,3 +428,29 @@ fn check_call( } Ok(()) } + +/// What the daemon's own records say about the written file, for the `vac-test-run/1` checks. +pub struct Facts { + pub path: String, + /// The file's digest before the write (`null` in the grant means a new file). + pub prior_sha256: Option, + pub content_sha256: String, + /// The ack's `disk_sha256`: the daemon read the file back after the write. + pub disk_sha256: String, +} + +/// Read the grant and ack facts. Only meaningful after [`check`] passed. +pub fn facts(a: &Archive) -> Result { + let grant = view(a, "ledger_grant", "authorization")?; + let ack = view(a, "ledger_ack", "effect")?; + Ok(Facts { + path: st(&grant, "ledger_grant", "path")?.to_string(), + prior_sha256: grant + .text + .get("prior_sha256") + .and_then(Value::as_str) + .map(str::to_string), + content_sha256: st(&grant, "ledger_grant", "content_sha256")?.to_string(), + disk_sha256: st(&ack, "ledger_ack", "disk_sha256")?.to_string(), + }) +} diff --git a/provenance/src/lib.rs b/provenance/src/lib.rs index 7dd4b72..cc2a4cf 100644 --- a/provenance/src/lib.rs +++ b/provenance/src/lib.rs @@ -18,6 +18,7 @@ mod ledger; mod modelturn; mod strict; pub mod synth; +mod testrun; use binding::{compact_sorted, LEDGER_BINDING, RECEIPT_BINDING, SERDE_DIGEST_FORM}; use gojson::{compact, sha256_hex, top_level_member, waldo_sha256}; @@ -251,6 +252,7 @@ fn verify_inner(dir: &Path) -> Result<(BTreeSet, Option, bo for item in modelturn::implied_missing(&archive, &m) { actually_missing.insert(item); } + actually_missing.extend(testrun::implied_missing(&m)); let state = s(&m, &["completeness", "state"]); let declared: BTreeSet = m .get("completeness") @@ -353,6 +355,7 @@ fn verify_inner(dir: &Path) -> Result<(BTreeSet, Option, bo call = check_trace(&archive, t)?; } let mut effect_label = None; + let mut ledger_checked = false; if let Some(e) = link("effect") { let (Some(t), Some(aien)) = (link("interplane"), link("aien")) else { return fail("malformed_companion", "effect without interplane"); @@ -384,6 +387,7 @@ fn verify_inner(dir: &Path) -> Result<(BTreeSet, Option, bo modelturn::check(&archive, t, call.as_ref())?; } effect_label = Some(format!("{LEDGER_BINDING}:strong proposal={origin}")); + ledger_checked = true; } Some(RECEIPT_BINDING) => { // Weaker: tool + digests only. The label stays on the verdict. @@ -405,6 +409,7 @@ fn verify_inner(dir: &Path) -> Result<(BTreeSet, Option, bo None => return fail("malformed_companion", "effect.binding"), } } + testrun::check(&archive, &m, ledger_checked)?; // Test material may verify, but never as a complete chain: `fixture.class` other than `real` // refuses `complete` whatever records it carries (#76 review). Checked last, so every deeper // check above still runs on test material. diff --git a/provenance/src/main.rs b/provenance/src/main.rs index d0f388f..f3d9d6f 100644 --- a/provenance/src/main.rs +++ b/provenance/src/main.rs @@ -1,5 +1,5 @@ //! `interplane-provenance verify ` prints one verdict line (exit 0 on PASS*, 1 on FAIL). -//! `interplane-provenance gen-synthetic [weak]` writes the synthetic full-chain fixture +//! `interplane-provenance gen-synthetic [weak|fix-the-test|fix-the-test-native|fix-the-test-stub]` writes the synthetic full-chain fixture //! (ledger-slice binding; `weak` writes the record_effect_receipt/1 variant). //! `interplane-provenance seal ` seals a new COMPANION.json (never overwrites). @@ -21,6 +21,15 @@ fn main() -> ExitCode { (Some("gen-synthetic"), Some(dir), mode @ (None | Some(_))) => { let opts = interplane_provenance::synth::Opts { weak: mode.map(String::as_str) == Some("weak"), + fix_the_test: matches!( + mode.map(String::as_str), + Some("fix-the-test" | "fix-the-test-native" | "fix-the-test-stub") + ), + native: match mode.map(String::as_str) { + Some("fix-the-test-native") => Some(true), + Some("fix-the-test-stub") => Some(false), + _ => None, + }, ..Default::default() }; match interplane_provenance::synth::write_synthetic(Path::new(dir), &opts) { @@ -48,7 +57,7 @@ fn main() -> ExitCode { } } _ => { - eprintln!("usage: interplane-provenance verify | gen-synthetic [weak] | seal "); + eprintln!("usage: interplane-provenance verify | gen-synthetic [weak|fix-the-test|fix-the-test-native|fix-the-test-stub] | seal "); ExitCode::from(2) } } diff --git a/provenance/src/synth.rs b/provenance/src/synth.rs index 59f7d92..dba70f4 100644 --- a/provenance/src/synth.rs +++ b/provenance/src/synth.rs @@ -39,6 +39,18 @@ pub struct Opts { pub request_id: Option, /// Write the weaker `record_effect_receipt/1` binding instead of the ledger slice. pub weak: bool, + /// Write the fix-the-test slice: a write that replaces `src/clamp.c`, the `vac-test-run/1` + /// records and a `compose_recall` report (see [`fix_the_test`]). + pub fix_the_test: bool, + /// With `fix_the_test`: the native-claim variant of the recall report (default: no `aien.native`). + pub native: Option, +} + +/// Arguments and prior digest of a write that replaces an existing file. +#[derive(Clone)] +pub struct Over { + pub args: Value, + pub prior_sha256: String, } fn pretty(v: &Value) -> Vec { @@ -112,7 +124,19 @@ fn record_view(id: u64, links: [u64; 4], note: &str, text: &Value) -> Value { /// The five daemon-written ledger records of one approved write, SYNTHETIC but built through the /// same binding functions the verifier uses. `index` spaces the record ids apart. pub fn ledger_slice(trace_id: &str, request_id: &str, index: u64) -> Vec<(&'static str, Value)> { - let a = request_args(request_id); + ledger_slice_over(trace_id, request_id, index, None) +} + +/// [`ledger_slice`] for a write that replaces an existing file: `over` names the arguments and the +/// digest of the bytes the file held before. +pub fn ledger_slice_over( + trace_id: &str, + request_id: &str, + index: u64, + over: Option<&Over>, +) -> Vec<(&'static str, Value)> { + let a = over.map_or_else(|| request_args(request_id), |o| o.args.clone()); + let prior = over.map_or(Value::Null, |o| json!(o.prior_sha256)); let (path, content) = (a["path"].as_str().unwrap(), a["content"].as_str().unwrap()); let base = 20 + 10 * index; let (claim, evidence, promotion, committed, grant, intent, ack) = ( @@ -175,7 +199,7 @@ pub fn ledger_slice(trace_id: &str, request_id: &str, index: u64) -> Vec<(&'stat &json!({ "approved_grant": 1, "proposal_sha256": compose_sha, "path": path, "content_sha256": content_sha, "approver": "drake", "target": target, - "workspace": WORKSPACE, "prior_sha256": null, "approval_key": key, + "workspace": WORKSPACE, "prior_sha256": prior, "approval_key": key, "replay_claim": claim, "cx_promotion": promotion, "cx_evidence": evidence, "request_id": request_id, "trace_id": trace_id, "approval_id": approval_id, "desk_key_id": desk, "approved_proposal_sha256": approved_sha}), @@ -190,7 +214,7 @@ pub fn ledger_slice(trace_id: &str, request_id: &str, index: u64) -> Vec<(&'stat &json!({ "phase": "intent", "tool": "write_file", "authorization": grant, "proposal_sha256": compose_sha, "path": path, "target": target, - "content_sha256": content_sha, "prior_sha256": null, + "content_sha256": content_sha, "prior_sha256": prior, "executor": {"pid": 9, "start": 9}}), ), ), @@ -210,8 +234,8 @@ pub fn ledger_slice(trace_id: &str, request_id: &str, index: u64) -> Vec<(&'stat } /// The adapter's receipt as it appears in the INTERPLANE result (`data.receipt`). -fn adapter_receipt(trace_id: &str, request_id: &str, index: u64) -> Value { - let s = ledger_slice(trace_id, request_id, index); +fn adapter_receipt(trace_id: &str, request_id: &str, index: u64, over: Option<&Over>) -> Value { + let s = ledger_slice_over(trace_id, request_id, index, over); let r = |n: &str| { s.iter() .find(|(k, _)| *k == n) @@ -240,9 +264,16 @@ fn envelope( }) } +fn args_of(rid: &str, over: Option<&Over>) -> Value { + match over.filter(|_| rid == REQUEST_ID) { + Some(o) => o.args.clone(), + None => request_args(rid), + } +} + /// Three requests in one trace: 01, 02 and 03, where 03 repeats 01 exactly. In ledger mode each /// result carries the adapter receipt of its own request. -fn trace(trace_id: &str, weak: bool) -> Value { +fn trace(trace_id: &str, weak: bool, over: Option<&Over>) -> Value { let mut envs = Vec::new(); let mut n = 0; for (i, rid) in [REQUEST_ID, OTHER_REQUEST_ID, IDENTICAL_REQUEST_ID] @@ -260,14 +291,20 @@ fn trace(trace_id: &str, weak: bool) -> Value { json!({ "kind": "tool_request", "request_id": rid, "tool": {"namespace": null, "name": "write_file"}, - "arguments": request_args(rid), + "arguments": args_of(rid, over), "provenance": {"dialect": "openai", "parser_version": "1"} }), )); n += 1; - let mut data = result_data(rid); + let mut data = match over.filter(|_| rid == REQUEST_ID) { + Some(o) => { + json!({"path": o.args["path"], "bytes_written": o.args["content"].as_str().unwrap_or("").len()}) + } + None => result_data(rid), + }; if !weak { - data["receipt"] = adapter_receipt(trace_id, rid, i as u64); + data["receipt"] = + adapter_receipt(trace_id, rid, i as u64, over.filter(|_| rid == REQUEST_ID)); } envs.push(envelope(trace_id, n, Some(format!("m-{req}")), ("runtime", "aien"), ("model", "synthetic-notes"), json!({ "kind": "result", "request_id": rid, "status": "ok", "data": data, @@ -379,7 +416,8 @@ pub fn write_synthetic(dir: &Path, o: &Opts) -> std::io::Result<()> { .iter() .position(|r| *r == request_id) .expect("request id is one of the synthetic requests") as u64; - let trace = pretty(&trace(&trace_id, o.weak)); + let over = fix_over(o); + let trace = pretty(&trace(&trace_id, o.weak, over.as_ref())); let files: Vec<(&str, &str, Vec)> = vec![ ("waldo_plan", "records/waldo/PLAN.json", plan), @@ -426,7 +464,7 @@ pub fn write_synthetic(dir: &Path, o: &Opts) -> std::io::Result<()> { ), )); } else { - for (name, view) in ledger_slice(&trace_id, &request_id, index) { + for (name, view) in ledger_slice_over(&trace_id, &request_id, index, over.as_ref()) { files.push((name, ledger_path(name), pretty(&view))); } files.push(( @@ -439,12 +477,18 @@ pub fn write_synthetic(dir: &Path, o: &Opts) -> std::io::Result<()> { "note": "SYNTHETIC: written by the generator, not by a run harness"})), )); } + let fix = o.fix_the_test.then(|| fix_the_test(o)); + if let Some((extra_files, _)) = &fix { + for (n, p, b) in extra_files { + files.push((n, p, b.clone())); + } + } let mut records = serde_json::Map::new(); for (name, rel, bytes) in &files { put(dir, rel, bytes)?; records.insert(name.to_string(), json!({"path": rel})); } - let skeleton = json!({ + let mut skeleton = json!({ "kind": crate::KIND, "schema": crate::SCHEMA, "fixture": {"class": "synthetic", "generator": "provenance/src/synth.rs", "note": "Every byte is synthetic. The export carries a Hugging Face tokenizer.json, which a real WALDO Hugging Face export does not; no AIEN process loaded this model and no runtime wrote this receipt."}, @@ -466,6 +510,18 @@ pub fn write_synthetic(dir: &Path, o: &Opts) -> std::io::Result<()> { json!({"binding": LEDGER_BINDING, "approval_binding": APPROVAL_BINDING, "proposal_origin": "scripted_turn"}) } }); + if let Some((_, extra)) = fix { + skeleton["test_run"] = extra["test_run"].clone(); + let mut missing = vec!["link:model_turn"]; + match o.native { + Some(true) => {} + _ => missing.push("link:native"), + } + if !extra["aien_native"].is_null() { + skeleton["aien"]["native"] = extra["aien_native"].clone(); + } + skeleton["completeness"]["missing"] = json!(missing); + } seal(dir, skeleton) } @@ -510,3 +566,62 @@ pub fn seal(dir: &Path, mut skeleton: Value) -> std::io::Result<()> { } std::fs::write(out, pretty(&skeleton)) } + +/// The SYNTHETIC buggy and fixed `src/clamp.c` of the fix-the-test slice (a stand-in for the +/// adapter fixture; the verifier never reads either, only their digests). +pub const BUGGY_C: &str = "int clamp(int v, int lo, int hi)\n{\n if (v < lo)\n return lo;\n if (v > hi)\n return lo;\n return v;\n}\n"; +pub const FIXED_C: &str = "int clamp(int v, int lo, int hi)\n{\n if (v < lo)\n return lo;\n if (v > hi)\n return hi;\n return v;\n}\n"; +pub const TASK_ID: &str = "fix-the-test/clamp-1"; +pub const SOURCE_COMMIT: &str = "1111111111111111111111111111111111111111"; +pub const TREE_AFTER: &str = "2222222222222222222222222222222222222222"; +pub const OMEGA_SHA: &str = "6c6180cf378075b61291f4565d226eba38b4decd"; +pub const TEST_STDOUT: &str = "ok inside\nok below\nok above\nok at_low\nok at_high\n"; + +fn fix_over(o: &Opts) -> Option { + o.fix_the_test.then(|| Over { + args: json!({"path": "src/clamp.c", "content": FIXED_C}), + prior_sha256: sha256_hex(BUGGY_C.as_bytes()), + }) +} + +/// Extra records and companion sections of the fix-the-test slice, merged into the skeleton by +/// `write_synthetic`: `(name, path, bytes)` files, and companion keys to set. +type ExtraFile = (&'static str, &'static str, Vec); + +fn fix_the_test(o: &Opts) -> (Vec, Value) { + let task = pretty( + &json!({"kind": "vac-task", "task_id": TASK_ID, "repo_commit": SOURCE_COMMIT, + "test_cmd": ["make", "test"]}), + ); + let pin = pretty( + &json!({"kind": "vac-source-pin", "repo": "fix_the_test", "commit": SOURCE_COMMIT, + "target_path": "src/clamp.c", "target_blob_sha256": sha256_hex(BUGGY_C.as_bytes())}), + ); + let stdout = TEST_STDOUT.as_bytes().to_vec(); + let stderr = Vec::new(); + let run = pretty(&json!({"kind": "vac-test-run", "v": 1, "task_id": TASK_ID, + "argv": ["make", "test"], "cwd_rel": ".", "exit_code": 0, "test_exit_before": 2, + "stdout_sha256": sha256_hex(&stdout), "stderr_sha256": sha256_hex(&stderr), + "started_unix_ms": 1_791_000_000_000u64, "duration_ms": 120, + "tree_commit_after": TREE_AFTER, "target_blob_sha256_after": sha256_hex(FIXED_C.as_bytes())})); + let mut files = vec![ + ("task", "records/task/task.json", task), + ("source_pin", "records/task/source-pin.json", pin), + ("test_run_record", "records/task/test-run.json", run), + ("test_stdout", "records/task/test-stdout.txt", stdout), + ("test_stderr", "records/task/test-stderr.txt", stderr), + ]; + let mut extra = json!({"test_run": {"binding": "vac-test-run/1", "task_id": TASK_ID, + "record": "test_run_record"}}); + if let Some(claimed) = o.native { + let recall = pretty( + &json!({"compose_dir": "/synthetic/compose", "machine_id": "synthetic", + "records_total": 30, "host": [], "cited": [], "missing": [], + "compose_native": claimed, "omega_sha": if claimed { OMEGA_SHA } else { "" }}), + ); + files.push(("compose_recall", "records/aien/compose-recall.json", recall)); + extra["aien_native"] = + json!({"claimed": claimed, "omega_sha": if claimed { OMEGA_SHA } else { "" }}); + } + (files, extra) +} diff --git a/provenance/src/testrun.rs b/provenance/src/testrun.rs new file mode 100644 index 0000000..6e864eb --- /dev/null +++ b/provenance/src/testrun.rs @@ -0,0 +1,212 @@ +//! `vac-test-run/1`: the fix-the-test slice's extra evidence, and the `aien.native` claim. +//! Specification: provenance/BINDING.md ("Test run", "Source pin", "Native claim"). +//! +//! The daemon only writes the file; it does not run tests. The test run is HARNESS evidence: the +//! harness ran the task's test command before the write and after the daemon's ack, and retained +//! what it saw. This module checks that the retained records agree with each other and with the +//! daemon's own grant and ack. It cannot tell a harness export from a hand-written file (unsigned). +//! It reads and compares; it authorizes and repairs nothing. + +use super::{fail, s, Archive, Fail}; +use crate::ledger; +use serde_json::Value; +use std::collections::BTreeSet; + +pub const BINDING: &str = "vac-test-run/1"; +pub const MISSING_NATIVE: &str = "link:native"; +const RUN_KIND: &str = "vac-test-run"; +const PIN_KIND: &str = "vac-source-pin"; + +fn is_hex64(x: &str) -> bool { + x.len() == 64 && x.bytes().all(|b| b.is_ascii_hexdigit()) +} + +fn is_hex40(x: &str) -> bool { + x.len() == 40 && x.bytes().all(|b| b.is_ascii_hexdigit()) +} + +fn native_of(m: &Value) -> Option<&Value> { + m.get("aien") + .and_then(|a| a.get("native")) + .filter(|n| !n.is_null()) +} + +/// Missing links implied by a slice bundle: with a `test_run` section, the daemon must have +/// reported a native compose library (`aien.native.claimed: true`), else `link:native` is missing. +pub fn implied_missing(m: &Value) -> BTreeSet { + let mut out = BTreeSet::new(); + if m.get("test_run").is_some() { + let claimed = native_of(m).and_then(|n| n.get("claimed")) == Some(&Value::Bool(true)); + if !claimed { + out.insert(MISSING_NATIVE.to_string()); + } + } + out +} + +fn rec_json(a: &Archive, name: &str, code: &str) -> Result { + if !a.has(name) { + return fail(code, format!("record {name} absent")); + } + match a.json(name)? { + Some(v) => Ok(v), + None => fail(code, format!("record {name} not retained")), + } +} + +/// Checks for the slice sections. `ledger_checked` is true when the effect link was the strong +/// ledger binding (whose checks already ran). +pub fn check(a: &Archive, m: &Value, ledger_checked: bool) -> Result<(), Fail> { + let section = m.get("test_run").filter(|v| !v.is_null()); + // A bundle that carries a task or a source pin claims a fix: the test run must be there. + let claims_fix = ["task", "source_pin", "test_run_record"] + .iter() + .any(|n| a.has(n)); + let Some(sec) = section else { + if claims_fix { + return fail( + "test_run_missing", + "task/source_pin/test_run_record present but no test_run section", + ); + } + return check_native(a, m); + }; + if !ledger_checked { + return fail( + "malformed_companion", + "test_run requires effect.binding aien-ledger-slice/1", + ); + } + if s(sec, &["binding"]) != Some(BINDING) { + return fail( + "unsupported_test_run", + format!( + "test_run.binding={}", + s(sec, &["binding"]).unwrap_or("absent") + ), + ); + } + let Some(rec_name) = s(sec, &["record"]) else { + return fail("test_run_missing", "test_run.record"); + }; + let run = rec_json(a, rec_name, "test_run_missing")?; + if s(&run, &["kind"]) != Some(RUN_KIND) || run.get("v").and_then(Value::as_u64) != Some(1) { + return fail("unsupported_test_run", "record kind/v"); + } + let task = rec_json(a, "task", "test_run_missing")?; + let pin = rec_json(a, "source_pin", "source_pin_mismatch")?; + let facts = ledger::facts(a)?; + + // Source pin: the commit the task starts from, and the exact target bytes the grant replaced. + let pin_bad = |what: &str| -> Result<(), Fail> { fail("source_pin_mismatch", what) }; + if s(&pin, &["kind"]) != Some(PIN_KIND) { + return pin_bad("source_pin.kind"); + } + if s(&pin, &["target_path"]) != Some(facts.path.as_str()) { + return pin_bad("source_pin.target_path vs ledger_grant.path"); + } + match ( + s(&pin, &["target_blob_sha256"]), + facts.prior_sha256.as_deref(), + ) { + (Some(p), Some(g)) if is_hex64(p) && p == g => {} + _ => return pin_bad("source_pin.target_blob_sha256 vs ledger_grant.prior_sha256"), + } + if s(&pin, &["commit"]).is_none() || s(&pin, &["commit"]) != s(&task, &["repo_commit"]) { + return pin_bad("source_pin.commit vs task.repo_commit"); + } + + // The test run. + let bad = |what: &str| -> Result<(), Fail> { fail("test_run_mismatch", what) }; + let tid = s(&task, &["task_id"]); + if tid.is_none() || s(sec, &["task_id"]) != tid || s(&run, &["task_id"]) != tid { + return bad("task_id (section, record and task must agree)"); + } + if run.get("argv") != task.get("test_cmd") || !run.get("argv").is_some_and(Value::is_array) { + return bad("argv vs task.test_cmd"); + } + match run.get("exit_code").and_then(Value::as_i64) { + Some(0) => {} + Some(c) => return bad(&format!("exit_code={c} (a fix must pass: exit 0)")), + None => return bad("exit_code"), + } + match run.get("test_exit_before").and_then(Value::as_i64) { + Some(0) => return bad("test_exit_before=0 (the test already passed: nothing was fixed)"), + Some(_) => {} + None => return bad("test_exit_before"), + } + match s(&run, &["target_blob_sha256_after"]) { + Some(b) if is_hex64(b) && b == facts.disk_sha256 && b == facts.content_sha256 => {} + _ => return bad("target_blob_sha256_after vs ledger_ack.disk_sha256"), + } + for (field, record) in [ + ("stdout_sha256", "test_stdout"), + ("stderr_sha256", "test_stderr"), + ] { + let Some(d) = s(&run, &[field]).filter(|d| is_hex64(d)) else { + return bad(field); + }; + // The retained output (when kept) must be the output the digest names. + if a.has(record) { + if a.bytes(record)?.is_some() && a.sha(record)? != d { + return bad(&format!("{field} vs retained {record}")); + } + } else if field == "stdout_sha256" { + return bad("test_stdout record absent"); + } + } + check_native(a, m) +} + +/// `aien.native`: the claim that the daemon's compose library was the native one, checked against +/// the retained `ComposeRecall` report (`compose_recall`). +fn check_native(a: &Archive, m: &Value) -> Result<(), Fail> { + let Some(n) = native_of(m) else { + return Ok(()); + }; + let (Some(claimed), Some(sha)) = ( + n.get("claimed").and_then(Value::as_bool), + s(n, &["omega_sha"]), + ) else { + return fail("malformed_companion", "aien.native.claimed/omega_sha"); + }; + let recall = if a.has("compose_recall") { + a.json("compose_recall")? + } else { + None + }; + let recall_native = recall + .as_ref() + .and_then(|r| r.get("compose_native")) + .and_then(Value::as_bool); + let recall_sha = recall.as_ref().and_then(|r| s(r, &["omega_sha"])); + if claimed { + match (recall_native, recall_sha) { + (Some(true), Some(r)) if is_hex40(r) && r == sha && is_hex40(sha) => {} + (None, _) => { + return fail( + "native_claim_contradicted", + "claimed native but no compose_recall report with compose_native", + ) + } + (Some(false), _) => { + return fail( + "native_claim_contradicted", + "claimed native but compose_recall.compose_native=false", + ) + } + _ => { + return fail( + "native_claim_contradicted", + "aien.native.omega_sha vs compose_recall.omega_sha", + ) + } + } + } else if recall_native == Some(true) { + return fail( + "native_claim_contradicted", + "claimed:false but compose_recall.compose_native=true", + ); + } + Ok(()) +} diff --git a/provenance/tests/fix_the_test.rs b/provenance/tests/fix_the_test.rs new file mode 100644 index 0000000..b482345 --- /dev/null +++ b/provenance/tests/fix_the_test.rs @@ -0,0 +1,288 @@ +//! The fix-the-test slice: `vac-test-run/1` (test run), the source pin and the `aien.native` +//! claim. Every expected verdict is a literal. Mutated archives are restamped (record digests +//! recomputed), so only the new checks can refuse them. Specification: provenance/BINDING.md. + +mod common; + +use common::*; +use interplane_provenance::synth::{self, Opts}; +use interplane_provenance::verify; +use serde_json::{json, Value}; +use std::path::{Path, PathBuf}; + +const FIX: &str = "fixtures/synthetic-fix-the-test"; +const STRONG: &str = "effect=aien-ledger-slice/1:strong proposal=scripted_turn"; +const BLOB_OTHER: &str = "9999999999999999999999999999999999999999999999999999999999999999"; + +fn variant(name: &str, native: Option) -> PathBuf { + let d = Path::new(env!("CARGO_TARGET_TMPDIR")) + .join("fixthetest") + .join(name); + let _ = std::fs::remove_dir_all(&d); + synth::write_synthetic( + &d, + &Opts { + fix_the_test: true, + native, + ..Default::default() + }, + ) + .unwrap(); + d +} + +fn edit(d: &Path, rec: &str, f: impl FnOnce(&mut Value)) { + let p = path_of(d, rec); + let mut v: Value = serde_json::from_slice(&std::fs::read(&p).unwrap()).unwrap(); + f(&mut v); + std::fs::write(&p, serde_json::to_vec_pretty(&v).unwrap()).unwrap(); + restamp(d, rec); +} + +fn edit_companion(d: &Path, f: impl FnOnce(&mut Value)) { + let mut c = companion(d); + f(&mut c); + write_companion(d, &c); +} + +fn declare_missing(c: &mut Value, items: &[&str]) { + c["completeness"]["missing"] = json!(items); +} + +fn code(d: &Path) -> String { + verify(d) +} + +fn refused(d: &Path, want: &str) { + let v = code(d); + assert!( + v.starts_with(&format!("FAIL {want}:")), + "wanted {want}, got {v}" + ); +} + +#[test] +fn committed_fixture_is_labelled_incomplete_with_native_proven() { + let d = scratch(FIX, "ftt-committed"); + assert_eq!( + code(&d), + format!("PASS_LABELLED_INCOMPLETE missing=link:model_turn {STRONG}") + ); +} + +#[test] +fn committed_fixture_matches_the_generator() { + let d = variant("regen", Some(true)); + let root = Path::new(env!("CARGO_MANIFEST_DIR")).join(FIX); + assert_eq!( + std::fs::read(d.join("COMPANION.json")).unwrap(), + std::fs::read(root.join("COMPANION.json")).unwrap() + ); +} + +#[test] +fn absent_native_field_is_labelled_missing_never_complete() { + let d = variant("no-native", None); + assert_eq!( + code(&d), + format!("PASS_LABELLED_INCOMPLETE missing=link:model_turn,link:native {STRONG}") + ); +} + +#[test] +fn native_claimed_false_is_labelled_missing() { + let d = variant("stub", Some(false)); + assert_eq!( + code(&d), + format!("PASS_LABELLED_INCOMPLETE missing=link:model_turn,link:native {STRONG}") + ); +} + +#[test] +fn declaring_native_missing_is_required_to_match() { + // Dropping `link:native` from the declared list while no native proof exists is unlabelled. + let d = variant("undeclared", None); + edit_companion(&d, |c| { + c["completeness"]["missing"] = json!(["link:model_turn"]) + }); + refused(&d, "completeness_mismatch"); +} + +// ---- tamper tests ------------------------------------------------------------------------- + +#[test] +fn changed_exit_code_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-exit"); + edit(&d, "test_run_record", |v| v["exit_code"] = json!(1)); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn test_that_already_passed_before_the_fix_is_refused() { + let d = scratch(FIX, "ftt-before"); + edit(&d, "test_run_record", |v| v["test_exit_before"] = json!(0)); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn swapped_stdout_digest_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-stdout-digest"); + edit(&d, "test_run_record", |v| { + v["stdout_sha256"] = json!(BLOB_OTHER) + }); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn swapped_stdout_file_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-stdout-file"); + let p = path_of(&d, "test_stdout"); + std::fs::remove_file(&p).unwrap(); + std::fs::write(&p, b"ok everything passed, trust me\n").unwrap(); + restamp(&d, "test_stdout"); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn wrong_target_blob_after_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-blob"); + edit(&d, "test_run_record", |v| { + v["target_blob_sha256_after"] = json!(BLOB_OTHER) + }); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn argv_other_than_the_task_command_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-argv"); + edit(&d, "test_run_record", |v| v["argv"] = json!(["true"])); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn task_id_disagreement_is_a_test_run_mismatch() { + let d = scratch(FIX, "ftt-taskid"); + edit_companion(&d, |c| c["test_run"]["task_id"] = json!("another-task")); + refused(&d, "test_run_mismatch"); +} + +#[test] +fn dropped_test_run_section_is_test_run_missing() { + let d = scratch(FIX, "ftt-dropped"); + edit_companion(&d, |c| { + c.as_object_mut().unwrap().remove("test_run"); + }); + refused(&d, "test_run_missing"); +} + +#[test] +fn dropped_test_run_record_is_test_run_missing() { + let d = scratch(FIX, "ftt-dropped-record"); + edit_companion(&d, |c| { + c["records"] + .as_object_mut() + .unwrap() + .remove("test_run_record"); + }); + refused(&d, "test_run_missing"); +} + +#[test] +fn tampered_source_pin_blob_is_a_source_pin_mismatch() { + let d = scratch(FIX, "ftt-pin-blob"); + edit(&d, "source_pin", |v| { + v["target_blob_sha256"] = json!(BLOB_OTHER) + }); + refused(&d, "source_pin_mismatch"); +} + +#[test] +fn tampered_source_pin_path_and_commit_are_source_pin_mismatches() { + let d = scratch(FIX, "ftt-pin-path"); + edit(&d, "source_pin", |v| { + v["target_path"] = json!("src/other.c") + }); + refused(&d, "source_pin_mismatch"); + let d = scratch(FIX, "ftt-pin-commit"); + edit(&d, "source_pin", |v| v["commit"] = json!("abc")); + refused(&d, "source_pin_mismatch"); +} + +#[test] +fn unsupported_test_run_binding_or_version_is_refused() { + let d = scratch(FIX, "ftt-binding"); + edit_companion(&d, |c| c["test_run"]["binding"] = json!("vac-test-run/2")); + refused(&d, "unsupported_test_run"); + let d = scratch(FIX, "ftt-version"); + edit(&d, "test_run_record", |v| v["v"] = json!(2)); + refused(&d, "unsupported_test_run"); +} + +// ---- native claim ------------------------------------------------------------------------- + +#[test] +fn forged_native_true_against_a_stub_recall_is_contradicted() { + let d = variant("forged-stub", Some(false)); + edit_companion(&d, |c| { + c["aien"]["native"] = json!({"claimed": true, "omega_sha": synth::OMEGA_SHA}); + declare_missing(c, &["link:model_turn"]); + }); + refused(&d, "native_claim_contradicted"); +} + +#[test] +fn forged_native_true_with_no_recall_report_is_contradicted() { + let d = variant("forged-absent", None); + edit_companion(&d, |c| { + c["aien"]["native"] = json!({"claimed": true, "omega_sha": synth::OMEGA_SHA}); + declare_missing(c, &["link:model_turn"]); + }); + refused(&d, "native_claim_contradicted"); +} + +#[test] +fn forged_native_sha_differing_from_the_recall_is_contradicted() { + let d = scratch(FIX, "ftt-native-sha"); + edit_companion(&d, |c| { + c["aien"]["native"]["omega_sha"] = json!("0000000000000000000000000000000000000000"); + }); + refused(&d, "native_claim_contradicted"); +} + +#[test] +fn native_false_while_the_recall_says_native_is_contradicted() { + let d = scratch(FIX, "ftt-native-under"); + edit_companion(&d, |c| { + c["aien"]["native"]["claimed"] = json!(false); + declare_missing(c, &["link:model_turn", "link:native"]); + }); + refused(&d, "native_claim_contradicted"); +} + +#[test] +fn malformed_native_is_malformed() { + let d = scratch(FIX, "ftt-native-malformed"); + edit_companion(&d, |c| { + c["aien"]["native"] = json!({"claimed": "yes"}); + declare_missing(c, &["link:model_turn", "link:native"]); + }); + refused(&d, "malformed_companion"); +} + +#[test] +fn test_run_needs_the_strong_ledger_binding() { + let d = variant("weak-ledger", Some(true)); + edit_companion(&d, |c| { + c["effect"]["binding"] = json!("record_effect_receipt/1") + }); + let v = code(&d); + assert!(v.starts_with("FAIL "), "{v}"); +} + +#[test] +fn verifying_the_slice_changes_nothing() { + let d = scratch(FIX, "ftt-readonly"); + let before = std::fs::read(d.join("COMPANION.json")).unwrap(); + let _ = verify(&d); + assert_eq!(before, std::fs::read(d.join("COMPANION.json")).unwrap()); +} ```