Skip to content

refactor(native): remove call kind from AST node extraction#734

Merged
carlos-alm merged 4 commits intomainfrom
refactor/remove-call-kind
Apr 1, 2026
Merged

refactor(native): remove call kind from AST node extraction#734
carlos-alm merged 4 commits intomainfrom
refactor/remove-call-kind

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Remove call AST node extraction from native Rust enginecall_types field removed from LangAstConfig struct and all 19 per-language configs, call extraction block removed from walk_ast_nodes_with_config_depth and JS-specific walk_ast_nodes_depth
  • Remove call AST node extraction from WASM visitorcall_expression: 'call' removed from astTypes, all call-specific helpers (extractCallName, extractCallReceiver, walkCallArguments, walkSubtree, findChildByKind) removed from ast-store-visitor.ts
  • Remove 'call' from ASTNodeKind type and AST_NODE_KINDS constant

Call sites are already captured in FileSymbols.calls during extraction and stored as graph edges. The call entries in ast_nodes were written but never queried by any command or feature.

Net: −344 lines of dead code.

Closes #701

Test plan

  • TypeScript type check passes (tsc --noEmit)
  • Lint clean (biome — 0 errors)
  • Integration AST tests pass (17/17)
  • WASM AST node tests pass (18/18 WASM, 1 native skip — stale binary)
  • All-langs AST tests pass (23/23 WASM, 1 native skip — stale binary)
  • CI full suite — native binary tests will pass once rebuilt with these Rust changes

Call sites are already captured in FileSymbols.calls during extraction
and stored as graph edges. The call entries in ast_nodes were written
but never queried by any command or feature — dead data that the JS
side had to filter out for engine parity.

Rust:
- Remove call_types from LangAstConfig and all 19 per-language configs
- Remove call extraction block from walk_ast_nodes_with_config_depth
- Remove call_expression match arm from JS walk_ast_nodes_depth
- Remove extract_js_call_ast and extract_call_receiver helpers

TypeScript:
- Remove call_expression:'call' from JS/TS astTypes map
- Remove call handling from ast-store-visitor (extractCallName,
  extractCallReceiver, walkCallArguments, walkSubtree, findChildByKind)
- Remove 'call' from ASTNodeKind type and AST_NODE_KINDS

Closes #701
@claude
Copy link
Copy Markdown

claude bot commented Apr 1, 2026

Claude finished @carlos-alm's task —— View job


Review Complete ✅

I've conducted a thorough review of this PR following the 5-phase methodology:

Todo List

  • Phase 1: Root cause analysis - understand the problem being solved
  • Phase 2: Configuration change detection - check for rule relaxations
  • Phase 3: Test integrity verification - ensure tests aren't weakened
  • Phase 4: Code quality review - analyze the actual changes
  • Phase 5: Backlog compliance assessment - rate against project criteria
  • Final Assessment: Provide structured review with rating and recommendation

Phase 1: Root Cause Analysis ✅

Problem Being Solved: Removing dead code - specifically AST node extraction for call types that were being collected but never queried.

Evidence:

  • Call sites are already captured during extraction in FileSymbols.calls and stored as graph edges
  • The call entries in ast_nodes were written to storage but never read by any command or feature
  • This is legitimate dead code removal, not hiding symptoms

Why This Approach: Clean removal of unused functionality across both engines (native Rust + WASM) maintains consistency and reduces maintenance burden.

Phase 2: Configuration Change Detection ✅

No configuration rule relaxations found. The changes are pure code removals:

  • Biome config untouched
  • No test timeouts increased or coverage thresholds lowered
  • No build configuration changes
  • No TypeScript strict mode flags disabled

Phase 3: Test Integrity Verification ✅

Tests properly updated, not weakened:

  • AST_NODE_KINDS constant correctly updated to remove 'call' (line 118: ['new', 'string', 'regex', 'throw', 'await'])
  • Test assertions updated to reflect new reality, not lowered expectations
  • Added explicit test: "native does not emit call AST nodes" (ast-parity.test.ts:113-118) - this is excellent defensive testing
  • Integration test count expectations updated appropriately (reduced by number of removed call nodes)

This is exactly the right approach - tests verify the new behavior rather than just accepting lower standards.

Phase 4: Code Quality Review ✅

Excellent systematic removal:

  • Rust native engine: Removed call_types field from LangAstConfig struct across all 19 language configs, removed call extraction logic from walker functions
  • TypeScript WASM: Removed call_expression: 'call' from astTypes, removed all call-specific helpers (extractCallName, extractCallReceiver, etc.)
  • Type definitions: Correctly updated ASTNodeKind type to remove 'call'
  • Critical insight: Call extraction for dependency analysis remains intact (parser.ts:137-139) - only AST node storage was removed

No security concerns, no performance regressions. The removal is clean and complete.

Phase 5: Backlog Compliance Assessment ✅

Zero-dep: ✓ (removes code, adds no dependencies)
Foundation-aligned: ✓ (improves maintenance, no principle violations)
Problem-fit: 4/5 (reduces codebase complexity for AI agents, eliminates confusion between call edges vs call AST nodes)
Breaking: No (purely internal, no API changes)
Tier: 1 (zero-dep ✓ + foundation-aligned ✓)

Root Cause Analysis

Problem Being Solved: Dead code removal - AST call nodes were collected but never queried
Why This Approach: Systematic cleanup across dual-engine architecture maintains consistency
Risk Assessment: Very low - call dependency tracking remains intact, only unused storage removed

Backlog Compliance

  • Zero-dep: ✓ (removes code)
  • Foundation-aligned: ✓ (improves maintainability)
  • Problem-fit: 4 (reduces AI agent confusion)
  • Breaking: No
  • Tier: 1

Critical Concerns

None. This is exemplary dead code removal.

Final Recommendation

  • Rating: ⭐⭐⭐⭐☆ (4/5)
  • Action: APPROVE
  • Reasoning: Clean, systematic removal of genuinely dead code with excellent test coverage. The addition of explicit "does not emit call AST nodes" test shows thoughtful defensive programming. Only reason it's not 5 stars is this is maintenance rather than feature work.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR removes the call AST node kind from both the native Rust engine and the WASM visitor, eliminating ~344 lines of dead code. Call sites were already captured in FileSymbols.calls as graph edges, so the call entries in ast_nodes were written but never consumed by any query, command, or feature.

Key changes:

  • call_types field removed from LangAstConfig and all 19 per-language configs in helpers.rs; JS-specific extract_js_call_ast and the call match arm removed from javascript.rs
  • WASM visitor helpers extractCallName, extractCallReceiver, walkSubtree, walkCallArguments, and findChildByKind deleted from ast-store-visitor.ts; receiver field is now always null
  • 'call' removed from the ASTNodeKind union type, AST_NODE_KINDS array, CLI help text, and icon map
  • Tests updated throughout; native-engine test suites retain a transitional 'call' entry in validKinds to tolerate the still-published v3.7.0 binary, and build-parity.test.ts applies a filterCall shim until the new binary ships — both are clearly commented and easy to clean up later

Confidence Score: 5/5

Safe to merge — pure dead-code removal with no behavioral change to any live feature.

All changes are strictly subtractive, no existing query or command consumed call AST nodes, and the transitional compatibility shims in the test suite are well-scoped and documented. No P0 or P1 findings.

No files require special attention. The transitional guards in tests/integration/build-parity.test.ts and tests/engines/ast-parity.test.ts should be removed once the next native binary is published.

Important Files Changed

Filename Overview
crates/codegraph-core/src/extractors/helpers.rs Removes call_types from LangAstConfig struct and all 19 per-language config instances, and deletes the ~37-line call extraction block and extract_call_receiver helper from walk_ast_nodes_with_config_depth.
crates/codegraph-core/src/extractors/javascript.rs Removes the call_expression match arm from the JS-specific walk_ast_nodes_depth and deletes extract_js_call_ast; updates the function's doc comment.
src/ast-analysis/visitors/ast-store-visitor.ts Removes call-specific helpers (extractCallName, extractCallReceiver, walkSubtree, walkCallArguments, findChildByKind) and the call branch in collectNode; receiver field is now always null.
src/types.ts Removes 'call' from the ASTNodeKind union type.
tests/integration/build-parity.test.ts Adds a transitional filterCall filter that strips call nodes before comparing native vs WASM parity, accommodating the stale published binary (v3.7.0).

Reviews (2): Last reviewed commit: "fix: accept call kind transitionally in ..." | Re-trigger Greptile

@carlos-alm
Copy link
Copy Markdown
Contributor Author

Fixed in 86c3ae5 — updated both the command description (line 7) and --kind option description (line 10) in src/cli/commands/ast.ts to remove call/calls from the listed kinds.

Also fixed the CI failures: the tests were asserting no call kind in AST nodes, but the published native binary (v3.7.0) still emits them since the Rust changes haven't been published yet. The test assertions now accept call transitionally, with comments explaining when the tolerance can be removed (828702c).

@carlos-alm
Copy link
Copy Markdown
Contributor Author

@greptileai

@carlos-alm carlos-alm merged commit f1b30af into main Apr 1, 2026
18 checks passed
@carlos-alm carlos-alm deleted the refactor/remove-call-kind branch April 1, 2026 10:35
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(native): remove call kind from Rust AST node extraction

1 participant