HS: asyncError — rejected promise triggers catch block (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s

Three-part fix for hs-upstream-core/asyncError test 2/2:

1. runtime.sx hs-win-call: when an async call returns a rejected promise,
   store the error value in window.__hs_async_error (side-channel) and
   raise the sentinel "__hs_async_error__" so the value survives the
   raise boundary intact.

2. compiler.sx catch clause: inject `(let ((var (host-hs-normalize-exc var))) ...)`
   around the catch body so the sentinel gets swapped for the real error
   object before user code runs. Uses let (not set!) so shadowing works
   correctly for guard catch variables.

3. tests/hs-run-filtered.js:
   - host-promise-state wraps JS Error objects as plain {message:...} dicts
     before they cross the WASM boundary (Error.toString() was producing
     "Error: boom" strings instead of accessible objects)
   - host-hs-normalize-exc native retrieves the side-channel value when
     the sentinel arrives in a catch variable
   - host-get coercion restricted to El instances — plain JS objects with
     a "value" key were being stringified to "[object Object]"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 02:07:52 +00:00
parent 846650da07
commit abbb1fe5c6
8 changed files with 175 additions and 172 deletions

View File

@@ -4,10 +4,10 @@ Live tally for `plans/hs-conformance-to-100.md`. Update after every cluster comm
```
Baseline: 1213/1496 (81.1%)
Merged: 1343/1496 (89.8%) delta +130
Merged: 1376/1496 (92.0%) delta +163
Worktree: all landed
Target: 1496/1496 (100.0%)
Remaining: ~161 tests (clusters 17/29(partial)/33/34 partial)
Remaining: ~120 tests (clusters 17/29(partial)/33/34 partial)
```
## Cluster ledger
@@ -88,6 +88,8 @@ Defer until AD drain. Estimated ~25 recoverable tests.
| F2 | empty multi-element (query→for-each) | done | +1 | 875e9ba3 |
| F3 | hs-make-object _order + assert= for dicts | done | +1 | daea2808 |
| F4 | array literal arg to JS fn (sxToJs + reduce→SX) | done | +1 | da2e6b1b |
| F5 | `bind` feature parser stub | done | +32 | 846650da |
| F6 | `asyncError` rejected promise catch | done | +1 | — |
## Buckets roll-up