Skip to content

feat(call-graph): fix Level-1 extraction (PS/Haskell/Shell/Solidity) and Level-2 resolution (C++/Kotlin) outliers - #8921

Merged
squid-shepherd[bot] merged 3 commits into
mainfrom
feat/call-graph-l1-l2-outliers
Nov 22, 2026
Merged

squid-shepherd[bot] merged 3 commits into
mainfrom
feat/call-graph-l1-l2-outliers

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Fixes the remaining Level-1 callee-extraction outliers (PowerShell, Haskell, Shell, Solidity) and the two actionable Level-2 call-resolution outliers (C++ and Kotlin) in one combined golden-master-reblessed PR.

Level-1 Extraction Accuracy (call_graph_accuracy.py vs tree-sitter)

Every measured language on main (other than Tcl, which is on its own PR #8915) is now >90% on both precision and recall, with all 4 outliers lifted to 95.7%–98.7% precision and 96.4%–99.3% recall and zero regressions across the other 21 languages:

Language Before (main baseline) After FP / FN
PowerShell 77.8% P / 37.9% R 97.4% P / 96.4% R 296 → 71 / 1,702 → 99
Haskell 70.7% P / 99.1% R 95.7% P / 98.9% R 137 → 17 / 3 → 4
Shell 84.0% P / 93.9% R 98.3% P / 98.2% R 312 → 29 / 106 → 32
Solidity 64.6% P / 98.0% R 98.7% P / 99.3% R 80 → 2 / 3 → 1

(Swift 99.7%/95.4% and Scala 99.2%/92.6% improvements from #8795 are also locked into the regenerated baseline.)

Level-2 Resolution Accuracy (call_graph_resolution.py vs compiler / SCIP)

Language Metric Before (main baseline) After Delta
C++ (fmtlib/fmt vs libclang 18.1.1) Confident precision 90.2% 95.7% +5.5 pp
Strict precision 80.3% 87.8% +7.5 pp
Overload-blind precision 92.7% 98.2% +5.5 pp
Recall / Resolution recall 39.6% / 66.3% 41.5% / 68.2% +1.9 pp / +1.9 pp
Kotlin (kotlinpoet vs scip-java 0.13.2) Confident precision 97.3% 97.5% +0.2 pp
Strict precision 95.2% 95.8% +0.6 pp
Recall / Resolution recall 35.9% / 35.2% 42.5% / 42.7% +6.6 pp / +7.5 pp

Root Causes & Fixes

Level-1 Extraction

  1. Nested-unit call blanking for non-C-style languages (gitgalaxy/core/detector.py):
    • _call_scans was gated on and qualifiers_seen, which skipped _drop_nested_unit_calls for every non-qualified language (Haskell, PowerShell, Shell, Tcl, etc.). Removing that gate (while respecting _calls_out_masked_blocks and preserving empty qualifiers) eliminated 57 inner-function FPs in Haskell and 44 in PowerShell.
  2. PowerShell (gitgalaxy/standards/language_standards/languages/powershell.py):
    • Replaced CALLS_OUT_COMMAND_POSITION (line-start only) with _PS_CALLS_OUT covering commands in statement, pipeline, assignment RHS, block, and subexpression positions plus .NET instance/static calls (.Method(...), ::new(...)), while rejecting hashtable keys (key = ...).
    • Added _ps_expose_subexpressions (_calls_out_pre_shield) to expose $(...) inside double-quoted strings/here-strings and blank @"..."@ / @'...'@ here-string literal bodies.
    • Added _ps_blank_non_calls (_calls_out_rewrite) to blank enum { ... } bodies and [Parameter(...)] attribute arguments.
  3. Shell (gitgalaxy/standards/language_standards/languages/shell.py):
    • Guarded { with (?<!\$)\{ so ${VAR} parameter expansions are never scanned as { cmd; } compound commands.
    • Added _sh_expose_subshells (_calls_out_pre_shield) to expose $(...) inside double-quoted strings (target="$(readlink "$1")").
    • Joined \ line continuations (_SH_LINE_CONT) in _blank_shell_heredocs so continued arguments (atf_check ... \\\n cp foo bar) are not scanned as new commands.
  4. Solidity (gitgalaxy/standards/language_standards/languages/solidity.py):
    • Blanked inline Yul assembly { ... } blocks (EVM opcodes are inline assembly, not Solidity calls) and blanked call options (target.call{value: v}(data)) in _blank_solidity_non_calls.
  5. Haskell (gitgalaxy/standards/language_standards/languages/haskell.py, tests/tools/call_graph_accuracy.py):
    • Stepped over { ... } record updates in Haskell's func_start so k (z { f = 1 }) is not misread as a nested function definition.
    • Merged consecutive same-parent, same-name Haskell equation clauses in ts_functions() (compactify [] = [] + compactify items = ...) so tree-sitter compares the whole function like-for-like.

Level-2 Resolution

  1. C++ (gitgalaxy/core/call_resolver.py, gitgalaxy/galaxyscope.py, gitgalaxy/standards/language_standards/languages/cpp.py):
    • Widened _overloads for C++ free functions resolved via file/import across {src_path} | caller.imported (still excluding static internal-linkage functions from other translation units). file precision jumped 83.3% → 92.4% and import precision 88.1% → 93.9%.
    • Added multi-word trailing return types (-> long long, -> unsigned int, etc.) to cpp.py's func_start.
    • Added class_alias_tables_full with lowercase using/typedef alias mapping (string_view → basic_string_view, format_parse_context → basic_format_parse_context, etc.) into receiver typing (+75 typed links at 98.5% precision).
  2. Kotlin (gitgalaxy/core/call_resolver.py, gitgalaxy/core/detector.py):
    • Assigned companion object (Anonymous_Class) methods to their enclosing class so CodeBlock.of(...), AnnotationSpec.builder(...), FunSpec.builder(...), etc. resolve via qualified (13 → 78 judged at 100.0% precision).
    • Replaced Kotlin's blanket typed guard with _is_unique_class (avoiding nested Builder collisions while typing unique classes) and enabled file-scoped return-type chains (0 → 124 typed links at 96.0% precision).
    • Added _kotlin_class_parents to extract supertypes past primary constructors (class ClassName(...) : TypeName(...)), unlocking super. resolution (class 145 → 155 judged at 98.7% precision).

Golden Master & Baseline Updates

  • tests/call_graph_accuracy_baseline.json: regenerated across all 25 languages via tests/tools/call_graph_accuracy.py --regenerate.
  • tests/call_graph_resolution_cpp_baseline.json & tests/call_graph_resolution_kotlin_baseline.json: regenerated via tests/tools/call_graph_resolution.py {cpp,kotlin} --regenerate.
  • tests/golden_master_audit/ & tests/golden_master_zero_dep_audit/: re-blessed via tests/tools/box/golden-lock.sh python3 tests/tools/crucible_check.py --update --yes. Only call-graph / dependency-network / snapshot outputs changed as expected from improved call extraction and resolution.

Verification

  • tests/extraction/languages/test_calls_out_level1_outliers.py + test_calls_out_haskell_juxtaposition_6454.py: 135 passed (including ReDoS immunity checks).
  • tests/extraction/languages/test_call_resolution_level2_outliers.py + test_cpp_ctor_init_span_6266.py: 20 passed.
  • tests/tools/call_graph_resolution.py {c,typescript,javascript} --ci: OK (no regressions).
  • tests/ruff_audit.py --ci: passed with zero new lint/format findings.
  • Pinned mypy 2.4.1 on all modified files: zero errors in modified code.

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 21, 2026 17:37
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot disabled auto-merge November 21, 2026 18:06
@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #8921 @ c7a110d: 2 failed check(s)

== rosetta-audit (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/44929929138/job/136924102195
repro: no local equivalent; read the check page
errors:
REG powershell FAIL powershell: 1 mismatch(es)
##[error]powershell: this build moves the control corpus -- FAIL powershell: 1 mismatch(es)
##[error]Process completed with exit code 1.
log tail:
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.1
Temporarily overriding HOME='/home/runner/work/_temp/baa24e23-f7fa-4af7-8efd-8b3d44a17340' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy-baseline
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.1
Temporarily overriding HOME='/home/runner/work/_temp/e64dc3df-a298-416a-9502-0d8f1d564640' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

== shard 1 (1670027 LOC) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/44929929081/job/136928236259
repro: python tests/tools/pr_gates.py --fast
failing tests: tests/doom_rosetta/test_doom_rosetta.py::test_port_matches_golden[kocoa-doom]
errors:
E AssertionError:
tests/doom_rosetta/test_doom_rosetta.py:47: AssertionError
FAILED tests/doom_rosetta/test_doom_rosetta.py::test_port_matches_golden[kocoa-doom] - AssertionError:
##[error]Process completed with exit code 1.
log tail:
summary.callgraph_precision: 0.9998 -> 0.9994
summary.expected_fails_met: True -> False
summary.fails: '' -> 'callgraph'
summary.verdict: 'PERFECT' -> '6/7'
(bless an intended change with tests/tools/doom_rosetta_check.py --update --yes)
assert not "kocoa-doom: 5 difference(s) from the golden\n summary.callgraph_engine_only: 0 -> 2\n summary.callgraph_precision: ... summary.expected_fails_met: True -> False\n summary.fails: '' -> 'callgraph'\n summary.verdict: 'PERFECT
1 failed, 10 passed, 28 deselected in 165.23s (0:02:45)
##[error]Process completed with exit code 1.
##[group]Run s=$(( $(date +%s) - T0 ))
s=$(( $(date +%s) - T0 ))
echo "shard 1 (1670027 LOC): ${s}s" >> "$GITHUB_STEP_SUMMARY"
shell: /usr/bin/bash -e {0}
env:
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
DOOM_SPEEDRUN_WORK: /home/runner/work/gitgalaxy/gitgalaxy/../doom-work
DOOM_ROSETTA_PORTS: agentic-cobol-doom-cc,chocolate-doom,doo-cr,doomf77,doomsday,fastdoom,kocoa-doom,managed-doom,nugget-doom,prboom-plus,sqldoom
T0: 1795283742
pythonLocation: /opt/hostedtoolcache/Python/3.12.16/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.16/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.16/x64/lib
##[endgroup]
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.1
Temporarily overriding HOME='/home/runner/work/_temp/d0785cd5-79b4-4a07-b7c3-7b05b7e8cc37' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-protocol squid-protocol added the rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge label Nov 21, 2026
@squid-protocol
squid-protocol force-pushed the feat/call-graph-l1-l2-outliers branch from c7a110d to a32d7b0 Compare November 21, 2026 19:50
@squid-protocol squid-protocol removed the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (a32d7b0) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 21, 2026
@squid-shepherd
squid-shepherd Bot marked this pull request as draft November 21, 2026 19:58
@squid-shepherd squid-shepherd Bot added the shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md label Nov 21, 2026
@squid-protocol
squid-protocol force-pushed the feat/call-graph-l1-l2-outliers branch from a32d7b0 to ed06f10 Compare November 21, 2026 21:37
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 21, 2026 21:47
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 21, 2026 21:49
@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@squid-shepherd
squid-shepherd Bot disabled auto-merge November 21, 2026 22:34
@squid-shepherd squid-shepherd Bot added shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md and removed shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md labels Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 22, 2026 00:01
@squid-shepherd squid-shepherd Bot removed the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 22, 2026
@squid-shepherd
squid-shepherd Bot disabled auto-merge November 22, 2026 00:02
@squid-shepherd squid-shepherd Bot added the shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md label Nov 22, 2026
@squid-protocol
squid-protocol force-pushed the feat/call-graph-l1-l2-outliers branch from c02e853 to 2e3ae47 Compare November 22, 2026 16:46
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 22, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 22, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-protocol
squid-protocol force-pushed the feat/call-graph-l1-l2-outliers branch from 2e3ae47 to 6818a1d Compare November 22, 2026 17:43
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (6818a1d) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (6818a1d) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (abe1b63) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (6cf9bae) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

2 similar comments
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claim:nyx rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant