1 Commits
Author SHA1 Message Date
Colby MchenryandClaude Opus 5.5 22a7ba8576 fix(c,cpp): a file named like a test is visible to the code that includes it (#2421)
isVisibleAcrossFiles hides every symbol in a test-suite file from non-test
code, decided by the file's name. A C or C++ header is part of every
translation unit that includes it, whatever its name: protobuf's conformance
framework lives in conformance/conformance_test.h/.cc and test_runner.h, and
the 9 `suite_.ReportFailure(...)` calls in the suites found
ConformanceTestSuite::ReportFailure through the supertype walk only to have it
dropped by the test-suite check.

The check now lets a C/C++ candidate through when the reference's file
includes it, directly or through other headers. A definition in a source file
counts through the same-named test-suite header it includes
(conformance_test.cc -> conformance_test.h), so a test that includes the
production header it tests (jemalloc's test/unit/hash.c and hash.h) does not
become its implementation. The include graph (new cpp-includers.ts) is read
from the import nodes extraction mints for every #include, each resolved the
way the graph's include edge is, walked from the included file up, from a
narrow query of six columns.

protobuf +675 edges, none removed or retargeted: 112 in conformance/ and 563
from *_unittest.cc files (which isTestPath does not recognize as tests) into
the test utilities they include. redis +1 (expr.c includes fastjson_test.c).
leveldb, fmt, llm.c, jq, rocksdb, typeorm, tokio, okhttp and excalidraw are
byte-identical. The same exception for Strategy 3's receiver-name guess was
measured and left out: it moved rocksdb guesses onto test::StringFS, a test
double production code includes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 08:30:48 +00:00