flow: retry combinator — re-run node on raised exceptions + 6 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s

(retry n node) re-runs up to n attempts on a raised exception; the last attempt's
exception propagates. Explicit (fail ...) values are NOT retried — they pass through.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 16:39:21 +00:00
parent f3da3b975a
commit 4674620d7e
5 changed files with 47 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ federation extension via fed-sx for remote-node execution.
## Status (rolling)
`bash lib/flow/conformance.sh`**36/36** (Phase 1 done; Phase 2 in progress)
`bash lib/flow/conformance.sh`**42/42** (Phase 1 done; Phase 2 in progress)
## Ground rules
@@ -77,7 +77,9 @@ lib/flow/spec.sx lib/flow/runtime.sx lib/flow/store.sx
- [x] `cond` combinator — predicate selects branch (named `branch`; `cond` is a
Scheme special form). `(branch pred then else)` — 6 tests.
- [ ] `retry n [backoff]` — re-runs node up to n times on exception
- [x] `retry n` — re-runs node up to n attempts on a raised exception; last
exception propagates. Only raised exceptions are retried — `(fail ...)` values
pass through. 6 tests. (Backoff deferred: no wall clock in pure SX.)
- [ ] `timeout ms` — bounds node execution
- [x] `try-catch` — exception handler with reified error: `(try-catch node handler)`
runs node; on raise, calls `(handler error)` and returns its value. 6 tests.