Skip to content

Swift: resolve scoped import Mod.Name via per-target declaration index (Part of #3798) - #6718

Merged
squid-shepherd[bot] merged 3 commits into
mainfrom
churn/3798-20261026T0550Z
Oct 28, 2026
Merged

squid-shepherd[bot] merged 3 commits into
mainfrom
churn/3798-20261026T0550Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What

Swift import struct|class|enum|protocol|typealias|func|var|let Mod.Name now resolves in the engine through a per-target declaration index, as the scorer does. Before, the dotted token went through the generic stem search (Mod/Name) and missed when the declaring file is not named after the type.

  • swift.py: imports_may_name_declaration plus a top-level _declaration_capture (struct/class/enum/protocol/actor/typealias/extension/func/var/let; extension X counts as declaring X).
  • network_risk_sensor.py: _resolve_swift_scoped: files declaring Name under a directory named Mod, else the file named Name.swift there; a nested name uses its owner; zero or several hits draw no edge; test files excluded for production importers. Bare import Mod still draws no edge.
  • Tests in test_swift_module_import_3798.py; contract note in docs/import_rule_contract.md.

Evidence (import_graph_accuracy, swift, 2 repos, 510 imports)

before after
precision 85.3% 100.0%
recall 65.3% 72.9%
FP / FN 51 / 177 0 / 138

The 51 FP (the Basics/URL.swift shape among them) are gone: they were the dotted token reaching the stem search. Only the swift baseline row moved.

Gates

ruff format --check, audit_check.py (ruff/mypy/dead-key/ast-accuracy) clear; golden crucible_check.py --update via golden-lock: no drift on either leg; swift and import-graph tests pass. Not run: pr_gates, tri-comparison, tree-sitter audits (CI after review).

Remaining slices / Sibling gaps

  • 138 FN left: 122 are "truth names several files" (a name declared in several files of a target, e.g. split extensions; the engine resolves one file per token, so it draws no edge on ambiguity). Needs multi-edge resolution for a scoped import. 10 token-unresolved (names the capture misses), 6 capture-missed.
  • Target directory is approximated by a path component named Mod; a Package.swift path: override can miss. No burned-estate program depends on it.

Checklist: partial [c:swift-scoped-import] -- multi-file and path-override cases remain

🤖 Generated with Claude Code

@squid-protocol

Copy link
Copy Markdown
Owner Author

Waiting on an owner decision (asked privately, 2026-10-26). Nothing is needed from contributors; work resumes once it is answered.

docs/self_scan/gitgalaxy_master.db-shm and -wal were committed by the self-scan:
.gitignore has *.db but not SQLite's side files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRvfVvURyJ9zRpgVkace
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 28, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 28, 2026 21:09
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 28, 2026 21:20
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #6718 @ 6469e2f: 1 failed check(s)

== shepherd (label event) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/40769380960/job/123102117077
repro: python tests/tools/pr_gates.py --fast
errors:
fail-on-cache-miss: false
##[error]Process completed with exit code 1.
log tail:
Cache restored successfully
Cache restored from key: flake-history-40692939546
##[warning]Input 'app-id' has been deprecated with message: Use 'client-id' instead.
##[group]Run actions/create-github-app-token@bcd2ba4
with:
app-id: ***
private-key: ***
skip-token-revoke: false
github-api-url: https://api.github.com
##[endgroup]
Inputs 'owner' and 'repositories' are not set. Creating token for this repository (squid-protocol/gitgalaxy).
##[group]Run python3 tests/tools/shepherd_gh.py event --event-path "$GITHUB_EVENT_PATH" --flake-cache flake-cache/flake_history.json
python3 tests/tools/shepherd_gh.py event --event-path "$GITHUB_EVENT_PATH" --flake-cache flake-cache/flake_history.json
shell: /usr/bin/bash -e {0}
env:
GH_TOKEN: ***
SHEPHERD_TRUSTED_BOTS: squid-shepherd[bot],squid-protocol
##[endgroup]
#6718 approval marker for 6469e2f: ok
#6718 ci-gate pending: waiting on: db2, full-suite part 1/2, graph-accuracy-audit, ground-truth part 1/2, measure (shard 2/2), shard 1/3, shard 2/3, sha...: FAILED: gh: Resource not accessible by integration (HTTP 403)
##[error]Process completed with exit code 1.
##[warning]Input 'app-id' has been deprecated with message: Use 'client-id' instead.
Post job cleanup.
Token revoked
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/177d76fe-cae1-4d84-ab5d-e7d9416f0c16' 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
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 shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 28, 2026
@squid-shepherd
squid-shepherd Bot merged commit 532b7ee into main Oct 28, 2026
124 of 126 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/3798-20261026T0550Z branch October 28, 2026 21:43
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant