fix(explore): tests and examples the engine knows stay out of explore's answer
What
codegraph_explore decides which files are low value (tests, plus icons and i18n) to drop them before the score floor, halve their rank, and break ties against them. db/queries.ts likewise keeps tests and generated files out of the dominant-file, top-route-file and routing-manifest candidates. Both kept a regex list of their own, written before the engine's isTestFile learned most of what it knows. They missed:
- C++
foo_test.ccandFooTest.cpp; - Google's
foo_unittest.cc(#2434); - LLVM's
unittests/trees (#2484); testing/,e2e/,__mocks__/, Gradlefoo-test/modules and KotlinjvmTest/source sets;- the examples, samples, fixtures and benchmarks around a project.
On LLVM-style and Google-style C++ repos, a unit test that calls the code an agent asked about took a file slot in explore's answer.
Both now build on isTestFile, the same reading explore's gather already dampens scores by (×0.3 and a 15% node cap in the context builder). They keep their own extras:
- explore keeps icons and i18n;
- queries keeps generated files;
- both keep the singular
__test__/folder the old lists matched andisTestFiledoesn't.
The old lowercase suffix patterns go, along with their false positives: Latest.java, Contest.swift and contest.cs read as tests.
Follow-up from #2484's chip.
Validation: deterministic explore A/B (base main 1753472a vs this change)
- Method: both builds ran
codegraph_exploreon the same indexes (the change is query-time only). Each repo got the README suite's flow question or an agent-style one, plus three symbol-bag queries. - Repos: django, excalidraw, okhttp, tokio, gin, alamofire; protobuf and glog (Google unittests); and llvm-project 50eb53f0's
clang-tools-extra/clangdandlldb/{include,source,unittests,tools}. - "Named" counts query tokens with a production definition whose file rendered.
| repo | queries changed | test / example files rendered | named |
|---|---|---|---|
| django, excalidraw, okhttp, gin, alamofire | 0 of 20 | 0 → 0 | 59/62 → 59/62 |
| tokio | 1 of 4 | 1 → 0 (tokio-test/src/task.rs) | 9/12 → 9/12 |
| protobuf | 3 of 4 | 4 → 0 | 14/14 → 14/14 |
| glog | 3 of 4 | 3 → 0 (src/logging_unittest.cc) | 8/8 → 8/8 |
| clangd | 3 of 4 | 2 → 0 | 11/11 → 11/11 |
| lldb | 2 of 4 | 1 → 0 | 11/11 → 11/11 |
| total | 12 of 40 | 11 → 0 | 112/118 → 112/118 |
- Where the freed slots went. In protobuf,
DescriptorPool BuildFile FindMessageTypeByNamehad rendereddescriptor_unittest.cc,code_generator_unittest.ccandinternal_feature_helper_test.cc. Those slots now go to the PHP, C# and RubyDescriptorPoolimplementations.TextFormat Printer Printtradedexamples/ListPeople.javaforDescriptors.java. clangd tradedunittests/SymbolCollectorTests.cppforindex/Ref.h. Every other change only dropped a test file, or moved bytes between the same files. - No response tells the agent to use Read, in either build.
- Budgets: the explore budgets are untouched.
Agent A/B not run. A nested claude -p on this machine fails with "OAuth session expired and could not be refreshed", the same blocker #2447 hit. Re-logging the CLI is the maintainer's call. The deterministic A/B above is the evidence for now; the change only removes files the gather already scores at 0.3× from the answer, and backfills from production files.
Tests
__tests__/explore-low-value-tests.test.ts (new):
- explore answers
Parser parseExpression parseStatement Lexer nextTokenfromsrc/parser.ccwithout rendering an LLVM-styleunittests/Parse/ParserHarness.h, aparser_unittest.ccor aParserTest.cpp; getTopRouteFile()names the app'ssrc/routes.js, not ane2e/mock-server.jswith more routes.
Both fail on main: explore rendered unittests/Parse/ParserHarness.h, and the route file was e2e/mock-server.js. The 40 explore, context and route-related test files pass (475 tests).
Full suite on Windows: 6,663 passed. 6 failed in the parallel run (daemon-pid-reuse, git-index-currency, mcp-daemon), and all three files pass when rerun serially (35/35); the notes on this box list them as load-sensitive. The 404 skipped are the native-kernel suites, which skip because no kernel was built in this worktree; this change doesn't touch extraction.
🤖 Generated with Claude Code