Repository navigation
Description
Summary
GitGalaxy's C++ func_start regex (gitgalaxy/standards/language_standards.py) misidentifies constructor calls and member-initializer-list entries that use lambda expressions as if they were real function definitions. The regex sees the shape identifier(...) { ... } and cannot distinguish a genuine function definition from:
- A constructor's member-initializer-list entry assigning a lambda:
m_member([capture]() { ... body ... }), - A constructor call with a lambda argument:
std::thread([capture]() { ... body ... }).detach();
The regex matches the lambda's opening { as if it were the "function body" opener following the identifier and parentheses, producing spurious function entries in the extraction DB.
Confirmed instances in language-crucible/data/cpp/
Case 1: Member-initializer-list lambda
- File:
powertoys/FancyZones.cpp:75 - Source:
m_draggingState([this]() { ...lambda body... }),
- GitGalaxy spuriously claims a function named
m_draggingStateexists at this line. - Reality:
m_draggingStateis a plain member variable declared atpowertoys/FancyZones.cpp:181asDraggingState m_draggingState;— this is a constructor initializing it with a lambda-returning-something, not a function definition. - Both ctags and tree-sitter correctly identify this as non-function code; only GitGalaxy is fooled.
Case 2: Constructor call with lambda argument
- File:
powertoys/main.cpp:88 - Source:
std::thread([skipSettingsCheck]() { ...lambda body... }).detach();
- GitGalaxy spuriously claims a function named
std::threadexists at this line. - Reality: This is a
std::threadconstructor call taking a lambda argument, not a function definition namedstd::thread. - Three additional identical instances exist at
powertoys/main.cpp:211and221(all variations ofstd::thread{ [...] { ... } }). - Neither ctags nor tree-sitter report these as function definitions.
Impact
func_startis a production-level structural signature used for function-count metrics, complexity analysis, and risk scoring.- Spurious function entries inflate function counts and can mislead blast-radius analysis for any C++ codebase using lambdas in constructor initializer-lists or as constructor arguments — both very common in modern C++.
- Verified against tree-sitter ground truth: this is a real GitGalaxy-only false-positive defect.
- These false positives are the inverse of the false-negatives tracked in cpp func_start misses constructors with long member-initializer-lists #2009 (missed constructors due to 500-char initializer-list cap) and cpp func_start misses conversion operators with template/generic return types #2010 (conversion operator regex gaps).
Suggested fix
This requires the same careful, full-corpus-verified treatment as the related C++ issues from this sweep (#2009, #2010, #2011, #2012):
-
Identify the exact regex branch: Locate the
func_startpattern segment responsible — likely the generic identifier-then-parens-then-brace matching that has no way to distinguish a constructor-call/initializer-list entry from a real declarator. -
Consider lambda-body detection: Explore whether a lambda-body brace can be reliably distinguished from a real function body brace at the regex level — for example:
- Detecting
[...](capture-list brackets) immediately after the opening(as a signal this is a lambda, not a function signature. - Verifying this pattern doesn't create new false negatives on valid lambdas within function bodies.
- Detecting
-
Full Differential Scan verification: Do not attempt a quick patch.
- Add extraction gauntlet regression tests to
tests/extraction/languages/test_cpp.pycovering both patterns (initializer-list lambda and constructor-call lambda). - Run
python tests/tools/crucible_check.py --updateagainst the full ~80-repo corpus. - Re-bless both
tests/golden_master_audit.jsonandtests/golden_master_zero_dep_audit.json. - Verify the fix leaves no new false positives elsewhere in C++ code.
- Add extraction gauntlet regression tests to
Cross-references: Issues #2009, #2010, #2011, #2012 (all C++ func_start/args, filed 2026-08-21) are related but address distinct bugs (false negatives, args miscounting) — this is a false-positive issue.
Activity