Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ast-analysis/visitors/ast-store-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
11 changes: 8 additions & 3 deletions tests/benchmarks/regression-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading