fix(extract): converge Function/Method is_test with the tests/ path filter - #1308
fix(extract): converge Function/Method is_test with the tests/ path filter#1308Yyunozor wants to merge 1 commit into
Conversation
35b8826 to
45c162c
Compare
|
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 |
|
A quick note so this does not sit here looking like your problem: your red CI is not caused by your change. The failure is One thing worth knowing, because it will save you a wasted click: "Re-run failed jobs" will not clear it. A re-run re-tests the same recorded merge commit and fails identically. Only a fresh push refreshes the merge ref — so a rebase on current Apologies for the delay. We are working through a large review backlog oldest-first; the queue is real rather than a judgement on this PR. |
…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>
45c162c to
cc7b4a8
Compare
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.