Skip to content

tri_comparison_gatherer.py's ctags args counter miscounts a comma inside a quoted string-literal default value #2000

Closed

Description

@squid-protocol

Summary

tests/tools/tri_comparison_gatherer.py's _count_ctags_signature_params (verification-only
tooling, not part of the shipped gitgalaxy package) splits a ctags signature: field on
top-level commas to count real parameters, tracking bracket-nesting depth but not string-literal
boundaries. A comma inside a quoted string-literal default value is miscounted as an extra
top-level parameter separator.

Evidence

Found via the tri-comparison-ledger-sweep on python/function/args/agree[gitgalaxy,tree_sitter]_vs[ctags]
(1 occurrence). numpy/crackfortran.py's markoutercomma(line, comma=','): has exactly 2 real
parameters (line, comma=',') -- GitGalaxy and tree-sitter both correctly report 2. ctags' own
raw signature text is also correct verbatim ((line, comma=','), confirmed via
ctags --fields=+S -x) -- the "3" was never a ctags defect, only this counting function's split,
which treated the literal comma inside the ',' string as a second separator.

Fix (shipped in the same PR)

Added quote-tracking (single/double, with backslash-escape awareness) to both depth-scan loops in
_count_ctags_signature_params, so a comma or bracket-like character inside a string literal is
ignored for splitting/depth purposes -- mirroring how detector.py's real engine shields string
literals before running any structural regex over source text.

Verified via direct spot-checks (markoutercomma's exact case plus several synthetic
quoted-comma/nested-bracket cases) -- this module has no existing pytest suite (verification-only
tooling with a hard tree_sitter_language_pack dependency), consistent with how this function's
three prior documented bug fixes (trailing comma, bare *// markers, C's (void)) were each
verified. No golden-master reblessing needed -- this file isn't part of the shipped engine
crucible_check.py exercises.

Not scoped to python specifically: any language whose ctags signature can contain a quoted
comma-bearing default value could show the same phantom-arg-count symptom. Filing narrowly here
since this pass only confirmed python's single occurrence; worth a quick sweep of other languages'
ledger args shapes if this pattern recurs.

Activity

  1. added
    bug
    core-engine
    threat: false-positive
    on Aug 26, 2026
  2. added this to the v2.4.9 milestone on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginethreat: false-positive

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions