Repository navigation
fix(extract): resolve prefixed PHP imports (#2659) - #2661
ousamabenyounes wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
This PR adds handling in the PHP type resolution logic so that imports relations can match a use alias by comparing the generated id (_make_id(alias)) against the edge target when no stub label is found. It moves the uses lookup earlier in the loop to support this. A new test verifies that a PHP use import resolves to the correct class even when that class name is a prefix of sibling class names, and the changelog is updated to note the fix (#2659).
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 1589 functions depend on the 317 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 434 callers, 41 callees
Verification — 1589 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 829 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify \_resolve\_php\_type\_references.
The verifier did not have enough to check \_resolve\_php\_type\_references, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: non-vacuity: domain too small (only 1 distinct inputs exercised, need 3) — 'no divergence' would be near-vacuous
· 1 more finding(s) on lines outside this diff (see the check run).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Shipped in v0.9.41 ( |
Resolves the PR conflicts against upstream v0.9.42 (upstream 7fe58b0), refreshing the branch from the v0.9.40 state the last merge left it in. CHANGELOG.md: upstream released 0.9.41 on 2026-08-12 while this PR was open, and this PR's consolidated section claimed that same number - the same collision the last refresh resolved one version down. The section is renumbered to 0.9.43 (one patch above the higher of the two sides, per the sync convention), its AST-cache-roll bullet follows it, and upstream's 0.9.42 (unreleased), 0.9.41 (2026-08-12) and re-dated 0.9.40 (2026-08-11) sections are kept verbatim below it. pyproject.toml: 0.9.41 (ours) vs 0.9.42 (upstream) -> 0.9.43. uv.lock: regenerated for the bump. The committed lock had been stale since before the last refresh - byte-identical to the 0.9.40 base while pyproject.toml read 0.9.41 - so it did not previously appear in this PR's delta at all. `uv lock --check` passes. graphify/affected.py: two insertions at the same point in resolve_seed. The fork's sourced-stub preference (#49/#54) is kept first and upstream's repo-relative query_path (Graphify-Labs#2707) second; neither guards the other. graphify/extractors/resolution.py: upstream's prefixed-use-import alias fallback (Graphify-Labs#2661) is folded into the else-branch of the fork's target_fqn-metadata restructure (#48), firing only when that path declines and no stub label exists. Upstream Graphify-Labs#2661 also moved the `uses = uses_by_file.get(ref_file, {})` binding into the region the fork rewrote; the deletion at the moved-from site auto-merges silently, so the binding is kept explicitly above the repoint block - without it the fork's else-branch raises NameError on the first PHP repoint edge. Delta audit: `git diff --name-only upstream/v8` covers the same 31 files as the previous refresh plus uv.lock, with none dropped. Tests on the merged tree: 4672 passed / 45 skipped / 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Why
PHP
useimports target a bare ID before namespace-aware resolution. When that ID has no sourceless stub node, the resolver cannot recover its label and leaves the import dangling instead of resolving the imported class.Fixes #2659.
What changed
usealiasesPivotand three sibling classes whose names begin withPivotWhy it is safe
The fallback runs only for
importsedges without an existing stub label. Other PHP reference relations and non-namespaced legacy resolution are unchanged. External imports continue through the existing FQN stub path.Test verification (RED → GREEN)
Upstream
v8without the production fix:Patched branch:
Full local CI replay:
v8ruff check graphify tests: passed