sqlite earns its function badge; tcl namespace-qualified proc naming fixed - #2519
Merged
Conversation
… path sqlite's function panel had 100% precision (credited in #2517) but no winner badge: `_winner_or_tie` needs 2+ tools with real (non-None) `rate_pct` data, and ctags is structurally always 0/0 for sqlite functions (no CREATE FUNCTION/PROCEDURE syntax exists to find), so there's never a real 2-tool comparison to rank. The existing 1-tool-language bypass (`_manual_verification_winner`) doesn't apply either -- sqlite has ctags "available" (it covers the class panel), and that function's own docstring deliberately excludes func/class precision from any manual-record bypass: "a 2-3 tool language's real 0/N must stay visible, not be quietly replaced by a manual record" -- a guard against papering over an unroot-caused parser gap. sqlite's case clears that guard's own bar, though: it's not an unconfirmed gap, it's a specifically ledger-validated confirmation (universal-ctags' SQL parser CAN emit `f`/`p` kinds for dialects that have them -- PL/SQL, T-SQL -- SQLite just has none to find). That's the identical "no comparison could ever exist here" justification the `args` metric already gets its own narrower carve-out for (`ARGS_GRANULARITY.get(lang) in ("proxy", "program_level")`), just evidenced by an actual investigated verdict instead of a static per-language flag -- stronger evidence than that carve-out already requires, not weaker. Added `_ledger_credited_lone_claimant_winner()`: a third, narrow fallback (after `_winner_or_tie` and `_manual_verification_winner` both return None) that awards GitGalaxy's badge only when it's the sole tool with real data for that exact (language, symbol_type, metric) AND a `status: "validated"` ledger entry with `agreeing_tools == ["gitgalaxy"]` and `"gitgalaxy" in credit_tools` exists for it -- requires the same investigation rigor a real cross-tool win or full manual verification already requires, never a bare "nobody else has data" observation. 7 new unit tests cover the gating (credited+validated awards; unvalidated, uncredited, a second real-data tool, GitGalaxy itself lacking data, a mismatched language/metric, or a shared-agreement shape all correctly withhold it). Verified via a full `--all --write` regen: structural diff against main confirms the ledger itself is untouched (this is a pure chart-rendering change) and exactly one badge was added chart-wide -- sqlite's function panel -- confirmed by counting badges per language before/after, not just eyeballing the sqlite row. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014BKXKcW29F3pTm7To2wMwS
Investigated the one currently-reproducing, unvalidated tcl shape:
tcl/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter] (93 occurrences,
all in macports_port_api/*.tcl -- MacPorts' Tcl Portfile API).
Root cause confirmed via `ctags --output-format=json --fields=+znS`: every
occurrence is a namespace-qualified proc (`proc portfetch::percent_encode
{str} {`). GitGalaxy's func_start and tree-sitter-tcl both read the qualified
identifier straight out of the source text (`portfetch::percent_encode`),
matching each other exactly on all 93 -- ctags instead splits it into a bare
`name:percent_encode` tag plus a separate `scope:portfetch`/
`scopeKind:namespace` field, and this repo's ctags_reader.py was dropping
that scope field on the floor for tcl. Not a real recall gap or disagreement
about whether these procs exist -- a pure ctags-reader naming mismatch.
Fixed by adding "tcl" to `_QUALIFY_NAME_WITH_SCOPE`, reusing the identical
scope-joining + verbatim-source-line-guard mechanism already proven for C++'s
`Class::method` out-of-class-definition convention -- Tcl's `namespace` scope
kind was already in `_CTAGS_SCOPE_KIND_KEYS` and its `::` separator is
identical to C++'s, so no new parsing logic was needed, only the language
gate. Also scoped `_normalize_cpp_operator_name` to cpp only (it was applying
unconditionally inside the now-shared branch) so a Tcl proc literally named
`operator` isn't mistaken for a C++ operator-overload tag.
Verified: 0 ctags-only misses remain for tcl functions corpus-wide (was 93).
cpp's own qualification behavior (the only other consumer of this mechanism)
is unchanged -- confirmed byte-for-byte identical shape counts on all 4 of
its existence discrepancy shapes before and after. 3 new regression tests
(qualified-name join, the bare-proc-inside-namespace-eval guard staying
unqualified, and the operator-name-normalization scoping guard).
No credit/debit needed on the ledger verdict -- all three tools already
agreed on the underlying fact; only the ctags reader's name extraction was
wrong. tcl's function panel now earns its precision badge (100% 3-way tie,
broken by GitGalaxy's higher validated claim count: 352 vs. 337 vs. 334) and
its ledger backlog is fully cleared (0 remaining currently-reproducing
unvalidated shapes).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BKXKcW29F3pTm7To2wMwS
Contributor
squid-protocol
added a commit
that referenced
this pull request
Aug 31, 2026
…backlog (#2521) docs/language_status/tcl.md -- sections 1-8 built from primary sources (LANGUAGE_DEFINITIONS["tcl"], test collection counts, closed issue/PR history, gitgalaxy-raw-output), section 9 the tri-comparison capstone the tri-comparison-ledger-sweep skill calls for once a language's ledger backlog clears (#2519 cleared tcl's last open shape). Notable findings surfaced while gathering the material (documentation only, no engine change): - 114 of 156 real corpus files (73%, all of SQLite's own `*.test` regression suite) sit entirely outside tcl's scannable extension set by design (`.test` was deliberately dropped from `extensions`, kept only as a disambiguation discriminator) -- every §9 number is scoped to the 29 real `.tcl` files, not the full corpus. Documented, not filed as an issue: it's an intentional choice with no recorded rationale to second-guess, worth a deliberate look rather than a guessed fix. - Deepened one existing, under-evidenced ledger verdict (tcl/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter]) while writing §9: its second occurrence (_check_registry) sits in a 3-proc cluster ctags misses entirely (deactivate_composite/deactivate/ _check_registry, macports_registry/portimage.tcl) that traces to the same odd/even single-quote-parity desync shape GitGalaxy's own pre-#2242 bug had -- a bare apostrophe inside a double-quoted string ("Can't find...") followed by a '$v'-shaped pair, apparently confusing ctags' own Tcl parser. Consistent with, not independently proven against, ctags' own source -- documented in ctags_reader.py's tcl CTAGS_FUNC_KINDS comment and the doc's §9, not filed (a third-party parser this repo doesn't maintain). Verdict/investigated_by/investigated_at updated on that one ledger entry; status and credit_tools unchanged (already correct). docs/language_status/README.md's index row updated (39/47 wired, 43+65 tests, linked + marked written). tri_comparison_points_of_interest.md regenerated (verdict text only -- structural diff against main confirms no status/credit/debit change anywhere). Claude-Session: https://claude.ai/code/session_014BKXKcW29F3pTm7To2wMwS Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent pieces, both tri-comparison-ledger work: sqlite finally earns its function
precision badge, and tcl's one open ledger shape gets investigated and cleared.
Part 1: sqlite earns its function precision badge
sqlite's function panel already sat at 100% precision (credited in #2517) but showed no winner
badge. Root cause:
_winner_or_tieneeds 2+ tools with real (non-None) data to rank, and ctagsis structurally always 0/0 for sqlite functions (no
CREATE FUNCTION/PROCEDUREsyntax exists tofind) -- there's never a real 2-tool comparison. The existing 1-tool-language bypass
(
_manual_verification_winner) doesn't apply either: sqlite has ctags "available" (it covers theclass panel), and that function's docstring deliberately excludes func/class precision from any
manual-record bypass ("a 2-3 tool language's real 0/N must stay visible, not be quietly replaced
by a manual record") -- a guard against papering over an unroot-caused parser gap.
sqlite's case clears that guard's own bar though: it's not an unconfirmed gap, it's a specifically
ledger-validated confirmation (universal-ctags' SQL parser CAN emit
f/pfor dialects thathave them -- SQLite just has none). Added
_ledger_credited_lone_claimant_winner(): a narrowthird fallback that only awards GitGalaxy's badge when it's the sole tool with real data for that
exact panel AND an actual
status: "validated"+credit_tools: ["gitgalaxy"]ledger entry backsit -- the same investigation rigor a real cross-tool win requires, never a bare "nobody else has
data" observation. 7 new unit tests cover the gating. Verified via a full
--all --writeregen +per-language badge count diff: exactly one badge added chart-wide (sqlite/function), nothing else
touched.
Part 2: tcl -- one open ledger shape, investigated and cleared
tcl/function/existence/agree[ctags]_vs[gitgalaxy,tree_sitter](93 occurrences) -- ctags claimed93 functions neither GitGalaxy nor tree-sitter found. Confirmed via
ctags --output-format=json --fields=+znS: all 93 are namespace-qualified Tcl procs inmacports_port_api/*.tcl(
proc portfetch::percent_encode {str} {). GitGalaxy and tree-sitter both read the qualifiedidentifier straight out of source text; ctags splits it into a bare
nametag plus a separatescope/scopeKindfield that this repo'sctags_reader.pywas dropping for tcl specifically --a pure naming-convention mismatch, not a real disagreement.
Fixed by adding
"tcl"to_QUALIFY_NAME_WITH_SCOPE, reusing the exact scope-joining +verbatim-source-line-guard mechanism already proven for C++'s
Class::methodconvention (Tcl'snamespacescope kind and::separator are both already covered by that generic machinery, nonew parsing logic needed). Also scoped
_normalize_cpp_operator_nameto cpp only, since it wasrunning unconditionally inside the newly-shared branch. 3 new regression tests, including one that
confirms the guard correctly leaves a bare proc written inside a
namespace evalblockunqualified (mirroring cpp's own in-class-body-method guard).
Verified: 0 ctags-only misses remain for tcl functions corpus-wide (was 93); cpp's own
qualification behavior (the only other consumer of this mechanism) is byte-for-byte unchanged on
all 4 of its own existence shapes. tcl's function panel now also earns a precision badge (100%
3-way tie, broken by GitGalaxy's higher validated claim count), and tcl's ledger backlog is fully
cleared (0 remaining currently-reproducing unvalidated shapes).
Scope note: did not write the full
docs/language_status/tcl.mdcapstone doc this skill's ownplaybook calls for once a language's backlog clears (that doc doesn't exist yet for tcl at all) --
scoped this pass to the one flagged shape per the request; flagging as a reasonable follow-up
rather than silently skipping it.
Verification
tests/tools/: 33 passed (30 existing + 3 new ctags_reader tests + 7 new chart-badge testsfrom part 1, minus the 4-per-file split... see individual test files).
audit_check.py: clean (ruff/mypy/dead-key/ast-accuracy).tests/tools/) -- nodetector.py/prism.py/language_standards.pytouched, so no golden-master/crucible_check impact.mainconfirm each part changed exactly the ledger entries and chartbadges it intended to, nothing else.
🤖 Generated with Claude Code