W14: build C21 perform-mode harness + 5 pins (test-infra only)

The synchronous harness binds mocks as plain NativeFns, so no harness test
could exercise the real CEK perform/suspend/resume path — the HO+perform
element-drop class (S10) was structurally invisible (hosts.md C21).

Add harness-run-perform to spec/harness.sx: drives make-cek-state/
cek-step-loop, services each (perform {:op X :args L}) suspension from the
session's platform mocks (entry logged before invocation, C22-consistent),
cek-resumes with the mock value, loops to terminal; clear error on an
unmocked op. Shared arity dispatch extracted as harness-invoke-mock.

Pins (gate-C21-perform-mode-harness): single suspension, arithmetic-frame
resume, sequential performs, unmocked-op error, and the S10 probe — map
over a perform-suspending lambda keeps ALL 3 elements through 3
suspensions on the CEK path (localizing the drop class to serving-JIT).
290/0 under OCaml run_tests; harness self-suite green.

Caveat (documented): requires the runner's cek-* driver bindings — absent
on bare sx_server/MCP, the same runner-only-binding theme as section B.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 02:30:40 +00:00
parent 6f52cff0d9
commit 53c0ec14da
3 changed files with 105 additions and 2 deletions

View File

@@ -251,3 +251,58 @@
(try-call (fn () (bomb 3)))
(assert-io-count h "action" 3)
(assert= (get (io-call-nth h "action" 1) "result") "done"))))
(defsuite
"gate-C21-perform-mode-harness"
(deftest
"single perform suspension is serviced by the mock"
(let
((h (make-harness :platform {:fetch (fn (u) (str "R:" u))})))
(assert=
(harness-run-perform h (quote (perform {:op "fetch" :args (list "a")})) (make-env))
"R:a")
(assert-io-count h "fetch" 1)
(assert-io-result h "fetch" 0 "R:a")))
(deftest
"perform result feeds the surrounding arithmetic frame"
(let
((h (make-harness :platform {:query (fn () 41)})))
(assert=
(harness-run-perform
h
(quote (+ 1 (perform {:op "query"})))
(make-env))
42)))
(deftest
"sequential performs each suspend and resume in order"
(let
((h (make-harness :platform {:fetch (fn (u) (str "R:" u))})))
(assert=
(harness-run-perform
h
(quote (list (perform {:op "fetch" :args (list "x")}) (perform {:op "fetch" :args (list "y")})))
(make-env))
(list "R:x" "R:y"))
(assert-io-count h "fetch" 2)
(assert-io-args h "fetch" 1 (list "y"))))
(deftest
"S10 probe: map over perform-suspending lambda keeps ALL elements"
(let
((h (make-harness :platform {:fetch (fn (u) (str "R:" u))})))
(assert=
(harness-run-perform
h
(quote (map (fn (u) (perform {:op "fetch" :args (list u)})) (list "a" "b" "c")))
(make-env))
(list "R:a" "R:b" "R:c"))
(assert-io-count h "fetch" 3)))
(deftest
"unmocked op raises a clear error instead of hanging"
(let
((h (make-harness :platform {})))
(let
((r (try-call (fn () (harness-run-perform h (quote (perform {:op "no-such-op"})) (make-env))))))
(assert (not (get r "ok")) "expected an error for unmocked op")
(assert
(contains? (get r "error") "no mock for op")
(get r "error"))))))