Fix: replace guard with cek-try in test runner, clear stale reuse_stack

The guard form (call/cc + handler-bind expansion) doesn't survive async
IO suspension — the CEK continuation from guard's call/cc captures frames
that become invalid after the VM resumes from hs-wait. Replacing guard
with cek-try (which compiles to VM-native OP_PUSH_HANDLER/OP_POP_HANDLER)
avoids the CEK boundary crossing.

The test runner now executes: suspends on hs-wait, resumes, runs test
actions, and test assertions fire correctly. The "Not callable: nil"
error is eliminated. Remaining: test assertion errors from iframe content
not loading fast enough (timing issue, not a framework bug).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 18:10:10 +00:00
parent d8fec1305b
commit b12ec746a2
4 changed files with 14 additions and 15 deletions

View File

@@ -105,13 +105,11 @@
(reset! current (str "Running: " name))
(reset! results (assoc (deref results) name "running"))
(reload-frame)
(guard
(e
(true
(reset! results (assoc (deref results) name "fail"))
(console-log (str "FAIL " name ": " e))))
(for-each run-action (get test :actions))
(reset! results (assoc (deref results) name "pass")))))
(let
((test-ok (cek-try (fn () (for-each run-action (get test :actions)) true) (fn (e) (do (reset! results (assoc (deref results) name "fail")) (console-log (str "FAIL " name ": " e)) false)))))
(when
test-ok
(reset! results (assoc (deref results) name "pass"))))))
tests)
(reset! running false)
(reset! current "Done"))))