Repository navigation
feat(call-graph): improve Tcl call extraction and namespace resolution (69.3% -> 95.2% precision, 90.0% recall) - #8915
Merged
Conversation
…ace resolution (69.3% -> 95.2% precision, 90.0% recall)
Contributor
…_accuracy, and merge origin/main
… the Tcl call changes Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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
Comprehensive audit and improvement of the Tcl call graph (both Level 1 callee extraction and Level 2 namespace-qualified call resolution) across all 32 Tcl files (369 matched functions) in
language-crucible/data/tcl.Measured Accuracy & Resolution Impact (
language-crucible/data/tcl)qualifiededgesimportedgesAll 100 remaining FPs in the tree-sitter comparison are
tree-sitter-tclparse errors (ERRORnodes and misparsedforeach/;statements); all remaining FNs aretree-sitter-tclfalse parses of SQL queries, regexes, andswitchpattern labels inside{...}.Root Causes & Fixes
gitgalaxy/standards/language_standards/languages/tcl.py)_expose_tcl_quoted_substitutions(_calls_out_pre_shield) to expose unescaped[...]command substitutions inside"..."strings (including nested"..."inside[...], e.g.ui_warn "[format [msgcat::mc \"...\"] $x]") before_apply_literal_shieldblanks literals, while respecting\"/\[/\\escapes and cleanly blanking multi-line quoted strings (macports_registry/common.tcl).gitgalaxy/standards/language_standards/languages/tcl.py)_expose_switch_armsinto_rewrite_tcl_calls(_calls_out_rewrite):\+\nline continuations so continuation lines ofglobal/set/ commands are not scanned as new commands.proc <name> {<args>}parameter lists (preventing default-value braces{version ""} {revision ""}from triggering} {) and exposes one-lineprocbodies (proc puts {args} { uplevel ... }).switcharm scanning when regex labels contain](e.g.portdepends.tcl).{body}blocks forforeach,lmap,after <ms|idle>, anduplevel <level>, while blanking braced data lists inforeach/lmapand braced data values inset.calls_outregex to support inline;command separators, remove the overly broad(?<=[0-9])lookbehind (which fired oncalc_md5 {file}), tighten the trailing word boundary against:.$=,, and extract leaf callee names fromns::cmd/::cmd(Contract C6).gitgalaxy/core/detector.py,gitgalaxy/core/call_resolver.py)calls_out_namespace_qualifiershandling indetector.pyso Tcl emits leaf callees with::nsqualifiers (and drops own-leaf recursion for qualified proc names)."tcl"to_NAMESPACE_QUALIFIED_LANGSincall_resolver.pysoportfetch::fetchfiles,receipt_flat::installed, andregistry::run_targetresolve accurately viaqualified/import.tests/tools/call_graph_accuracy.py,tests/call_graph_accuracy_baseline.json,tests/golden_master_*)"tcl"toCONTRACT_NON_CALLS(matchingtcl.py's_calls_out_ignore+_CALLS_OUT_GLOBAL_IGNORE) and mapped Tcl's dedicated built-in AST nodes (set,expr_cmd,regexp) strictly forlang == "tcl".tests/call_graph_accuracy_baseline.json(tcl: 95.2% precision / 90.0% recall) and regenerated bothtests/golden_master_audit/andtests/golden_master_zero_dep_audit/viatests/tools/box/golden-lock.sh python3.11 tests/tools/crucible_check.py --update --yes. All golden master diffs are strictly scoped to Tcl call-graph outputs (calls_out_to,fan_in,fan_out,import_edges,pagerank).tests/extraction/languages/test_calls_out_tcl.py)Verification
pytest tests/extraction/languages/test_calls_out_tcl.py tests/extraction/languages/test_tcl.py tests/extraction/languages/test_tcl_strict.py tests/extraction/languages/test_calls_out_rewrite_5909.py tests/extraction/languages/test_calls_out_small_shapes_5640.py tests/extraction/languages/test_calls_out_keywords_3359.py tests/core_engine/test_call_resolver.py: 414 passedpytest tests/test_source_reads.py: 3 passedpython3.11 tests/ruff_audit.py --ci: 0 new findingspython3.11 tests/tools/tree_sitter_accuracy_audit.py --ci --lang tcl: OK (matches baseline)python3.11 tests/tools/call_graph_accuracy.py --ci: OK (0 regressions across all 25 languages)tests/tools/box/golden-lock.sh python3.11 tests/tools/crucible_check.py --update --yes: Both full-precision and zero-dep Golden Masters updated cleanly