cl: Phase 3 complete — *debugger-hook*, *break-on-signals*, invoke-restart-interactively (147 tests)

cl-debugger-hook: mutable global (fn (c hook) result); cl-invoke-debugger
calls it with infinite-recursion guard (sets hook nil during call).
cl-error now routes unhandled errors through cl-invoke-debugger instead of
bare host error — allows the hook to invoke a restart and resume.
cl-break-on-signals: when set to a type name, cl-signal fires the debugger
hook before walking handlers if the condition matches.
cl-invoke-restart-interactively: calls the restart fn with no args (no
terminal protocol — equivalent to (invoke-restart name)).
4 new tests in conditions.sx covering all three; Phase 3 fully complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 11:21:52 +00:00
parent 85911d7b84
commit 733b1ebefa
3 changed files with 134 additions and 14 deletions

View File

@@ -73,7 +73,7 @@ Core mapping:
- [x] `restart-case`, `with-simple-restart`, `restart-bind`
- [x] `find-restart`, `invoke-restart`, `compute-restarts`
- [x] `with-condition-restarts` — associate restarts with a specific condition
- [ ] `invoke-restart-interactively`, `*break-on-signals*`, `*debugger-hook*` (basic)
- [x] `invoke-restart-interactively`, `*break-on-signals*`, `*debugger-hook*` (basic)
- [x] Classic programs in `lib/common-lisp/tests/programs/`:
- [x] `restart-demo.sx` — division with `use-zero` and `retry` restarts (7 tests)
- [x] `parse-recover.sx` — parser with skipped-token restart (6 tests)
@@ -124,6 +124,7 @@ data; format for string templating.
_Newest first._
- 2026-05-05: Phase 3 complete — cl-debugger-hook/cl-invoke-debugger in runtime.sx (cl-error routes through hook), cl-break-on-signals (fires hook before handlers on type match), cl-invoke-restart-interactively (calls fn with no args); 4 new tests (147 total). Phase 3 all boxes ticked.
- 2026-05-05: Phase 3 interactive-debugger.sx — cl-debugger-hook global, cl-invoke-debugger, cl-error-with-debugger, make-policy-debugger; 7 tests (143 total). Tests wired into test.sh program suite runner. Phase 3 condition core complete.
- 2026-05-05: Phase 3 classic programs — `tests/programs/restart-demo.sx` (7 tests: safe-divide with use-zero + retry restarts) and `tests/programs/parse-recover.sx` (6 tests: token parser with skip-token + use-zero restarts, handler-case abort). Key gotcha: use `=` not `equal?` for list comparison in sx_server.
- 2026-05-05: Phase 3 conditions + restarts — `cl-condition-classes` hierarchy (15 types), `cl-condition?`/`cl-condition-of-type?`, `cl-make-condition`, `cl-define-condition`, `cl-signal`/`cl-error`/`cl-warn`/`cl-cerror`, `cl-handler-bind` (non-unwinding), `cl-handler-case` (call/cc escape), `cl-restart-case`/`cl-with-simple-restart`, `cl-find-restart`/`cl-invoke-restart`/`cl-compute-restarts`, `cl-with-condition-restarts`; 55 new tests in `tests/conditions.sx` (123 total runtime tests). Key gotcha: `cl-condition-classes` must be captured at define-time via `let` in `cl-condition-of-type?` — free-variable lookup at call-time fails through env_merge parent chain.