fix: close engine parity gap between native and WASM#309
Conversation
WASM query path missed constants (no query pattern for lexical_declaration) — add targeted extractConstantsWalk() to extractSymbolsQuery(). Native missed destructured TS params (only checked "identifier", not "shorthand_property_identifier_pattern") — add fallback chain and kind check in extract_js_parameters(). Also align is_js_literal() with WASM's isConstantValue() (add array, object, unary/binary/new_expression). Remove EXTENDED kind filters from build-parity test so all node kinds are compared directly. Add constant and destructured-param parity test cases. Impact: 4 functions changed, 4 affected
|
Claude finished @carlos-alm's task —— View job PR Review: Engine Parity FixReviewing this PR using the 4-phase methodology for codegraph engine parity fixes. Todo List
Root Cause Analysis ✅Problem Being Solved: Legitimate engine parity gaps between native Rust and WASM implementations. The v3.0.0 dogfood report showed native produced +89 nodes / +75 edges more than WASM due to three distinct bugs:
Why This Approach: The fixes are targeted and surgical:
Risk Assessment: ✅ Low risk. This fixes actual bugs rather than masking symptoms. Configuration Change Detection ✅Analysis: No high-risk configuration changes detected:
The only "configuration" change is removing the Test Integrity ✅Analysis: Tests are strengthened, not weakened: Positive Changes:
Validation:
Conclusion: This is exactly what good testing looks like - removing workarounds when the underlying issue is fixed. Code Quality Review ✅JavaScript WASM Extractor (
|
Greptile SummaryClosed three independent parity bugs between native (Rust) and WASM (JavaScript) engines that caused native to produce +89 nodes / +75 edges more than WASM. Fixes implemented:
All test suites pass, including new test cases for constants and destructured parameters. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: ce91999 |
Summary
Closes the engine parity gap reported in the v3.0.0 dogfood report (Section 5). Native produced +89 nodes / +75 edges more than WASM due to two independent bugs:
extractSymbolsQuery) had no pattern forlexical_declaration/variable_declaration, soconst X = <literal>was never detected. AddedextractConstantsWalk()— a targeted walk of top-level children that fills this gap without a full tree traversal.extract_js_parametersin Rust only checkedpattern.kind() == "identifier", missingshorthand_property_identifier_pattern(e.g.{ name, age }). Added fallback chain (pattern→left→child(0)) and the missing kind check.is_js_literalincomplete: Was missingarray,object,unary_expression,binary_expression,new_expression— now aligned with WASM'sisConstantValue().Also removed the
EXTENDEDkind filter frombuild-parity.test.jsthat was masking these bugs — all node kinds are now compared directly.Test plan
npx vitest run tests/engines/parity.test.js— 10 passed (new constant + destructured param cases)npx vitest run tests/integration/build-parity.test.js— 2 passed (no filtered kinds)npx vitest run tests/integration/build.test.js— 16 passednpx vitest run tests/parsers/javascript.test.js— 20 passednpm run lint— clean (1 pre-existing warning)