Skip to content

fix: parser extraction bugs exposed by workspace-wide test expansion#9

Open
anvanster wants to merge 491 commits into
mainfrom
gnhf/review-test-coverage-88a98f
Open

fix: parser extraction bugs exposed by workspace-wide test expansion#9
anvanster wants to merge 491 commits into
mainfrom
gnhf/review-test-coverage-88a98f

Conversation

@anvanster

Copy link
Copy Markdown
Member

What Changed

  • Added roughly 4,100 net-new unit tests across all 43 workspace crates - language parser visitors/mappers/extractors/parser_impls, codegraph-server domain and MCP modules, core graph/export/storage/query, codegraph-memory, codegraph-parser-api, and codegraph-harness - bringing the full workspace suite to 6,261 passing tests.
  • Fixed real parser behavior bugs in 16 language crates that the new tests surfaced, changing extraction output: for example Lua local-assigned functions and double-counted requires, Java interface-extends parents and enum-body methods, Kotlin wildcard imports and function parameters, Swift async/parameter/return-type detection, C# return-type extraction, Python match-statement cyclomatic complexity, Perl require/use-parent imports, R variadic parameters, and TOML nested-pair extraction with a metrics double-count fix.
  • Included behavior-preserving refactors that extract testable helpers in codegraph-server and codegraph-harness (e.g. impact classification, git status parsing, JSON-RPC framing), a shared test-env lock serializing all HOME/USERPROFILE-mutating tests in the codegraph-server test binary, removal of two dead zero-byte files, and workspace-wide rustfmt/clippy cleanup.

Risk Assessment

✅ Low: The remaining unreviewed delta is 10 lines of test-only env-lock guards that correctly and completely close the round-3 finding; a full sweep of both codegraph-server test binaries and the codegraph-memory crate found no residual unguarded HOME/USERPROFILE readers or mutators.

Testing

Ran the full cargo workspace test suite covering all 43 crates that received net-new tests (121 binaries, 6,261 tests, all passing), then stress-tested the env-lock flakiness fix by running the codegraph-server lib and bin test binaries 10 times in a row at 16 threads with zero failures; transcripts, a per-crate breakdown of the 4,118 new tests, and a sample of the new tests passing are saved as evidence, and the worktree was left clean. No visual evidence applies since the change is test-only with no UI surface.

Evidence: Full workspace test transcript (121 binaries, 6,261 passed, 0 failed)
warning: output filename collision at /Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/target/debug/examples/basic_parse
  |
  = note: the example target `basic_parse` in package `codegraph-python v0.4.3 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-python)` has the same output filename as the example target `basic_parse` in package `codegraph-php v0.2.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-php)`
  = note: this may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>
  = help: consider changing their names to be unique or compiling them separately
warning: output filename collision at /Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/target/debug/examples/basic_parse.dSYM
  |
  = note: the example target `basic_parse` in package `codegraph-python v0.4.3 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-python)` has the same output filename as the example target `basic_parse` in package `codegraph-php v0.2.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-php)`
  = note: this may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>
  = help: consider changing their names to be unique or compiling them separately
   Compiling libc v0.2.184
   Compiling hashbrown v0.16.1
   Compiling codegraph v0.2.0 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph)
   Compiling plotters-backend v0.3.7
   Compiling ciborium-io v0.2.2
   Compiling itertools v0.10.5
   Compiling cast v0.3.0
   Compiling tinytemplate v1.2.1
   Compiling anes v0.1.6
   Compiling oorandom v11.1.5
   Compiling codegraph-server v0.19.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-server)
   Compiling rustix v0.38.44
   Compiling unsafe-libyaml v0.2.11
   Compiling ciborium-ll v0.2.2
   Compiling home v0.5.12
   Compiling plotters-svg v0.3.7
   Compiling indexmap v2.13.1
   Compiling jobserver v0.1.34
   Compiling clang-sys v1.8.1
   Compiling getrandom v0.2.17
   Compiling errno v0.3.14
   Compiling ciborium v0.2.2
   Compiling filetime v0.2.27
   Compiling plotters v0.3.7
   Compiling criterion-plot v0.5.0
   Compiling socks v0.3.4
   Compiling cpufeatures v0.2.17
   Compiling rustix v1.1.4
   Compiling cc v1.2.59
   Compiling serde_json v1.0.149
   Compiling serde_yaml v0.9.34+deprecated
   Compiling sha2 v0.10.9
   Compiling getrandom v0.4.2
   Compiling fs2 v0.4.3
   Compiling is-terminal v0.4.17
   Compiling parking_lot_core v0.9.12
   Compiling bindgen v0.72.1
   Compiling bindgen v0.69.5
   Compiling uuid v1.23.0
   Compiling criterion v0.5.1
   Compiling getrandom v0.3.4
   Compiling parking_lot v0.12.5
   Compiling xattr v1.6.1
   Compiling signal-hook-registry v1.4.8
   Compiling lz4-sys v1.11.1+lz4-1.10.0
   Compiling bzip2-sys v0.1.13+1.0.8
   Compiling libz-sys v1.1.25
   Compiling tree-sitter v0.25.10
   Compiling ring v0.17.14
   Compiling tree-sitter-python v0.25.0
   Compiling tar v0.4.45
   Compiling tempfile v3.27.0
   Compiling rand_core v0.9.5
   Compiling onig_sys v69.9.1
   Compiling socket2 v0.6.3
   Compiling mio v1.2.0
   Compiling rand_chacha v0.9.0
   Compiling tokio v1.51.0
   Compiling esaxx-rs v0.1.10
   Compiling console v0.15.11
   Compiling indicatif v0.17.11
   Compiling rand v0.9.2
   Compiling librocksdb-sys v0.16.0+8.10.0
   Compiling rand_core v0.6.4
   Compiling zstd-sys v2.0.16+zstd.1.5.7
   Compiling dirs-sys v0.5.0
   Compiling rav1e v0.8.1
   Compiling rand_chacha v0.3.1
   Compiling ahash v0.8.12
   Compiling dirs v6.0.0
   Compiling tree-sitter v0.20.10
   Compiling rand v0.8.5
   Compiling tree-sitter-verilog v1.0.3
   Compiling tree-sitter-kotlin v0.3.5
   Compiling dashmap v5.5.3
   Compiling num_cpus v1.17.0
   Compiling instant-distance v0.6.1
   Compiling tree-sitter-php v0.24.2
   Compiling tree-sitter-c-sharp v0.23.5
   Compiling tree-sitter-scala v0.25.0
   Compiling tree-sitter-go v0.25.0
   Compiling tree-sitter-solidity v1.2.13
   Compiling tree-sitter-elm v5.9.0
   Compiling tree-sitter-lua v0.5.0
   Compiling tree-sitter-erlang v0.15.0
   Compiling tree-sitter-rust v0.24.2
   Compiling tree-sitter-swift v0.7.1
   Compiling codegraph-dockerfile v0.1.0 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-dockerfile)
   Compiling tree-sitter-typescript v0.23.2
   Compiling tree-sitter-java v0.23.5
   Compiling tree-sitter-c v0.24.1
   Compiling tree-sitter-css v0.25.0
   Compiling ravif v0.13.0
   Compiling tree-sitter-ruby v0.23.1
   Compiling tree-sitter-cpp v0.23.4
   Compiling tree-sitter-clojure v0.1.0
   Compiling image v0.25.10
   Compiling codegraph-kotlin v0.1.2 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-kotlin)
   Compiling rustls v0.23.37
   Compiling codegraph-verilog v0.1.0 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-verilog)
   Compiling rustls-webpki v0.103.10
warning: codegraph-dockerfile@0.1.0: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar: illegal option -- D
warning: codegraph-dockerfile@0.1.0: usage:  ar -d [-TLsv] archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -m [-TLsv] archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -m [-abiTLsv] position archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -p [-TLsv] archive [file ...]
warning: codegraph-dockerfile@0.1.0: 	ar -q [-cTLsv] archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -r [-cuTLsv] archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -r [-abciuTLsv] position archive file ...
warning: codegraph-dockerfile@0.1.0: 	ar -t [-TLsv] archive [file ...]
warning: codegraph-dockerfile@0.1.0: 	ar -x [-ouTLsv] archive [file ...]
   Compiling ureq v2.12.1
   Compiling tokio-stream v0.1.18
   Compiling hf-hub v0.4.3
   Compiling tree-sitter-groovy v0.1.2
   Compiling codegraph-tcl v0.1.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-tcl)
   Compiling tree-sitter-objc v3.0.2
   Compiling tree-sitter-yaml v0.7.2
   Compiling tree-sitter-elixir v0.3.5
   Compiling tree-sitter-haskell v0.23.1
   Compiling tree-sitter-julia v0.23.1
   Compiling tree-sitter-hcl v1.1.0
   Compiling tree-sitter-toml-ng v0.7.0
   Compiling tree-sitter-bash v0.25.1
   Compiling tree-sitter-ocaml v0.24.2
   Compiling ort-sys v2.0.0-rc.9
   Compiling onig v6.5.1
   Compiling tokenizers v0.21.4
   Compiling ort v2.0.0-rc.9
   Compiling tokio-test v0.4.5
warning: codegraph-tcl@0.1.1: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar: illegal option -- D
warning: codegraph-tcl@0.1.1: usage:  ar -d [-TLsv] archive file ...
warning: codegraph-tcl@0.1.1: 	ar -m [-TLsv] archive file ...
warning: codegraph-tcl@0.1.1: 	ar -m [-abiTLsv] position archive file ...
warning: codegraph-tcl@0.1.1: 	ar -p [-TLsv] archive [file ...]
warning: codegraph-tcl@0.1.1: 	ar -q [-cTLsv] archive file ...
warning: codegraph-tcl@0.1.1: 	ar -r [-cuTLsv] archive file ...
warning: codegraph-tcl@0.1.1: 	ar -r [-abciuTLsv] position archive file ...
warning: codegraph-tcl@0.1.1: 	ar -t [-TLsv] archive [file ...]
warning: codegraph-tcl@0.1.1: 	ar -x [-ouTLsv] archive [file ...]
   Compiling fastembed v4.9.1
   Compiling tokio-util v0.7.18
   Compiling tree-sitter-fortran v0.5.1
   Compiling fsevent-sys v4.1.0
   Compiling sysinfo v0.30.13
   Compiling codegraph-r v0.2.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-r)
   Compiling notify v6.1.1
   Compiling tower-lsp v0.20.0
   Compiling codegraph-zig v0.2.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85RXJ/crates/codegraph-zig)
   Compiling codegraph-dart v0.2.1 (/Users/anvanster/.no-mistakes/worktrees/b8216ba13cd2/01KWGV0YG7MSV4NMV0SXC85

... [439179 bytes truncated] ...

... ok
test test_parse_sample_app_summary ... ok
test test_parse_sample_app_complexity ... ok
test test_parse_sample_app_imports ... ok
test test_parse_sample_app_calls ... ok
test test_parse_sample_app_structs ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

   Doc-tests codegraph

running 6 tests
test crates/codegraph/src/lib.rs - (line 34) - compile ... ok
test crates/codegraph/src/graph/codegraph.rs - graph::codegraph::CodeGraph::open (line 63) - compile ... ok
test crates/codegraph/src/query.rs - query::QueryBuilder<'a>::custom (line 168) ... ok
test crates/codegraph/src/query.rs - query::QueryBuilder<'a>::node_type (line 59) ... ok
test crates/codegraph/src/graph/codegraph.rs - graph::codegraph::CodeGraph::query (line 560) ... ok
test crates/codegraph/src/query.rs - query::QueryBuilder (line 21) ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.73s

   Doc-tests codegraph_bash

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_c

running 3 tests
test crates/codegraph-c/src/lib.rs - (line 64) - compile ... ok
test crates/codegraph-c/src/lib.rs - (line 42) - compile ... ok
test crates/codegraph-c/src/lib.rs - (line 22) - compile ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s

   Doc-tests codegraph_clojure

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_cobol

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_cpp

running 1 test
test crates/codegraph-cpp/src/lib.rs - (line 11) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.71s

   Doc-tests codegraph_csharp

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_css

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_dart

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_dockerfile

running 1 test
test crates/codegraph-dockerfile/src/lib.rs - (line 20) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_elixir

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_elm

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_erlang

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_fortran

running 1 test
test crates/codegraph-fortran/src/lib.rs - (line 19) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_go

running 1 test
test crates/codegraph-go/src/lib.rs - (line 17) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_groovy

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_haskell

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_hcl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_java

running 1 test
test crates/codegraph-java/src/lib.rs - (line 17) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_julia

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_kotlin

running 1 test
test crates/codegraph-kotlin/src/lib.rs - (line 17) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_lua

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_memory

running 1 test
test crates/codegraph-memory/src/lib.rs - (line 18) ... ignored

test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_objc

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_ocaml

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_parser_api

running 2 tests
test crates/codegraph-parser-api/src/lib.rs - (line 20) ... ignored
test crates/codegraph-parser-api/src/traits.rs - traits::CodeParser (line 124) ... ignored

test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_perl

running 1 test
test crates/codegraph-perl/src/lib.rs - (line 17) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_php

running 1 test
test crates/codegraph-php/src/lib.rs - (line 17) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_python

running 2 tests
test crates/codegraph-python/src/lib.rs - (line 37) ... ignored
test crates/codegraph-python/src/lib.rs - (line 19) - compile ... ok

test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_r

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_ruby

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_rust

running 1 test
test crates/codegraph-rust/src/lib.rs - (line 18) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_scala

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_server

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_solidity

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_swift

running 1 test
test crates/codegraph-swift/src/lib.rs - (line 12) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.65s

   Doc-tests codegraph_tcl

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_toml

running 1 test
test crates/codegraph-toml/src/lib.rs - (line 19) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s

   Doc-tests codegraph_typescript

running 1 test
test crates/codegraph-typescript/src/lib.rs - (line 18) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

   Doc-tests codegraph_verilog

running 1 test
test crates/codegraph-verilog/src/lib.rs - (line 18) - compile ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

   Doc-tests codegraph_yaml

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests codegraph_zig

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Evidence: Env-lock stress: 10 consecutive codegraph-server runs at 16 threads, all green
=== run 1 (16 threads) ===
test memory::tests::test_memory_manager_lifecycle ... ignored, requires model files
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.84s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.80s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
=== run 2 (16 threads) ===
test memory::tests::test_memory_manager_lifecycle ... ignored, requires model files
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.83s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 2.07s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
=== run 3 (16 threads) ===
test memory::tests::test_memory_manager_lifecycle ... ignored, requires model files
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.86s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.84s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
=== run 4 (16 threads) ===
test memory::tests::test_memory_manager_lifecycle ... ignored, requires model files
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.94s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.88s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
=== run 5 (16 threads) ===
test memory::tests::test_memory_manager_lifecycle ... ignored, requires model files
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.87s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 1006 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 1.88s
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Evidence: Per-crate count of 4,118 net-new test attributes (base→target diff)
New #[test]/#[tokio::test] attributes added per crate (base 17540f9 -> target 08c523c):

codegraph                    196
codegraph-bash               77
codegraph-c                  186
codegraph-clojure            82
codegraph-cobol              64
codegraph-cpp                76
codegraph-csharp             77
codegraph-css                70
codegraph-dart               103
codegraph-dockerfile         51
codegraph-elixir             86
codegraph-elm                82
codegraph-erlang             78
codegraph-fortran            59
codegraph-go                 66
codegraph-groovy             90
codegraph-harness            61
codegraph-haskell            81
codegraph-hcl                70
codegraph-java               60
codegraph-julia              82
codegraph-kotlin             55
codegraph-lua                83
codegraph-memory             124
codegraph-objc               94
codegraph-ocaml              90
codegraph-parser-api         139
codegraph-perl               83
codegraph-php                53
codegraph-python             100
codegraph-r                  89
codegraph-ruby               66
codegraph-rust               39
codegraph-scala              104
codegraph-server             657
codegraph-solidity           91
codegraph-swift              80
codegraph-tcl                80
codegraph-toml               56
codegraph-typescript         38
codegraph-verilog            59
codegraph-yaml               58
codegraph-zig                83

Total: 4118
Evidence: Sample of net-new tests from recent commits shown passing

test visitor::tests::test_visitor_complexity_max_nesting_depth ... ok test visitor::tests::finally_clause_raises_complexity ... ok test visitor::tests::test_complexity_elvis_expression ... ok test visitor::tests::test_vectorized_and_not_counted ... ok test visitor::tests::test_vectorized_or_not_counted ... ok test visitor::tests::test_complexity_max_nesting_depth_grows_with_braced_bodies ... ok

Sample of net-new tests from recent gnhf commits, shown passing in the full-workspace run:
test visitor::tests::test_visitor_complexity_max_nesting_depth ... ok
test visitor::tests::finally_clause_raises_complexity ... ok
test visitor::tests::test_complexity_elvis_expression ... ok
test visitor::tests::test_complexity_elvis_operator_adds_branch ... ok
test visitor::tests::test_vectorized_and_not_counted ... ok
test visitor::tests::test_vectorized_or_not_counted ... ok
test visitor::tests::test_finally_clause_raises_exception_handlers ... ok
test visitor::tests::test_complexity_max_nesting_depth_grows_with_braced_bodies ... ok

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 4 issues found → auto-fixed (3) ✅
  • ⚠️ crates/codegraph-server/src/main.rs:581 - Cross-module env-var race on HOME/USERPROFILE in the codegraph-server test binary: crash_phase.rs tests guard mutations with a module-local ENV_LOCK (crash_phase.rs:75), mcp/engine.rs tests use a different module-local ENV_LOCK (engine.rs:401), and main.rs's breadcrumb_roundtrip_writes_parseable_json mutates HOME/USERPROFILE with no lock at all. All three modules compile into one test binary and cargo runs tests in parallel threads, so a test can observe another test's temp HOME or restore a stale value (e.g. restoring HOME to another test's already-deleted temp dir), causing flaky failures and cross-test pollution. Fix: route all HOME/USERPROFILE mutations in this binary through one shared lock (a small pub(crate) test-support helper) instead of per-module statics.
  • ⚠️ crates/codegraph-cobol/src/visitor.rs.dbg:1 - Committed debug artifact: crates/codegraph-cobol/src/visitor.rs.dbg is a zero-byte leftover file (added in gnhf 224). Per the project's file-tracking policy debug artifacts must not be tracked; delete it.
  • ⚠️ crates/codegraph-tcl/src/bin_probe_test.rs:1 - Committed dead file: crates/codegraph-tcl/src/bin_probe_test.rs is zero-byte and referenced by no mod declaration anywhere in the crate (added in gnhf 250), so it is never compiled and is pure repository noise; delete it.
  • ℹ️ crates/codegraph-lua/src/visitor.rs:125 - This branch is not test-only despite most commit messages reading 'Added N net-new tests': ~1,400 production lines changed, including real parser behavior fixes in 16 language crates (e.g. Lua local-assignment function extraction rewrite here, Java interface-extends/enum-body extraction, Kotlin class_body/wildcard_import handling, Swift async/param/return-type detection, C# returns field, Python match-statement complexity, TOML nested-pair visiting and a metrics double-count fix) plus behavior-preserving seam refactors in codegraph-server and codegraph-harness. Each fix was disclosed in its own commit message and is pinned by new tests; I verified the riskiest rewrites in context and found no logic errors. Flagging so reviewers know parser extraction output and parse metrics change with this merge.

🔧 Fix: Share one test env lock; drop two dead files
1 warning still open:

  • ⚠️ crates/codegraph-server/src/memory.rs:708 - Residual reader-side env race the new shared test_env lock does not cover: codegraph_home_dir_ends_with_dot_codegraph calls codegraph_home_dir().unwrap() without taking crate::test_env::lock(). If it runs concurrently with crash_phase.rs's mark_without_home_is_noop (which removes both HOME and USERPROFILE while holding the lock), codegraph_home_dir() returns Err and the unwrap panics, making the test flaky. Fix: add let _guard = crate::test_env::lock(); at the top of this test. This is the only unguarded HOME reader in the lib test binary (index_state tests use ephemeral roots; the engine's HOME-reading test already locks).

🔧 Fix: Guard HOME-reading memory test with shared env lock
1 warning still open:

  • ⚠️ crates/codegraph-server/src/daemon.rs:416 - Residual HOME-reader race the shared test_env lock still does not cover: four daemon.rs tests (heartbeat_path_is_slug_json_under_daemons_dir at line 413, write_read_remove_round_trip, live_daemon_for_returns_fresh_and_prunes_stale, no_daemon_when_heartbeat_absent) call heartbeat_path()/daemons_dir(), which read HOME/USERPROFILE, without taking crate::test_env::lock(). They run in the same lib test binary as crash_phase's mark_without_home_is_noop (removes both vars while holding the lock) and with_isolated_home tests (repoint HOME at a temp dir, then delete it). Concurrent interleaving makes daemons_dir() return Err so the .expect("home is set in test env")/.unwrap() panics, or splits a write/read pair across two different HOME values so read() returns None and .expect("heartbeat should be readable") panics - flaky failures, and heartbeat files can leak into the deleted temp home. Fix: add let _guard = crate::test_env::lock(); at the top of these four tests (the other six daemon tests are pure in-memory and need no guard). Round 2's memory.rs fix asserted it was the only unguarded HOME reader; daemon.rs was missed.

🔧 Fix: Guard all remaining HOME-reading tests with shared env lock
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • cargo test --workspace — full suite over all 43 crates: 121 test binaries, 6,261 tests passed, 0 failed, exit code 0
  • cargo test -p codegraph-server --lib --bins -- --test-threads=16 run 10 consecutive times to stress the shared test-env-lock fix for HOME-reading daemon/memory/crash-breadcrumb tests: 1,006 lib + 5 bin tests green on every run
  • Verified specific net-new tests from recent gnhf commits (else_clause/max_nesting_depth, elvis_expression, while_statement, vectorized | negative path, finally_clause) appear as ok in the workspace transcript
  • Counted new #[test]/#[tokio::test] attributes per crate in the base→target diff (4,118 total across all 43 crates) to confirm the coverage intent
  • git status --porcelain after testing — worktree clean, no transient artifacts left behind
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ crates/codegraph-server/src/domain/unused_code.rs:52 - Pre-existing dead_code warnings: find_unused_code, FindUnusedCodeParams/Result, UnusedCodeCandidate, and six helper functions are never used outside #[cfg(test)] since the find_unused_code tool moved to the pro edition. Fixing requires deleting the staged feature code or adding #[allow(dead_code)] - a product decision, not a safe mechanical fix. Not introduced by this branch (it only added tests for these items).
✅ **Push** - passed

✅ No issues found.

anvanster added 30 commits July 1, 2026 06:00
… 58 tests and fixed two real visitor bugs the new tests exposed (use-alias import path and interface extends parents).
…o 52 tests and fixed two real visitor bugs (interface-extends parent traits and enum-body method extraction) that the new tests exposed.
…to 49 tests, covering doc-comment prefixes, catch/match complexity accumulation, trait-method parenting, extends-with-constructor-args parsing, and call attribution scoping.
… 49 tests, covering doc comments on type/alias/port declarations, exposed-operator symbols, nested-case complexity, and pinning three latent visitor gaps.
…to 52 tests, covering protocol conformance splitting, required-method abstractness, doc/body_prefix on classes, additional visibility modifiers, required init, nested types, optional return types, and pinning three real visitor gaps.
…53 tests, covering struct/interface entity gaps, type aliases, unnamed params, type-switch complexity, qualified return types, and pinning three latent visitor gaps.
…o 53 tests, covering category interfaces, keyword-selector name/param handling, for-in complexity, switch-case call attribution, and pinning five real visitor gaps.
… 54 tests, covering import-relation shapes, foreach loop complexity, doc-comment joining, and pinning several real tree-sitter-tcl ERROR-parse quirks.
…o 57 tests, covering visibility/params/static detection, supertraits, tuple/array/dyn type refs, while-let complexity, skip_private config, and pinning the latent doc-comment gap.
…o 31 tests, covering multiline-value section extension, the truncation boundary just above the cap, sub-tables, final-section flush, multi-pair array-of-tables, and empty/comment-only documents.
…uite from 5 to 13 tests, covering ImportsFrom edges, the external-property unresolved fallback, direct-module-node call matching, name-based path fallback, non-call usage edge variants, mixed dead/used imports, and import-line reporting.
…te from 8 to 15 tests, covering multi-level caller depth, mutual-recursion dedup, both-direction callee-only tagging, diagnostic edge-count reporting, missing requested_line, depth-zero, and the empty-language branch.
…t suite from 7 to 14 tests, covering Imports-edge deps, Both-direction get_edges, max_symbols capping, oversized-dep source omission, one-dep-per-primary, shared-dep dedup, and non-import/call edge exclusion.
…e from 8 to 14 tests, covering signature/path propagation, default fields on bare nodes, diamond depth-2 dedup, direct-and-transitive caller single-counting, direct-caller tie-break, and limit exceeding function count.
…suite from 8 to 15 tests, covering stage-2 non-test exclusion, stage-1 precedence over same-file, transitive callee depth, path-based test detection, stage-3 non-function exclusion, the .spec pattern, and limit=0.
…st suite from 8 to 15 tests, covering the reachable-set edge guard, depth-0 bailout, diamond dedup, duplicate edges, bare-node defaults, transitive importedBy, and self-import edges.
…uite from 8 to 16 tests, covering the line_end==0 range collapse, the unknown-language fallback, the source-unavailable placeholder, code-less callers, multiple callers, stage-1 non-calling-test exclusion, Class node-type rendering, and the stage-2 non-Function guard.
…rom 9 to 16 tests, covering the Extends/Implements/Contains edge-type mappings, rename risk elevation, line/column propagation, the no-requested-line fallback, and multi-edge-between-pair impacts.
… 14 to 30 tests, adding 16 net-new end-to-end tests exercising the previously-untested get_ai_context entry point and its intent-driven traversal, dependency, sibling, architecture, imports, usage-example, and debug-hint helpers.
…m 10 to 22 tests, adding 12 end-to-end tests exercising the previously-untested find_unused_code async entry point.
…o 15 tests, covering the previously-untested project-slug, ephemeral-workspace, home-dir, and telemetry-id helpers.
…uite from 9 to 17 tests, covering previously-untested builder setters, truncate_optional, and the serde rename_all wire-format contracts.
…to 19 tests, adding 12 net-new tests covering the previously-untested hash_content, index_file, index_directory, and index_workspace runtime entry points.
…23 tests, adding 10 net-new tests covering the previously-untested HTTP handler detection, call-edge resolution, complexity propagation, import-edge props, and fallback file-node paths.
… 26 tests, adding 12 net-new tests covering the previously-untested Spring/JAX-RS HTTP annotation detection, annotation-value extraction, HTTP-handler node props, fallback file node, complexity propagation, import-edge props, method qualification/containment, and interface required_methods.
…to 23 tests, adding 9 net-new tests covering previously-untested fallback file node, complexity propagation, import-edge props, import-node dedup, method qualification/containment, interface required_methods, class type_parameters, function doc/return_type, and inheritance order prop.
…20 tests, adding 8 net-new tests covering previously-untested complexity propagation, module/function/class/method/trait doc and prop branches, orphaned parent_class containment, and the is_direct call-edge prop.
…o 30 tests, adding 10 net-new tests covering line/signature/path/visibility props, the method-vs-function prop distinction, negative inheritance/implementation edges, and import-node reuse of trait/function/file nodes.
…1 to 31 tests, adding 10 net-new tests covering free-function path/line/signature/optional/flag props, method path/line bounds, the interface-method narrower-prop divergence, trait Contains edge, direct-call is_direct, and alias-only/wildcard-only import edge props.
… 33 tests, adding 10 net-new tests covering free-function/class/trait/method path-visibility-line props, the method narrower-prop divergence, negative inheritance/implementation edges, in-file function import reuse, module-name self-loop import, and multi-function file containment.
anvanster added 29 commits July 1, 2026 22:12
…s (22→27) pinning the previously-untested success-path dispatch arms of handle_custom_request across the traverseGraph, getCallers, getCallees, findBySignature, and analyzeComplexity handlers.
…s (27→29) covering the last two previously-untested success-path dispatch arms of handle_custom_request: getAIContext and getDetailedSymbolInfo over a populated graph.
…t.rs (16→17) covering the previously-untested Section 5 recent-git-changes path of get_edit_context via a real temp git repo.
…text.rs (14→15) covering the previously-untested Step 2 symbol token-budget break in get_curated_context.
…erver mcp/transport.rs and added 4 net-new tests (2→6) pinning its valid-JSON, whitespace-trim, blank-line, and malformed-JSON branches.
…rs in codegraph-harness jsonrpc.rs and added 5 net-new tests (0→5) covering the previously-untested-because-IO-coupled framing and line-parse logic.
…raph-server branch_watcher.rs and added 3 net-new tests (7→10) pinning the git diff status-character classification branches.
…raph-server domain/impact.rs and added 3 net-new tests (18→21) pinning the change-type→severity mapping that was previously unreachable in unit tests.
…t_type, base_risk_level, escalate_risk_level) from the IO-coupled analyze_impact fn in codegraph-server domain/impact.rs and added 7 net-new tests (21→28) pinning all their branches.
…g the Int/Float/Bool/type-mismatch comparison arms of QueryBuilder::property() that only had String-arm coverage.
…func_map-miss (unknown-name) branches of apply_kernel_macros that prior all-match/empty-list tests never reached.
….rs (8→9) pinning the line_end_opt None branch of get_symbol_source that the existing both-fields-missing test never reached.
… pinning detect_entry_type's path-based TestEntry branch and its None fallback, both previously unreached.
… pinning symbol_weight's inverted-line-bounds saturating_sub branch that the two existing tests (end>=start or both zero) never reached.
…visit_for_complexity's finally_clause exception-handler branch that the existing catch-only test never reached.
…2) pinning visit_for_complexity's return_statement arm via the early_returns metric that no existing test asserted.
…7) pinning visit_for_complexity's elvis_expression branch that no existing complexity test reached.
…pinning visit_for_complexity's while_statement arm that only had repeat-while and for-in loop coverage.
… pinning visit_for_complexity's binary-arm word-operator sub-branch (`and`/`or`) that the existing logical-operators test (&&/|| only) never reached.
… pinning visit_for_complexity's `&&` and word-`or` operator sub-branches that the existing logical-operator tests (`and` and `||` only) never reached.
…inning five previously-untested visit_for_complexity arms: word and/or logical operators, do_statement, finally_clause, switch case/default, and match_conditional_expression.
…pinning visit_for_complexity's untested `||` and `and` operator-spelling sub-branches plus two grammar-shape gaps (pure-`and` unary_expression parse and C-style for_statement_1).
… operator sub-branches: codegraph-objc's || spelling (53→54) and codegraph-r's vectorized-| negative path (46→47).
…ning visit_for_complexity's else_clause arm and the enter_scope/exit_scope max_nesting_depth tracking, neither of which any existing test reached.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🔍 CodeGraph PR Review

286 files changed (+69775/−1326, 4732 functions) · Risk: 🔴 high

Blast radius

8094 direct callers affected across CodeGraph/CodeGraph/scripts, CodeGraph/crates/codegraph, CodeGraph/crates/codegraph-dockerfile, CodeGraph/crates/codegraph-kotlin, CodeGraph/crates/codegraph-server

⚠️ Test gaps (1888 functions, 0 coverage)

  • name_of (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • duplicate_import_target_reuses_existing_node (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • build (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • indirect_call_records_is_direct_false (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • traits_are_ignored_by_the_mapper (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • function_optional_props_absent_and_unread_fields_never_stamped (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • import_matching_in_file_function_name_reuses_node_without_external_flag (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • function_optional_props_present (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • multiple_functions_all_contained_by_file (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • function_signature_visibility_and_line_bounds_stamped (crates/codegraph-bash/src/mapper.rs) — signature_changed
  • …and 1878 more

Suggested reviewers

Andrey Vasilevsky (1070 lines), anvanster (1 lines)

Suggested commit: feat(scripts): <describe the change> · 1007 tests cover the changes
🤖 Generated by CodeGraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant