diff --git a/src/ast-analysis/visitors/ast-store-visitor.ts b/src/ast-analysis/visitors/ast-store-visitor.ts index 53a983ea..661ceae2 100644 --- a/src/ast-analysis/visitors/ast-store-visitor.ts +++ b/src/ast-analysis/visitors/ast-store-visitor.ts @@ -269,6 +269,13 @@ export function createAstStoreVisitor( // unrelated subtree. The parent call's skipChildren handles the intended case. if (matched.has(node.id)) return; + // Gate with `hasOwn` because plain-object lookup walks Object.prototype: + // tree-sitter node types like `constructor` (Haskell sum-types: Left, + // Right) would otherwise resolve to `Object.prototype.constructor` (the + // Object() function), which then crashes the worker boundary with + // "function Object() { [native code] } could not be cloned" when the + // resulting astNodes row is structured-cloned back to the main thread. + if (!Object.hasOwn(astTypeMap, node.type)) return; const kind = astTypeMap[node.type]; if (!kind) return; diff --git a/tests/benchmarks/regression-guard.test.ts b/tests/benchmarks/regression-guard.test.ts index 15e266da..a12a451c 100644 --- a/tests/benchmarks/regression-guard.test.ts +++ b/tests/benchmarks/regression-guard.test.ts @@ -90,9 +90,14 @@ const SKIP_VERSIONS = new Set(['3.8.0']); * above the natural variance of the small target set. Not reproducible * locally (~30ms steady-state); will be re-validated on v3.9.7+ data. * - * - 3.9.6:resolution haskell precision/recall — separate Haskell resolver - * regression introduced in 3.9.6, unrelated to #1036 / PR #1038. Tracked - * in #1039. + * - 3.9.6:resolution haskell precision/recall — Haskell AST visitor walked + * `astTypeMap` with bracket-notation lookup, so node type `constructor` + * (Haskell sum-types: Left, Right) resolved to `Object.prototype.constructor` + * instead of `undefined`. The Object() function landed in the astNodes row + * and crashed the worker boundary with "function Object() could not be + * cloned", skipping every Haskell file with constructors. Fixed by gating + * with `Object.hasOwn` (#1039). Benchmarks captured before the fix landed; + * will reclear in v3.9.7+ data. */ const KNOWN_REGRESSIONS = new Set([ '3.9.0:1-file rebuild',