11 Commits

Author SHA1 Message Date
ea63b6d9bb plans: log precision number-to-string iteration
Some checks are pending
Test, Build, and Deploy / test-build-deploy (push) Waiting to run
2026-04-25 14:42:44 +00:00
5d7f931cf1 js-on-sx: high-precision number-to-string via round-trip + digit extraction
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
- js-big-int-str-loop: extract decimal digits from integer-valued float
- js-find-decimal-k: find min decimal places k where round(n*10^k)/10^k == n
- js-format-decimal-digits: insert decimal point into digit string at position (len-k)
- js-number-to-string: if 6-sig-fig round-trip fails AND n in [1e-6, 1e21),
  use digit extraction for full precision (up to 17 sig figs)
- String(1.0000001)="1.0000001", String(1/3)="0.3333333333333333"
- String test262 subset: 58→62/100

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 14:42:32 +00:00
79f3e1ada2 plans: log String wrapper + number-to-string sci notation iteration
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 14:27:25 +00:00
4d00250233 js-on-sx: String wrapper objects + number-to-string sci notation expansion
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
- js-to-string: return __js_string_value__ for String wrapper dicts
- js-loose-eq: coerce String wrapper objects to primitive before compare
- String.__callable__: set __js_string_value__ + length on 'this' when called as constructor
- js-expand-sci-notation: new helper converts mantissa+exp to decimal or integer form
- js-number-to-string: expand 1e-06→0.000001, 1e+06→1000000; fix 1e+21 (was 1e21)
- String test262 subset: 45→58/100

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 14:27:13 +00:00
80c21cbabb js-on-sx: String fixes — fromCodePoint, multi-arg indexOf/split/lastIndexOf, matchAll, constructor, js-to-string dict
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
- String.fromCodePoint added (BMP + surrogate pairs)
- indexOf/lastIndexOf/split now accept optional second argument (fromIndex / limit)
- matchAll stub added to js-string-method and String.prototype
- String property else-branch now falls back to String.prototype (fixes 'a'.constructor === String)
- js-to-string for dict returns [object Object] instead of recursing into circular String.prototype.constructor structure
- js-list-take helper added for split limit

Scoreboard: String 42→43, timeouts 32→13, total 162→202/300 (54%→67.3%). 529/530 unit, 148/148 slice.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 13:41:58 +00:00
70f91ef3d8 plans: log Math methods iteration
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 12:47:27 +00:00
5f38e49ba4 js-on-sx: add missing Math methods (trig, log, hyperbolic, clz32, imul, fround)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 12:47:12 +00:00
0f9d361a92 plans: tick var hoisting, add progress log entry
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 12:19:07 +00:00
11315d91cc js-on-sx: var hoisting — hoist var names as undefined before funcdecls
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 12:18:42 +00:00
f16e1b69c0 js-on-sx: tick ASI checkbox, append progress log entry
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:53:45 +00:00
ae86579ae8 js-on-sx: ASI — :nl token flag + return restricted production (525/526 unit, 148/148 slice)
Lexer: adds :nl (newline-before) boolean to every token. scan! resets the flag
before each skip-ws! call; skip-ws! sets it true when it consumes \n or \r.
Parser: jp-token-nl? reads the flag; jp-parse-return-stmt stops before the
expression when a newline precedes it (return\n42 → return undefined). Four
new tests cover the restricted production and the raw flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:53:33 +00:00
13 changed files with 412 additions and 222 deletions

View File

@@ -94,7 +94,7 @@
(fn
(src)
(let
((tokens (list)) (pos 0) (src-len (len src)))
((tokens (list)) (pos 0) (src-len (len src)) (nl-before false))
(define
js-peek
(fn
@@ -109,11 +109,7 @@
(let
((sl (len s)))
(and (<= (+ pos sl) src-len) (= (slice src pos (+ pos sl)) s)))))
(define
js-emit!
(fn
(type value start)
(append! tokens (js-make-token type value start))))
(define js-emit! (fn (type value start) (append! tokens {:pos start :value value :type type :nl nl-before})))
(define
skip-line-comment!
(fn
@@ -136,7 +132,13 @@
()
(cond
((>= pos src-len) nil)
((js-ws? (cur)) (do (advance! 1) (skip-ws!)))
((js-ws? (cur))
(do
(when
(or (= (cur) "\n") (= (cur) "\r"))
(set! nl-before true))
(advance! 1)
(skip-ws!)))
((and (= (cur) "/") (< (+ pos 1) src-len) (= (js-peek 1) "/"))
(do (advance! 2) (skip-line-comment!) (skip-ws!)))
((and (= (cur) "/") (< (+ pos 1) src-len) (= (js-peek 1) "*"))
@@ -568,6 +570,7 @@
(fn
()
(do
(set! nl-before false)
(skip-ws!)
(when
(< pos src-len)

View File

@@ -835,6 +835,12 @@
jp-eat-semi
(fn (st) (if (jp-at? st "punct" ";") (do (jp-advance! st) nil) nil)))
(define
jp-token-nl?
(fn
(st)
(let ((tok (jp-peek st))) (if tok (= (get tok :nl) true) false))))
(define
jp-parse-vardecl
(fn
@@ -1166,6 +1172,7 @@
(or
(jp-at? st "punct" ";")
(jp-at? st "punct" "}")
(jp-token-nl? st)
(jp-at? st "eof" nil))
(do (jp-eat-semi st) (list (quote js-return) nil))
(let

View File

@@ -1169,7 +1169,14 @@
((= v false) "false")
((= (type-of v) "string") v)
((= (type-of v) "number") (js-number-to-string v))
(else (str v)))))
(else
(if
(= (type-of v) "dict")
(if
(contains? (keys v) "__js_string_value__")
(get v "__js_string_value__")
"[object Object]")
(str v))))))
(define
js-template-concat
@@ -1187,6 +1194,79 @@
(+ i 1)
(str acc (js-to-string (nth parts i)))))))
(define
js-big-int-str-loop
(fn
(n acc)
(if
(< n 1)
(if (= acc "") "0" acc)
(let
((d (floor (- n (* 10 (floor (/ n 10)))))))
(js-big-int-str-loop
(floor (/ n 10))
(str (js-string-slice "0123456789" d (+ d 1)) acc))))))
(define
js-find-decimal-k
(fn
(n k)
(if
(> k 17)
17
(let
((big-int (round (* n (js-pow-int 10 k)))))
(if
(= (/ big-int (js-pow-int 10 k)) n)
k
(js-find-decimal-k n (+ k 1)))))))
(define
js-format-decimal-digits
(fn
(digits k)
(if
(= k 0)
digits
(let
((dlen (len digits)))
(if
(> dlen k)
(str
(js-string-slice digits 0 (- dlen k))
"."
(js-string-slice digits (- dlen k) dlen))
(if
(= dlen k)
(str "0." digits)
(str "0." (js-string-repeat "0" (- k dlen)) digits)))))))
(define
js-expand-sci-notation
(fn
(mant exp-n)
(let
((di (js-string-index-of mant "." 0)))
(let
((int-part (if (< di 0) mant (js-string-slice mant 0 di)))
(frac-part
(if (< di 0) "" (js-string-slice mant (+ di 1) (len mant)))))
(let
((all-digits (str int-part frac-part))
(frac-len (if (< di 0) 0 (- (- (len mant) di) 1))))
(if
(>= exp-n 0)
(if
(>= exp-n frac-len)
(str all-digits (js-string-repeat "0" (- exp-n frac-len)))
(let
((dot-pos (+ (len int-part) exp-n)))
(str
(js-string-slice all-digits 0 dot-pos)
"."
(js-string-slice all-digits dot-pos (len all-digits)))))
(str "0." (js-string-repeat "0" (- (- 0 exp-n) 1)) all-digits)))))))
(define
js-number-to-string
(fn
@@ -1195,7 +1275,16 @@
((js-number-is-nan n) "NaN")
((= n (js-infinity-value)) "Infinity")
((= n (- 0 (js-infinity-value))) "-Infinity")
(else (js-normalize-num-str (str n))))))
(else
(let
((pos-n (if (< n 0) (- 0 n) n)))
(let
((s0 (js-normalize-num-str (str pos-n))))
(let
((n2 (js-to-number s0)))
(let
((precise (if (= n2 pos-n) (let ((ei (js-string-index-of s0 "e" 0))) (if (< ei 0) s0 (let ((exp-n (js-to-number (js-string-slice s0 (+ ei 1) (len s0))))) (if (and (>= exp-n -6) (<= exp-n 20)) (js-expand-sci-notation (js-string-slice s0 0 ei) exp-n) (if (>= exp-n 0) (str (js-string-slice s0 0 (+ ei 1)) "+" (str exp-n)) s0))))) (if (and (>= pos-n 1e-06) (< pos-n 1e+21)) (let ((k (js-find-decimal-k pos-n 0))) (let ((big-int (round (* pos-n (js-pow-int 10 k))))) (js-format-decimal-digits (js-big-int-str-loop big-int "") k))) (let ((ei (js-string-index-of s0 "e" 0))) (if (< ei 0) s0 (let ((exp-n (js-to-number (js-string-slice s0 (+ ei 1) (len s0))))) (if (>= exp-n 0) (str (js-string-slice s0 0 (+ ei 1)) "+" (str exp-n)) s0))))))))
(if (< n 0) (str "-" precise) precise)))))))))
(define
js-normalize-num-str
@@ -1296,6 +1385,10 @@
(= (js-to-number a) b))
((= (type-of a) "boolean") (js-loose-eq (js-to-number a) b))
((= (type-of b) "boolean") (js-loose-eq a (js-to-number b)))
((and (dict? a) (contains? (keys a) "__js_string_value__"))
(js-loose-eq (get a "__js_string_value__") b))
((and (dict? b) (contains? (keys b) "__js_string_value__"))
(js-loose-eq a (get b "__js_string_value__")))
(else false))))
(define js-loose-neq (fn (a b) (not (js-loose-eq a b))))
@@ -1903,7 +1996,15 @@
(char-code (char-at s idx))
0))))
((= name "indexOf")
(fn (needle) (js-string-index-of s (js-to-string needle) 0)))
(fn
(&rest args)
(if
(empty? args)
-1
(js-string-index-of
s
(js-to-string (nth args 0))
(if (< (len args) 2) 0 (max 0 (js-num-to-int (nth args 1))))))))
((= name "slice")
(fn
(&rest args)
@@ -1927,7 +2028,16 @@
(js-string-slice s lo (min hi (len s)))))))
((= name "toUpperCase") (fn () (js-upper-case s)))
((= name "toLowerCase") (fn () (js-lower-case s)))
((= name "split") (fn (sep) (js-string-split s (js-to-string sep))))
((= name "split")
(fn
(&rest args)
(let
((sep (if (= (len args) 0) :js-undefined (nth args 0)))
(limit
(if (< (len args) 2) -1 (js-num-to-int (nth args 1)))))
(let
((result (js-string-split s (js-to-string sep))))
(if (< limit 0) result (js-list-take result limit))))))
((= name "concat")
(fn (&rest args) (js-string-concat-loop s args 0)))
((= name "includes")
@@ -2042,6 +2152,17 @@
(= idx -1)
nil
(let ((res (list))) (append! res needle) res))))))))
((= name "matchAll")
(fn
(&rest args)
(if
(empty? args)
(list)
(let
((needle (js-to-string (nth args 0))))
(let
((loop (fn (start acc) (let ((idx (js-string-index-of s needle start))) (if (= idx -1) acc (let ((m (list))) (begin (append! m needle) (dict-set! m "index" idx) (loop (+ idx (max 1 (len needle))) (begin (append! acc m) acc)))))))))
(loop 0 (list)))))))
((= name "at")
(fn
(i)
@@ -2068,7 +2189,14 @@
-1
(let
((needle (js-to-string (nth args 0))))
(js-string-last-index-of s needle (- (len s) (len needle)))))))
(let
((default-start (- (len s) (len needle)))
(from
(if (< (len args) 2) -1 (js-num-to-int (nth args 1)))))
(js-string-last-index-of
s
needle
(if (< from 0) default-start (min from default-start))))))))
((= name "localeCompare")
(fn
(&rest args)
@@ -2166,6 +2294,15 @@
((not (= (char-at s (+ si ni)) (char-at needle ni))) false)
(else (js-string-matches? s needle si (+ ni 1))))))
(define
js-list-take
(fn
(lst n)
(if
(or (<= n 0) (empty? lst))
(list)
(cons (first lst) (js-list-take (rest lst) (- n 1))))))
(define
js-string-split
(fn
@@ -2306,7 +2443,13 @@
(js-string-method obj "toLocaleUpperCase"))
((= key "isWellFormed") (js-string-method obj "isWellFormed"))
((= key "toWellFormed") (js-string-method obj "toWellFormed"))
(else js-undefined)))
(else
(let
((proto (get String "prototype")))
(if
(and (dict? proto) (contains? (keys proto) key))
(get proto key)
js-undefined)))))
((= (type-of obj) "dict")
(js-dict-get-walk obj (js-to-string key)))
((and (= obj Promise) (dict-has? __js_promise_statics__ (js-to-string key)))
@@ -2480,7 +2623,49 @@
((n (js-to-number (first args))))
(js-math-hypot-loop (rest args) (+ acc (* n n)))))))
(define Math {:random js-math-random :trunc js-math-trunc :LN10 2.30259 :SQRT1_2 0.707107 :floor js-math-floor :PI 3.14159 :sqrt js-math-sqrt :hypot js-math-hypot :LOG2E 1.4427 :round js-math-round :ceil js-math-ceil :abs js-math-abs :pow js-math-pow :max js-math-max :LOG10E 0.434294 :SQRT2 1.41421 :cbrt js-math-cbrt :min js-math-min :sign js-math-sign :E 2.71828 :LN2 0.693147})
(begin
(define js-math-sin (fn (x) (sin (js-to-number x))))
(define js-math-cos (fn (x) (cos (js-to-number x))))
(define js-math-tan (fn (x) (tan (js-to-number x))))
(define js-math-asin (fn (x) (asin (js-to-number x))))
(define js-math-acos (fn (x) (acos (js-to-number x))))
(define js-math-atan (fn (x) (atan (js-to-number x))))
(define
js-math-atan2
(fn (y x) (atan2 (js-to-number y) (js-to-number x))))
(define js-math-sinh (fn (x) (sinh (js-to-number x))))
(define js-math-cosh (fn (x) (cosh (js-to-number x))))
(define js-math-tanh (fn (x) (tanh (js-to-number x))))
(define js-math-asinh (fn (x) (asinh (js-to-number x))))
(define js-math-acosh (fn (x) (acosh (js-to-number x))))
(define js-math-atanh (fn (x) (atanh (js-to-number x))))
(define js-math-exp (fn (x) (exp (js-to-number x))))
(define js-math-log (fn (x) (log (js-to-number x))))
(define js-math-log2 (fn (x) (log2 (js-to-number x))))
(define js-math-log10 (fn (x) (log10 (js-to-number x))))
(define js-math-expm1 (fn (x) (expm1 (js-to-number x))))
(define js-math-log1p (fn (x) (log1p (js-to-number x))))
(define
js-math-clz32
(fn
(&rest args)
(let
((x (if (empty? args) 0 (js-to-number (nth args 0)))))
(let
((n (modulo (floor x) 4294967296)))
(if (= n 0) 32 (- 31 (floor (log2 n))))))))
(define
js-math-imul
(fn
(a b)
(let
((a32 (modulo (floor (js-to-number a)) 4294967296))
(b32 (modulo (floor (js-to-number b)) 4294967296)))
(let
((result (modulo (* a32 b32) 4294967296)))
(if (>= result 2147483648) (- result 4294967296) result)))))
(define js-math-fround (fn (x) (js-to-number x)))
(define Math {:trunc js-math-trunc :expm1 js-math-expm1 :atan2 js-math-atan2 :PI 3.14159 :asinh js-math-asinh :acosh js-math-acosh :hypot js-math-hypot :LOG2E 1.4427 :atanh js-math-atanh :ceil js-math-ceil :pow js-math-pow :sin js-math-sin :max js-math-max :log2 js-math-log2 :SQRT2 1.41421 :cbrt js-math-cbrt :log1p js-math-log1p :fround js-math-fround :E 2.71828 :sinh js-math-sinh :random js-math-random :LN10 2.30259 :SQRT1_2 0.707107 :asin js-math-asin :clz32 js-math-clz32 :floor js-math-floor :exp js-math-exp :tan js-math-tan :sqrt js-math-sqrt :cosh js-math-cosh :log js-math-log :round js-math-round :abs js-math-abs :LOG10E 0.434294 :tanh js-math-tanh :acos js-math-acos :log10 js-math-log10 :min js-math-min :sign js-math-sign :LN2 0.693147 :cos js-math-cos :imul js-math-imul :atan js-math-atan}))
(define
js-number-is-finite
@@ -2986,6 +3171,35 @@
js-string-from-char-code
(fn (&rest args) (js-string-from-char-code-loop args 0 "")))
(define
js-string-from-code-point-loop
(fn
(args i acc)
(if
(>= i (len args))
acc
(let
((cp (floor (js-to-number (nth args i)))))
(if
(< cp 65536)
(js-string-from-code-point-loop
args
(+ i 1)
(str acc (js-code-to-char (js-num-to-int cp))))
(let
((hi (+ 55296 (floor (/ (- cp 65536) 1024))))
(lo (+ 56320 (modulo (- cp 65536) 1024))))
(js-string-from-code-point-loop
args
(+ i 1)
(str
(str acc (js-code-to-char (js-num-to-int hi)))
(js-code-to-char (js-num-to-int lo))))))))))
(define
js-string-from-code-point
(fn (&rest args) (js-string-from-code-point-loop args 0 "")))
(define
js-string-from-char-code-loop
(fn
@@ -3016,8 +3230,32 @@
(dict-set! String "name" "String")
(dict-set! String "fromCodePoint" js-string-from-code-point)
(dict-set!
String
"__callable__"
(fn
(&rest args)
(let
((raw (if (= (len args) 0) "" (js-to-string (nth args 0)))))
(let
((this-val (js-this)))
(if
(dict? this-val)
(begin
(dict-set! this-val "__js_string_value__" raw)
(dict-set! this-val "length" (len raw))
this-val)
raw)))))
(define Boolean {:__callable__ (fn (&rest args) (if (= (len args) 0) false (js-to-boolean (nth args 0))))})
(dict-set!
(get String "prototype")
"matchAll"
(js-string-proto-fn "matchAll"))
(dict-set! Boolean "length" 1)
(dict-set! Boolean "name" "Boolean")

View File

@@ -1323,6 +1323,25 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 3505)
(eval "(js-eval \"var a = {length: 3, 0: 10, 1: 20, 2: 30}; var sum = 0; Array.prototype.forEach.call(a, function(x){sum += x;}); sum\")")
;; ── Phase 1.ASI: automatic semicolon insertion ─────────────────
(epoch 4200)
(eval "(js-eval \"function f() { return\n42\n} f()\")")
(epoch 4201)
(eval "(js-eval \"function g() { return 42 } g()\")")
(epoch 4202)
(eval "(let ((toks (js-tokenize \"a\nb\"))) (get (nth toks 1) :nl))")
(epoch 4203)
(eval "(let ((toks (js-tokenize \"a b\"))) (get (nth toks 1) :nl))")
(epoch 4300)
(eval "(js-eval \"var x = 5; x\")")
(epoch 4301)
(eval "(js-eval \"function f() { return x; var x = 42; } f()\")")
(epoch 4302)
(eval "(js-eval \"function f() { var y = 7; return y; } f()\")")
(epoch 4303)
(eval "(js-eval \"function f() { var z; z = 3; return z; } f()\")")
EPOCHS
@@ -2042,6 +2061,17 @@ check 3503 "indexOf.call arrLike" '1'
check 3504 "filter.call arrLike" '"2,3"'
check 3505 "forEach.call arrLike sum" '60'
# ── Phase 1.ASI: automatic semicolon insertion ────────────────────
check 4200 "return+newline → undefined" '"js-undefined"'
check 4201 "return+space+val → val" '42'
check 4202 "nl-before flag set after newline" 'true'
check 4203 "nl-before flag false on same line" 'false'
check 4300 "var decl program-level" '5'
check 4301 "var hoisted before use → undef" '"js-undefined"'
check 4302 "var in function body" '7'
check 4303 "var then set in function" '3'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "$PASS/$TOTAL JS-on-SX tests passed"

View File

@@ -1,84 +1,42 @@
{
"totals": {
"pass": 162,
"fail": 128,
"skip": 1597,
"timeout": 10,
"total": 1897,
"runnable": 300,
"pass_rate": 54.0
"pass": 62,
"fail": 29,
"skip": 1130,
"timeout": 9,
"total": 1230,
"runnable": 100,
"pass_rate": 62.0
},
"categories": [
{
"category": "built-ins/Math",
"total": 327,
"pass": 43,
"fail": 56,
"skip": 227,
"timeout": 1,
"pass_rate": 43.0,
"top_failures": [
[
"TypeError: not a function",
36
],
[
"Test262Error (assertion failed)",
20
],
[
"Timeout",
1
]
]
},
{
"category": "built-ins/Number",
"total": 340,
"pass": 77,
"fail": 19,
"skip": 240,
"timeout": 4,
"pass_rate": 77.0,
"top_failures": [
[
"Test262Error (assertion failed)",
19
],
[
"Timeout",
4
]
]
},
{
"category": "built-ins/String",
"total": 1223,
"pass": 42,
"fail": 53,
"pass": 62,
"fail": 29,
"skip": 1123,
"timeout": 5,
"pass_rate": 42.0,
"timeout": 9,
"pass_rate": 62.0,
"top_failures": [
[
"Test262Error (assertion failed)",
44
24
],
[
"Timeout",
5
],
[
"ReferenceError (undefined symbol)",
2
],
[
"Unhandled: Not callable: {:__proto__ {:toLowerCase <lambda(&rest, args)",
2
9
],
[
"Unhandled: Not callable: \\\\\\",
2
1
],
[
"ReferenceError (undefined symbol)",
1
],
[
"SyntaxError (parse/unsupported syntax)",
1
]
]
},
@@ -96,34 +54,26 @@
"top_failure_modes": [
[
"Test262Error (assertion failed)",
83
],
[
"TypeError: not a function",
36
24
],
[
"Timeout",
10
],
[
"ReferenceError (undefined symbol)",
2
],
[
"Unhandled: Not callable: {:__proto__ {:toLowerCase <lambda(&rest, args)",
2
9
],
[
"Unhandled: Not callable: \\\\\\",
2
1
],
[
"ReferenceError (undefined symbol)",
1
],
[
"SyntaxError (parse/unsupported syntax)",
1
],
[
"Unhandled: Not callable: {:__proto__ {:valueOf <lambda()> :propertyIsEn",
"TypeError: not a function",
1
],
[
@@ -132,6 +82,6 @@
]
],
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
"elapsed_seconds": 274.5,
"workers": 1
"elapsed_seconds": 40.5,
"workers": 7
}

View File

@@ -1,47 +1,32 @@
# test262 scoreboard
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
Wall time: 274.5s
Wall time: 40.5s
**Total:** 162/300 runnable passed (54.0%). Raw: pass=162 fail=128 skip=1597 timeout=10 total=1897.
**Total:** 62/100 runnable passed (62.0%). Raw: pass=62 fail=29 skip=1130 timeout=9 total=1230.
## Top failure modes
- **83x** Test262Error (assertion failed)
- **36x** TypeError: not a function
- **10x** Timeout
- **2x** ReferenceError (undefined symbol)
- **2x** Unhandled: Not callable: {:__proto__ {:toLowerCase <lambda(&rest, args)
- **2x** Unhandled: Not callable: \\\
- **24x** Test262Error (assertion failed)
- **9x** Timeout
- **1x** Unhandled: Not callable: \\\
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)
- **1x** Unhandled: Not callable: {:__proto__ {:valueOf <lambda()> :propertyIsEn
- **1x** TypeError: not a function
- **1x** Unhandled: js-transpile-binop: unsupported op: >>>\
## Categories (worst pass-rate first, min 10 runnable)
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|---|---:|---:|---:|---:|---:|---:|
| built-ins/String | 42 | 53 | 1123 | 5 | 1223 | 42.0% |
| built-ins/Math | 43 | 56 | 227 | 1 | 327 | 43.0% |
| built-ins/Number | 77 | 19 | 240 | 4 | 340 | 77.0% |
| built-ins/String | 62 | 29 | 1123 | 9 | 1223 | 62.0% |
## Per-category top failures (min 10 runnable, worst first)
### built-ins/String (42/100 — 42.0%)
### built-ins/String (62/100 — 62.0%)
- **44x** Test262Error (assertion failed)
- **5x** Timeout
- **2x** ReferenceError (undefined symbol)
- **2x** Unhandled: Not callable: {:__proto__ {:toLowerCase <lambda(&rest, args)
- **2x** Unhandled: Not callable: \\\
### built-ins/Math (43/100 — 43.0%)
- **36x** TypeError: not a function
- **20x** Test262Error (assertion failed)
- **1x** Timeout
### built-ins/Number (77/100 — 77.0%)
- **19x** Test262Error (assertion failed)
- **4x** Timeout
- **24x** Test262Error (assertion failed)
- **9x** Timeout
- **1x** Unhandled: Not callable: \\\
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)

View File

@@ -486,6 +486,51 @@
(append inits (list (js-transpile body))))))))
(list (js-sym "fn") param-syms body-tr))))
(define
js-collect-var-decl-names
(fn
(decls)
(cond
((empty? decls) (list))
((js-tag? (first decls) "js-vardecl")
(cons
(nth (first decls) 1)
(js-collect-var-decl-names (rest decls))))
(else (js-collect-var-decl-names (rest decls))))))
(define
js-collect-var-names
(fn
(stmts)
(cond
((empty? stmts) (list))
((and (list? (first stmts)) (js-tag? (first stmts) "js-var") (= (nth (first stmts) 1) "var"))
(append
(js-collect-var-decl-names (nth (first stmts) 2))
(js-collect-var-names (rest stmts))))
(else (js-collect-var-names (rest stmts))))))
(define
js-dedup-names
(fn
(names seen)
(cond
((empty? names) (list))
((some (fn (s) (= s (first names))) seen)
(js-dedup-names (rest names) seen))
(else
(cons
(first names)
(js-dedup-names (rest names) (cons (first names) seen)))))))
(define
js-var-hoist-forms
(fn
(names)
(map
(fn (name) (list (js-sym "define") (js-sym name) :js-undefined))
names)))
(define
js-transpile-tpl
(fn
@@ -876,7 +921,7 @@
(fn
(stmts)
(let
((hoisted (js-collect-funcdecls stmts)))
((hoisted (append (js-var-hoist-forms (js-dedup-names (js-collect-var-names stmts) (list))) (js-collect-funcdecls stmts))))
(let
((rest-stmts (js-transpile-stmt-list stmts)))
(cons (js-sym "begin") (append hoisted rest-stmts))))))
@@ -1297,7 +1342,7 @@
(if
(and (list? body) (js-tag? body "js-block"))
(let
((hoisted (js-collect-funcdecls (nth body 1))))
((hoisted (append (js-var-hoist-forms (js-dedup-names (js-collect-var-names (nth body 1)) (list))) (js-collect-funcdecls (nth body 1)))))
(append hoisted (js-transpile-stmt-list (nth body 1))))
(list (js-transpile body)))))
(list
@@ -1333,7 +1378,7 @@
(if
(and (list? body) (js-tag? body "js-block"))
(let
((hoisted (js-collect-funcdecls (nth body 1))))
((hoisted (append (js-var-hoist-forms (js-dedup-names (js-collect-var-names (nth body 1)) (list))) (js-collect-funcdecls (nth body 1)))))
(append hoisted (js-transpile-stmt-list (nth body 1))))
(list (js-transpile body)))))
(list

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: 1280/1496 (85.6%) delta +67
Merged: 1277/1496 (85.4%) delta +64
Worktree: all landed
Target: 1496/1496 (100.0%)
Remaining: ~216 tests (clusters 17/22/29/31/32 blocked; 31/32 need dedicated sx-tree worktree; 33 partial)
Remaining: ~219 tests (cluster 29 blocked on sx-tree MCP outage + parser scope)
```
## Cluster ledger
@@ -61,9 +61,9 @@ Remaining: ~216 tests (clusters 17/22/29/31/32 blocked; 31/32 need dedicated sx
| # | Cluster | Status | Δ |
|---|---------|--------|---|
| 31 | runtime null-safety error reporting | blocked | — |
| 32 | MutationObserver mock + `on mutation` | blocked | — |
| 33 | cookie API | partial | +3 |
| 31 | runtime null-safety error reporting | pending | (+1518 est) |
| 32 | MutationObserver mock + `on mutation` | pending | (+1015 est) |
| 33 | cookie API | pending | (+5 est) |
| 34 | event modifier DSL | pending | (+68 est) |
| 35 | namespaced `def` | pending | (+3 est) |
@@ -88,7 +88,7 @@ Defer until AD drain. Estimated ~25 recoverable tests.
| A | 12 | 4 | 0 | 0 | 1 | — | 17 |
| B | 6 | 0 | 0 | 0 | 1 | — | 7 |
| C | 4 | 0 | 0 | 0 | 1 | — | 5 |
| D | 0 | 1 | 0 | 2 | 2 | — | 5 |
| D | 0 | 0 | 0 | 5 | 0 | — | 5 |
| E | 0 | 0 | 0 | 0 | 0 | 5 | 5 |
| F | — | — | — | ~10 | — | — | ~10 |

View File

@@ -115,11 +115,11 @@ Orchestrator cherry-picks worktree commits onto `architecture` one at a time; re
### Bucket D: medium features (bigger commits, plan-first)
31. **[blocked: Bucket-D plan-first scope, doesn't fit one cluster budget. All 18 tests are SKIP (untranslated) — generator has no `error("HS")` helper. Required pieces: (a) generator-side `eval-hs-error` helper + recognizer for `expect(await error("HS")).toBe("MSG")` blocks; (b) runtime helpers `hs-null-error!` / `hs-named-target` / `hs-named-target-list` raising `'<sel>' is null`; (c) compiler patches at every target-position `(query SEL)` emit to wrap in named-target carrying the original selector source — that's ~17 command emit paths (add, remove, hide, show, measure, settle, trigger, send, set, default, increment, decrement, put, toggle, transition, append, take); (d) function-call null-check at bare `(name)`, `hs-method-call`, and `host-get` chains, deriving the leftmost-uncalled-name `'x'` / `'x.y'` from the parse tree; (e) possessive-base null-check (`set x's y to true``'x' is null`). Each piece is straightforward in isolation but the cross-cutting compiler change touches every emit path and needs a coordinated design pass. Recommend a dedicated design doc + multi-commit worktree like buckets E36-E40.] runtime null-safety error reporting** — 18 tests in `runtimeErrors`. When accessing `.foo` on nil, emit a structured error with position info. One coordinated fix in the compiler emit paths for property access, function calls, set/put. Expected: +15-18.
31. **[pending] runtime null-safety error reporting** — 18 tests in `runtimeErrors`. When accessing `.foo` on nil, emit a structured error with position info. One coordinated fix in the compiler emit paths for property access, function calls, set/put. Expected: +15-18.
32. **[blocked: environment + scope. (env) The `loops/hs` worktree at `/root/rose-ash-loops/hs/` ships without a built sx-tree MCP binary; even after running `dune build bin/mcp_tree.exe` on this iteration, the tools don't surface to the current session — they'd need to load at session start, and rebuilding doesn't re-register them. CLAUDE.md mandates sx-tree for any `.sx` edit and a hook blocks Edit/Read/Write on `.sx`/`.sxc`. (scope) The cluster needs coordinated changes across `lib/hyperscript/parser.sx` (recognise `on mutation of <filter>` with attribute/childList/characterData/`@name [or @name]*`), `lib/hyperscript/compiler.sx` (analogue of intersection's `:having`-style attach call passing filter info), `lib/hyperscript/runtime.sx` (`hs-on-mutation-attach!` constructing real `MutationObserver` with config matched to filter, dispatching `mutation` event with detail), `tests/hs-run-filtered.js` (replace the no-op MutationObserver mock with a working version + hook `El.setAttribute`/`appendChild`/etc. to fire registered observers), `tests/playwright/generate-sx-tests.py` (drop 7 mutation entries from `SKIP_TEST_NAMES`). The current parser drops bodies after `of` because `parse-on-feat` only consumes `having` clauses — confirmed via compile snapshot (`on mutation of attributes put "Mutated" into me``(hs-on me "mutation" (fn (event) nil))`). Recommended path: dedicated worktree with sx-tree loaded at session start, multi-commit (parser, compiler+attach, mock+runner, generator skip-list pruning).] MutationObserver mock + `on mutation` dispatch** — 15 tests in `on`. Add MO mock to runner. Compile `on mutation [of attribute/childList/attribute-specific]`. Expected: +10-15.
32. **[pending] MutationObserver mock + `on mutation` dispatch** — 15 tests in `on`. Add MO mock to runner. Compile `on mutation [of attribute/childList/attribute-specific]`. Expected: +10-15.
33. **[done (+3) — partial, `basic clear cookie values work` needs `hs-method-call` runtime fallback to dispatch unknown methods through `host-call` (current `hs-method-call` returns nil for non-{map,push,filter,join,indexOf} methods, so `cookies.clear('foo')` is silently a no-op); `iterate cookies values work` needs `hs-for-each` to recognise host-array/proxy collections (currently `(list? collection)` returns false for the JS Proxy so the loop body never runs). Both need runtime.sx edits → next worktree.] cookie API** — 5 tests in `expressions/cookies`. `document.cookie` mock in runner + `the cookies` + `set the xxx cookie` keywords. Expected: +5.
33. **[pending] cookie API** — 5 tests in `expressions/cookies`. `document.cookie` mock in runner + `the cookies` + `set the xxx cookie` keywords. Expected: +5.
34. **[pending] event modifier DSL** — 8 tests in `on`. `elsewhere`, `every`, `first click`, count filters (`once / twice / 3 times`, ranges), `from elsewhere`. Expected: +6-8.
@@ -177,15 +177,6 @@ Many tests are `SKIP (untranslated)` because `tests/playwright/generate-sx-tests
(Reverse chronological — newest at top.)
### 2026-04-25 — cluster 33 cookie API (partial +3)
- No `.sx` edits needed — `set cookies.foo to 'bar'` already compiles to `(dom-set-prop cookies "foo" "bar")` which becomes `(host-set! cookies "foo" "bar")` once the `dom` module is loaded, and `cookies.foo` becomes `(host-get cookies "foo")`. So a JS-only Proxy + Python generator change does the trick. Two parts: (a) `tests/hs-run-filtered.js` adds a per-test `__hsCookieStore` Map, a `globalThis.cookies` Proxy with `length`/`clear`/named-key get traps and a set trap that writes the store, and a `Object.defineProperty(document, 'cookie', …)` getter/setter that reads and writes the same store (so the upstream `length is 0` test's pre-clear loop over `document.cookie` works). Per-test reset clears the store. (b) `tests/playwright/generate-sx-tests.py` declares `(define cookies (host-global "cookies"))` in the test header and emits hand-rolled deftests for the three tractable tests (`basic set`, `update`, `length is 0`). Suite hs-upstream-expressions/cookies: 0/5 → 3/5. Smoke 0-195 unchanged at 170/195. Remaining `basic clear` and `iterate` tests need runtime.sx edits (hs-method-call fallback + hs-for-each host-array recognition) — out of scope for a JS-only iteration.
### 2026-04-25 — cluster 32 MutationObserver mock + on mutation dispatch (blocked)
- Two issues conspire: (1) `loops/hs` worktree has no pre-built sx-tree binary so MCP tools aren't loaded, and the block-sx-edit hook prevents raw `Edit`/`Read`/`Write` on `.sx` files. Built `hosts/ocaml/_build/default/bin/mcp_tree.exe` via `dune build` this iteration but tools don't surface mid-session. (2) Cluster scope is genuinely big: parser must learn `on mutation of <filter>` (currently drops body after `of` — verified via compile dump: `on mutation of attributes put "Mutated" into me``(hs-on me "mutation" (fn (event) nil))`), compiler needs `:of-filter` plumbing similar to intersection's `:having`, runtime needs `hs-on-mutation-attach!`, JS runner mock needs a real MutationObserver (currently no-op `class{observe(){}disconnect(){}}` at hs-run-filtered.js:348) plus `setAttribute`/`appendChild` instrumentation, and 7 entries removed from `SKIP_TEST_NAMES`. Recommended next step: dedicated worktree where sx-tree loads at session start, multi-commit shape (parser → compiler+attach → mock+runner → generator skip-list).
### 2026-04-25 — cluster 31 runtime null-safety error reporting (blocked)
- All 18 tests are `SKIP (untranslated)` — generator has no `error("HS")` helper at all. Inspected representative compile outputs: `add .foo to #doesntExist``(for-each ... (hs-query-all "#doesntExist"))` (silently no-ops on empty list, no error); `hide #doesntExist``(hs-hide! (hs-query-all "#doesntExist") "display")` (likewise); `put 'foo' into #doesntExist``(hs-set-inner-html! (hs-query-first "#doesntExist") "foo")` (passes nil through); `x()``(x)` (raises `Undefined symbol: x`, wrong format); `x.y.z()``(hs-method-call (host-get x "y") "z")`. Implementing this requires generator helper + 17 compiler emit-path patches + function-call/method-call/possessive-base null guards + new `hs-named-target`/`hs-named-target-list` runtime — too many surfaces for a single-iteration commit. Bucket D explicitly says "plan-first" — recommended path is a dedicated design doc and multi-commit worktree like E36-E40, not a loop iteration.
### 2026-04-24 — cluster 29 hyperscript:before:init / :after:init / :parse-error (blocked)
- **2b486976** — `HS-plan: mark cluster 29 blocked`. sx-tree MCP file ops returning `Yojson__Safe.Util.Type_error("Expected string, got null")` on every file-based call (sx_read_subtree, sx_find_all, sx_replace_by_pattern, sx_summarise, sx_pretty_print, sx_write_file). Only in-memory ops work (sx_eval, sx_build, sx_env). Without sx-tree I can't edit integration.sx to add before:init/after:init dispatch on hs-activate!. Investigated the 6 tests: 2 bootstrap (before/after init) need dispatchEvent wrapping activate; 4 parser tests require stricter parser error-rejection — `add - to` currently parses silently to `(set! nil (hs-add-to! (- 0 nil) nil))`, `on click blargh end on mouseenter also_bad` parses silently to `(do (hs-on me "click" (fn (event) blargh)) (hs-on me "mouseenter" (fn (event) also_bad)))`. Fundamental parser refactor is out of single-cluster budget regardless of sx-tree availability.

View File

@@ -65,7 +65,7 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
- [x] Punctuation: `( ) { } [ ] , ; : . ...`
- [x] Operators: `+ - * / % ** = == === != !== < > <= >= && || ! ?? ?: & | ^ ~ << >> >>> += -= ...`
- [x] Comments (`//`, `/* */`)
- [ ] Automatic Semicolon Insertion (defer — initially require semicolons)
- [x] Automatic Semicolon Insertion (defer — initially require semicolons)
### Phase 2 — Expression parser (Pratt-style)
- [x] Literals → AST nodes
@@ -124,7 +124,7 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
- [x] Closures — work via SX `fn` env capture
- [x] Rest params (`...rest``&rest`)
- [x] Default parameters (desugar to `if (param === undefined) param = default`)
- [ ] `var` hoisting (deferred — treated as `let` for now)
- [x] `var` hoisting (shallow — collects direct `var` decls, emits `(define name :js-undefined)` before funcdecls)
- [ ] `let`/`const` TDZ (deferred)
### Phase 8 — Objects, prototypes, `this`
@@ -158,6 +158,18 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
- 2026-04-25 — **High-precision number-to-string via round-trip + digit extraction.** `js-big-int-str-loop` extracts decimal digits from integer-valued float. `js-find-decimal-k` finds minimum decimal places k where `round(n*10^k)/10^k == n` (up to 17). `js-format-decimal-digits` inserts decimal point. `js-number-to-string` now uses digit extraction when 6-sig-fig round-trip fails and n in [1e-6, 1e21): `String(1.0000001)="1.0000001"`, `String(1/3)="0.3333333333333333"`. String test262 subset: 58→62/100. 529/530 unit, 148/148 slice.
- 2026-04-25 — **String wrapper objects + number-to-string sci notation.** `js-to-string` now returns `__js_string_value__` for String wrapper dicts instead of `"[object Object]"`. `js-loose-eq` coerces String wrapper objects (new String()) to primitive before comparison. String `__callable__` sets `__js_string_value__` + `length` on `this` when called as constructor. New `js-expand-sci-notation` helper converts mantissa+exp-n to decimal or integer form; `js-number-to-string` now expands `1e-06→0.000001`, `1e+06→1000000`, fixes `1e21→1e+21`. String test262 subset: 45→58/100. 529/530 unit, 148/148 slice.
- 2026-04-25 — **String fixes (constructor, indexOf/split/lastIndexOf multi-arg, fromCodePoint, matchAll, js-to-string dict fix).** Added `String.fromCodePoint` (fixes 1 ReferenceError); fixed `indexOf`/`lastIndexOf`/`split` to accept optional second argument; added `matchAll` stub; wired string property dispatch `else` fallback to `String.prototype` (fixes `'a'.constructor === String`); fixed `js-to-string` for dicts to return `"[object Object]"` instead of recursing into circular `String.prototype.constructor` structure. Scoreboard: String 42→43, timeouts 32→13. Total 162→202/300 (54%→67.3%). 529/530 unit, 148/148 slice.
- 2026-04-25 — **Math methods (trig/log/hyperbolic/bit ops).** Added 22 missing Math methods to `runtime.sx`: `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh`, `exp`, `log`, `log2`, `log10`, `expm1`, `log1p`, `clz32`, `imul`, `fround`. All use existing SX primitives. `clz32` uses log2-based formula; `imul` uses modulo arithmetic; `fround` stubs to identity. Addresses 36x "TypeError: not a function" in built-ins/Math (43% → ~79% expected). 529/530 unit (unchanged), 148/148 slice. Commit `5f38e49b`.
- 2026-04-25 — **`var` hoisting.** Added `js-collect-var-decl-names`, `js-collect-var-names`, `js-dedup-names`, `js-var-hoist-forms` helpers to `transpile.sx`. Modified `js-transpile-stmts`, `js-transpile-funcexpr`, and `js-transpile-funcexpr-async` to prepend `(define name :js-undefined)` forms for all `var`-declared names before function-declaration hoists. Shallow collection (direct statements only). 4 new tests: program-level var, hoisted before use → undefined, var in function, var + assign. 529/530 unit (+4), 148/148 slice unchanged. Commit `11315d91`.
- 2026-04-25 — **ASI (Automatic Semicolon Insertion).** Lexer: added `:nl` (newline-before) boolean to every token dict; `skip-ws!` sets it true when consuming `\n`/`\r`; `scan!` resets it to `false` at the start of each token scan. Parser: new `jp-token-nl?` helper reads `:nl` from the current token; `jp-parse-return-stmt` stops before parsing the expression when `jp-token-nl?` is true (restricted production: `return\nvalue``return undefined`). 4 new tests (flag presence, flag value, restricted return). 525/526 unit (+4), 148/148 slice unchanged. Commit `ae86579a`.
- 2026-04-23 — scaffold landed: lib/js/{lexer,parser,transpile,runtime}.sx stubs + test.sh. 7/7 smoke tests pass (js-tokenize/js-parse/js-transpile stubs + js-to-boolean coercion cases).
- 2026-04-23 — Phase 1 (Lexer) complete: numbers (int/float/hex/exp/leading-dot), strings (escapes), idents/keywords, punctuation, all operators (1-4 char, longest-match), // and /* */ comments. 38/38 tests pass. Gotchas found: `peek` and `emit!` are primitives (shadowed to `js-peek`, `js-emit!`); `cond` clauses take ONE body only, multi-expr needs `(do ...)` wrapper.
- 2026-04-23 — Phase 2 (Pratt expression parser) complete: literals, binary precedence (w/ `**` right-assoc), unary (`- + ! ~ typeof void`), member access (`.`/`[]`), call chains, array/object literals (ident+string+number keys), ternary, arrow fns (zero/one/many params; curried), assignment (right-assoc incl. compound `+=` etc.). AST node shapes all match the `js-*` names already wired. 47 new tests, 85/85 total. Most of the Phase 2 scaffolding was already written in an earlier session — this iteration verified every path, added the parser test suite, and greened everything on the first pass. No new gotchas beyond Phase 1.

View File

@@ -8,7 +8,6 @@
;; references them (e.g. `window.tmp`) can resolve through the host.
(define window (host-global "window"))
(define document (host-global "document"))
(define cookies (host-global "cookies"))
(define hs-test-el
(fn (tag hs-src)
@@ -4886,21 +4885,13 @@
(deftest "basic clear cookie values work"
(error "SKIP (untranslated): basic clear cookie values work"))
(deftest "basic set cookie values work"
(hs-cleanup!)
(assert (nil? (eval-hs "cookies.foo")))
(eval-hs "set cookies.foo to 'bar'")
(assert= (eval-hs "cookies.foo") "bar"))
(error "SKIP (untranslated): basic set cookie values work"))
(deftest "iterate cookies values work"
(error "SKIP (untranslated): iterate cookies values work"))
(deftest "length is 0 when no cookies are set"
(hs-cleanup!)
(assert= (eval-hs "cookies.length") 0))
(error "SKIP (untranslated): length is 0 when no cookies are set"))
(deftest "update cookie values work"
(hs-cleanup!)
(eval-hs "set cookies.foo to 'bar'")
(assert= (eval-hs "cookies.foo") "bar")
(eval-hs "set cookies.foo to 'doh'")
(assert= (eval-hs "cookies.foo") "doh"))
(error "SKIP (untranslated): update cookie values work"))
)
;; ── expressions/dom-scope (20 tests) ──

View File

@@ -327,36 +327,6 @@ const document = {
createEvent(t){return new Ev(t);}, addEventListener(){}, removeEventListener(){},
};
globalThis.document=document; globalThis.window=globalThis; globalThis.HTMLElement=El; globalThis.Element=El;
// cluster-33: cookie store + document.cookie + cookies Proxy.
globalThis.__hsCookieStore = new Map();
Object.defineProperty(document, 'cookie', {
get(){ const out=[]; for(const[k,v] of globalThis.__hsCookieStore) out.push(k+'='+v); return out.join('; '); },
set(s){
const str=String(s||'');
const m=str.match(/^\s*([^=]+?)\s*=\s*([^;]*)/);
if(!m) return;
const name=m[1].trim();
const val=m[2];
if(/expires=Thu,?\s*01\s*Jan\s*1970/i.test(str) || val==='') globalThis.__hsCookieStore.delete(name);
else globalThis.__hsCookieStore.set(name, val);
},
configurable: true,
});
globalThis.cookies = new Proxy({}, {
get(_, k){
if(k==='length') return globalThis.__hsCookieStore.size;
if(k==='clear') return (name)=>globalThis.__hsCookieStore.delete(String(name));
if(typeof k==='symbol' || k==='_type' || k==='_order') return undefined;
return globalThis.__hsCookieStore.has(k) ? globalThis.__hsCookieStore.get(k) : null;
},
set(_, k, v){ globalThis.__hsCookieStore.set(String(k), String(v)); return true; },
has(_, k){ return globalThis.__hsCookieStore.has(k); },
ownKeys(){ return Array.from(globalThis.__hsCookieStore.keys()); },
getOwnPropertyDescriptor(_, k){
if(globalThis.__hsCookieStore.has(k)) return {value: globalThis.__hsCookieStore.get(k), enumerable: true, configurable: true};
return undefined;
},
});
// cluster-28: test-name-keyed confirm/prompt/alert mocks. The upstream
// ask/answer tests each expect a deterministic return value. Keyed on
// globalThis.__currentHsTestName which the test loop sets before each test.
@@ -570,7 +540,6 @@ for(let i=startTest;i<Math.min(endTest,testCount);i++){
// Reset body
_body.children=[];_body.childNodes=[];_body.innerHTML='';_body.textContent='';
globalThis.__test_selection='';
globalThis.__hsCookieStore.clear();
globalThis.__currentHsTestName = name;
// Enable step limit for timeout protection

View File

@@ -1832,36 +1832,6 @@ def generate_eval_only_test(test, idx):
lines = []
safe_name = sx_name(test['name'])
# Special case: cluster-33 cookie tests. Each test calls a sequence of
# `_hyperscript("HS")` inside `page.evaluate(()=>{...})`. The runner backs
# `cookies` with a Proxy over a per-test `__hsCookieStore` map (see
# tests/hs-run-filtered.js). Tests handled: basic set, length-when-empty,
# update. clear/iterate stay SKIP (need hs-method-call→host-call dispatch
# and host-array iteration in hs-for-each — out of cluster-33 scope).
if test['name'] == 'basic set cookie values work':
return (
f' (deftest "{safe_name}"\n'
f' (hs-cleanup!)\n'
f' (assert (nil? (eval-hs "cookies.foo")))\n'
f' (eval-hs "set cookies.foo to \'bar\'")\n'
f' (assert= (eval-hs "cookies.foo") "bar"))'
)
if test['name'] == 'update cookie values work':
return (
f' (deftest "{safe_name}"\n'
f' (hs-cleanup!)\n'
f' (eval-hs "set cookies.foo to \'bar\'")\n'
f' (assert= (eval-hs "cookies.foo") "bar")\n'
f' (eval-hs "set cookies.foo to \'doh\'")\n'
f' (assert= (eval-hs "cookies.foo") "doh"))'
)
if test['name'] == 'length is 0 when no cookies are set':
return (
f' (deftest "{safe_name}"\n'
f' (hs-cleanup!)\n'
f' (assert= (eval-hs "cookies.length") 0))'
)
# Special case: logAll config test. Body sets `_hyperscript.config.logAll = true`,
# then mutates an element's innerHTML and calls `_hyperscript.processNode`.
# Our runtime exposes this via hs-set-log-all! + hs-log-captured; we reuse
@@ -2642,7 +2612,6 @@ output.append(';; Bind `window` and `document` as plain SX symbols so HS code th
output.append(';; references them (e.g. `window.tmp`) can resolve through the host.')
output.append('(define window (host-global "window"))')
output.append('(define document (host-global "document"))')
output.append('(define cookies (host-global "cookies"))')
output.append('')
output.append('(define hs-test-el')
output.append(' (fn (tag hs-src)')