fix(extract): converge Function/Method is_test with the tests/ path filter - #1308
Open
Yyunozor wants to merge 1 commit into
Open
fix(extract): converge Function/Method is_test with the tests/ path filter#1308Yyunozor wants to merge 1 commit into
Yyunozor wants to merge 1 commit into
Conversation
…ilter Function/Method nodes only got is_test=true via a Rust #[test] attribute check; the per-file test-file flag (cbm_is_test_file) was set on the Module node but never propagated to the definitions inside it, so e.g. a C function in tests/helpers/fixtures.c stayed is_test=false — invisible to store.c's is_test!=1 filters — even though trace_path's own independent path check already treated the file as a test. Propagate is_test_file into extract_func_def and push_method_def, and teach cbm_is_test_file the same tests/ (and test/, spec/, __tests__/) directory convention cbm_is_test_path already uses, so a non-test_-named file anywhere under tests/ is caught too. Separately, trace_call_path's own include_tests filter (mcp.c is_test_file) matched a nested ".../tests/..." path but not a project-root-relative one, so tests/repro/foo.c leaked into results with the default include_tests=false; add the missing tests/ (and test/, spec/, __tests__/) prefix check. Closes DeusData#1294. Signed-off-by: Yyunozor <yyunozor@icloud.com>
Yyunozor
force-pushed
the
fix/issue-1294-is-test-tests-dir
branch
from
July 28, 2026 16:33
35b8826 to
45c162c
Compare
Owner
|
Thank you for the contribution and for tracing the inconsistent test classification through extraction and MCP filtering. This is now triaged as a high-priority parsing-quality bug for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1294.
Summary
Function/Method.is_testonly ever becametruevia the Rust#[test]attribute check; the per-file test-file flag (cbm_is_test_file) was already computed and stored on theModulenode, but never propagated to the definitions inside it. A C function intests/helpers/fixtures.cstayedis_test=falseand leaked paststore.c'sis_test != 1filters, even thoughtrace_path's own independent path check already treated the file as a test.extract_func_defandpush_method_defnow ORctx->result->is_test_fileintodef.is_test, additive to the existing Rust attribute check (#[test]functions embedded in an otherwise regular.rsfile are unaffected).cbm_is_test_file(extraction-time) gained the sametests//test//spec//__tests__/directory-prefix convention the project's owncbm_is_test_path(pass_tests.c) already uses, so a file undertests/with notest_/_testnaming is caught too — applying an existing convention where it was missing, not inventing a new one.trace_call_path's owninclude_testsfilter (mcp.c's separate, query-timeis_test_file()) matched a nested.../tests/...path but not a project-root-relative one, sotests/repro/rpd_index_and_fingerprintleaked into results under the defaultinclude_tests=false. Added the same missing directory-prefix check there.Verification
make -f Makefile.cbm test -j12: parent 6786 passed / 1 failed / 4 skipped; fix branch 6789 passed / 1 failed / 4 skipped. Delta is exactly the 3 new tests; the 1 pre-existing failure (test_cli.c:8526, Copilot CLI/VS Code detection) and 4 skips (Windows-only) are identical on both sides.extract_c_test_dir_marks_is_test_issue1294,extract_python_method_test_dir_marks_is_test_issue1294(positive/negative for both extraction call sites) andtool_trace_totals_respect_test_filter_tests_root_subtree_issue1294(end-to-endtrace_call_pathinclude_teststoggle).clang-format/clang-tidy/cppcheckare not available in my local environment (clang-formaterrors on alibz3version mismatch in my Homebrew LLVM), so CI is the authority for lint, as in fix(extract-rust): mark #[test]/#[tokio::test] fns is_test so they are filtered #857. The build itself uses-Wall -Wextra -Werrorand compiled clean on both branches.Known limitations
cbm_is_test_path) is forward-slash-only and case-sensitive; unchanged, to keep this diff minimal.store.c'scbm_is_test_file_path()(a third, broaderstrstr(fp,"test")implementation feedingsearch_graph/dead-code) is untouched — outside this issue's reported scope.pass_tests.c,helpers.c,mcp.c,store.c) behind one shared function instead of a third copy of the same directory list — left for a separate PR.