You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Rust/Scala Lifetime & Symbol Parsing Error in _count_top_level_args #1852
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing engineduplicateThis issue or pull request already existstestingUnit, integration, and E2E pipeline verification
Bug: Rust/Scala Lifetime & Symbol Parsing Error in _count_top_level_args
Description
There is a silent attribute lookup failure in gitgalaxy/core/detector.py inside _count_top_level_args which causes Rust lifetimes (e.g., 'a) and Scala symbols (e.g., '_) to be misinterpreted as unclosed string literals.
In _count_top_level_args:
elifch=="'":
ifgetattr(self, "language", "") in ("rust", "scala") andre.match(
r"[a-zA-Z_]\w*\b(?!')", body[i+1 :]
):
pass# It's a Rust lifetime or Scala symbolelse:
in_string=Truequote_char=ch
The StructuralDetector class does not possess a language attribute; it uses self.primary_lang_id. Because getattr(self, "language", "") returns an empty string "", the language check always fails.
Impact
When a Rust or Scala file contains a lifetime parameter or symbol inside a function signature, the parser falls back to treating the ' as the start of a string literal. Because there is no closing ' quote, in_string remains True for the rest of the signature. Every top-level comma that follows is treated as being inside a string, hiding all subsequent arguments from the counter and causing severe undercounting.
Steps to Reproduce
Run _count_top_level_args against a Rust function signature containing a lifetime: fn foo<'a>(x: &'a str, y: i32, z: i32)
Observe that the returned argument count is 1 instead of 3, because y and z are swallowed by the supposed string literal starting at 'a.
Suggested Fix
Change getattr(self, "language", "") to getattr(self, "primary_lang_id", "").
Independent confirmation from the new tri-comparison tool (tests/tools/tri_comparison_chart.py, on feature/tri-comparison-audit), which cross-checks GitGalaxy's own extraction against tree-sitter and universal-ctags with neither treated as ground truth.
Real corpus example matching this bug's exact shape — language-crucible/data/rust/bevy/bevy_ecs_table.rs::initialize:
5 real parameters. Both tree-sitter and ctags independently report 5. GitGalaxy reports 3 — stops right after data: OwningPtr<'_>, i.e. exactly where a lifetime ('_) inside angle brackets would flip in_string = True and swallow every following top-level comma. Two independent tools agreeing against GitGalaxy on a real, unmodified file is strong corroborating evidence this is the same root cause described above, not a separate bug — the suggested fix (primary_lang_id instead of the never-populated language attribute) should very likely resolve this case too.
Recorded in the new ledger at docs/self_scan/tri_comparison_ledger.json, shape rust/function/args/agree[ctags,tree_sitter]_vs[gitgalaxy] (21 occurrences total in the corpus, not just this one), for anyone verifying the fix against real-world data once it lands.
Duplicate of #1872, which has the fuller writeup: independently confirmed root cause (self.language is never set anywhere in the class -- the real attribute is self.primary_lang_id), 4 concrete real-signature repro cases from bevy_ecs_world.rs/serde_core_de_mod.rs, and a follow-up comment documenting a second, related manifestation in _matching_paren_end (no lifetime guard at all, vs. this function's broken-but-present one). Closing this one as the duplicate since #1872 was filed with the fuller diagnosis already in hand -- all the detail here is preserved there.
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing engineduplicateThis issue or pull request already existstestingUnit, integration, and E2E pipeline verification
Activity
squid-protocol commentedon Aug 18, 2026
Independent confirmation from the new tri-comparison tool (
tests/tools/tri_comparison_chart.py, onfeature/tri-comparison-audit), which cross-checks GitGalaxy's own extraction against tree-sitter and universal-ctags with neither treated as ground truth.Real corpus example matching this bug's exact shape —
language-crucible/data/rust/bevy/bevy_ecs_table.rs::initialize:5 real parameters. Both tree-sitter and ctags independently report 5. GitGalaxy reports 3 — stops right after
data: OwningPtr<'_>, i.e. exactly where a lifetime ('_) inside angle brackets would flipin_string = Trueand swallow every following top-level comma. Two independent tools agreeing against GitGalaxy on a real, unmodified file is strong corroborating evidence this is the same root cause described above, not a separate bug — the suggested fix (primary_lang_idinstead of the never-populatedlanguageattribute) should very likely resolve this case too.Recorded in the new ledger at
docs/self_scan/tri_comparison_ledger.json, shaperust/function/args/agree[ctags,tree_sitter]_vs[gitgalaxy](21 occurrences total in the corpus, not just this one), for anyone verifying the fix against real-world data once it lands.squid-protocol commentedon Aug 20, 2026
Duplicate of #1872, which has the fuller writeup: independently confirmed root cause (
self.languageis never set anywhere in the class -- the real attribute isself.primary_lang_id), 4 concrete real-signature repro cases frombevy_ecs_world.rs/serde_core_de_mod.rs, and a follow-up comment documenting a second, related manifestation in_matching_paren_end(no lifetime guard at all, vs. this function's broken-but-present one). Closing this one as the duplicate since #1872 was filed with the fuller diagnosis already in hand -- all the detail here is preserved there.Correct overclaim in c.md, cross-reference pre-existing args issues, …