Skip to content

SQL: record routine calls (calls_out_to) for db2_sql and postgresql (Part of #5635) - #5657

Merged
squid-protocol merged 3 commits into
mainfrom
churn/5635-20261019T1511Z
Oct 19, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/5635-20261019T1511Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5635

What

SQL routines now record calls_out_to for db2_sql and postgresql. One shared pattern, _SQL_CALLS_OUT in languages/db2_sql.py (postgresql reuses it), captures: CALL p(...) / CALL p (Db2, PL/pgSQL), PERFORM f(...), SELECT f(...), x := f(...), FROM f(...), schema-qualified s.f(...) (bare name kept), and a trigger's EXECUTE FUNCTION|PROCEDURE f().

Not counted: built-ins (COALESCE, SUM, UPPER, to_tsvector, POSSTR, ...), type constructors (numeric(10,2)), clause words (IN (, VALUES (, OVER (), DDL heads (FUNCTION f(, INTO t (, TABLE t (, KEY k (, USING gin (, COMMENT ON t (, INDEX i ON t (), CTE definitions (x(...) AS ().

Class table

Member Status
db2_sql done, tests
postgresql done, tests (PERFORM, SELECT, CALL, :=, FROM f(), trigger EXECUTE FUNCTION)
sqlite not changed: SQLite has no stored routines (no CREATE FUNCTION/PROCEDURE); its units are statement buckets (CREATE_Statement), so no callee can resolve. calls_out stays unsupported; a test pins it.

Evidence

  • Repro CREATE FUNCTION doom_a ... doom_b(x) / PERFORM / CALL, real scan (galaxyscope --db-only): function_data.calls_out_to = ["doom_b"], ["doom_c","doom_p"]; fan-in resolves.
  • sqldoom clone is absent on this box: the ">= 109 resolved edges on sqldoom" acceptance was NOT measured. Synthetic fixtures only.
  • Golden drift (both legs), all attributable: sql/mediawiki_postgresql/tables.sql gains 2 edges (CREATE TRIGGER ts2_page_title ... EXECUTE PROCEDURE ts2_page_title() -> the function of the same name; ditto ts2_page_text) plus fan-in/out/PageRank of those units, and the LLM brief. Nothing else moved; db2unit's DDL/COMMENT ON/INSERT shapes were tightened out of the pattern before blessing.
  • Tests: tests/extraction/languages/test_sql_calls_out_5635.py (23), existing db2/pg/sqlite strict suites pass. pr_gates --fast / --ratchets: see PR checks.

Sibling gaps

  • call_site_data still empty for SQL (separate channel from calls_out_to).
  • Mode E slices a /* ... */ license header mid-comment, so words like Copyright (C) in the cut fragment read as calls (Copyright, Casanova in db2unit). Harmless (unresolvable) but junk in calls_out_to; fix is in the slicer.
  • MySQL CREATE TABLE /*prefix*/blobs ( name hidden by a comment reads as a call.
  • Db2 CALL inside embedded EXEC SQL in COBOL is a different mechanism (COBOL engine: EXEC SQL CALL proc is recorded as a COBOL dynamic CALL (operand = the schema qualifier) #4304).

Cross-repo: none (no companion PR; no crucible pin change).

🤖 Generated with Claude Code

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

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 19, 2026 15:56
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol enabled auto-merge (squash) October 19, 2026 16:05
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5657 @ 7a4cc8a: 2 failed check(s)

== Call resolution (Level 2, vs pyan3) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39281651148/job/118156952647
repro: python tests/tools/pr_gates.py --fast
errors:
2026-10-19 16:04:42,607 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:04:44,011 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:04:44,358 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:04:46,959 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:04:49,490 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:04:51,807 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:51,807 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:51,808 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:51,809 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:51,919 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:51,921 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:52,463 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:52,464 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:52,465 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:52,466 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:52,466 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:52,467 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:52,467 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:.AssertionError>
2026-10-19 16:04:52,514 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:
.AssertionError>
2026-10-19 16:04:55,200 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:05:00,252 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:05:01,118 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:05:01,980 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:05:02,831 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
2026-10-19 16:05:03,814 [INFO] [pyan.analyzer] New edge added for Use from to Name <Node ???:*.AssertionError>
... 67 more
log tail:
"overload_blind_precision_pct": 99.7
},
"recall_all_kinds_pct": 76.4,
"resolution_recall_pct": 97.7,
"named_pyan_edges": 1748,
"pyan_edges": 3592,
"wrong_examples": [
"fastapi: fastapi/routing.py:app -> fastapi/exceptions.py:45 (pyan3: fastapi/exceptions.py:213)",
"fastapi: tests/test_arbitrary_types.py:test_typeadapter -> tests/test_arbitrary_types.py:20 (pyan3: tests/test_arbitrary_types.py:59)"
],
"external_examples": [],
"reference_version": "2.9.0",
"lang": "python"
}
}
| language | reference | confident precision | ambiguous precision | recall | resolution recall |
|---|---|---|---|---|---|
| python | pyan3 | 99.9% (1829 judged) | 60.0% | 50.9% | 97.7% |
decorator edges (not gated): precision 100.0% (575 judged); recall with decorators 66.9%
reference edges (not gated): precision 99.7% (345 judged); recall, all kinds 76.4%
call_graph_resolution: WARNING -- pyan3 2.9.0 is not the pinned 2.8.1; numbers are not comparable to the baseline
call_graph_resolution: REGRESSION
python: recall_pct 51.7 -> 50.9
##[error]Process completed with exit code 1.
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/4b5faa16-ee44-49e7-a8b7-a5d972df6026' 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

== graph-accuracy-audit (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39281651148/job/118161512157
repro: python tests/tools/pr_gates.py --fast
errors:
##[error]Process completed with exit code 1.
log tail:
Version: 20261012.601
Commit: f3dc54e1fb89da6852db922499a0233137369e1d
Build Date: 2026-10-12T17:48:21Z
Worker ID: {b7988820-c9ee-4647-88ca-880458472f61}
Region: northcentralus
Cloud: Azure
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261012.334.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261012.334/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261012.334
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: graph-accuracy-audit
##[group]Run echo "gate results: $RESULTS"
echo "gate results: $RESULTS"
for r in $RESULTS; do
[ "$r" = "success" ] || { echo "a gate finished as: $r"; exit 1; }
done
shell: /usr/bin/bash -e {0}
env:
RESULTS: success failure success success success
##[endgroup]
gate results: success failure success success success
a gate finished as: failure
##[error]Process completed with exit code 1.
Cleaning up orphan processes

@squid-protocol squid-protocol added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 19, 2026
@squid-protocol
squid-protocol merged commit 6c2cebf into main Oct 19, 2026
96 of 98 checks passed
@squid-protocol
squid-protocol deleted the churn/5635-20261019T1511Z branch October 19, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant