You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stub-shadow fix 2/4: resolve imports edges from their own target_fqn metadata (RC2 of #46) #48
An imports edge whose target never got a stub node becomes resolvable: _resolve_php_type_references resolves imports edges from the edge's own target_fqn metadata (stamped by _import_php since #19) instead of requiring a stub node to read a label from. Today _import_php (graphify/extract.py:810-822) mints no node, and the repoint pass skips the edge when stub_label.get(tgt) misses (graphify/extractors/resolution.py:2770-2773) — so the dangling bare target survives into graph.json and serve materializes an attributeless degree-1 node at load.
Q2 shape fixed: CustomerScheduleControllerTest.php's import of ChargeCustomerCancellationFee (used only as ::class) canonicalizes onto the real class node — the explain disambiguation round-trip disappears
No new false merges: an FQN that resolves to nothing still parks on an external stub; it must never bare-match a wrong same-short-name type
Existing resolution tests green
Blocked by
None — independent of RC1 (#47): it resolves from edge metadata, not from node existence. Note the interplay: imports of interfaces/traits/enums additionally need #47's nodes to exist before they can land.
Fixed on the fork feature branch fix/stub-shadowing-46 (commit 258d8e3, cherry-picked from fix/48-imports-target-fqn), headed for the single PR into v8.
What landed: the repoint pass in _resolve_php_type_references resolves class imports edges from their own target_fqn metadata (stamped by _import_php since #19) instead of requiring a stub node to read a label from — an import used only via ::class no longer dangles. Unresolvable FQNs park on FQN-labeled external stubs (deduped by FQN, never bare-matched to a same-short-name type). use function/use const are excluded from the type map.
Acceptance criteria:
Red-first OnlyImport.php case: use App\Repo\DbFooRepository; used only as ::class — the edge lands on the real class node (was dangling on base; verified red by review).
No new false merges: an FQN resolving to nothing parks on a labeled external stub; the FQN label keys distinctly under _node_label_key, so the bare-label rewire cannot collapse it onto a same-short-name type (explicit test, mutation-verified by review).
Existing resolution tests green; the modified capture-layer test was split, not weakened (review verified the original invariant still passes on base via the extract_php seam).
Bonus deltas (intended, tested): aliased imports (use A\B\C as D;) now resolve to the written FQN instead of a namespace guess; class imports in namespace-less files repoint too (the use FQN is itself the namespace fact).
Review history worth recording: the first round found a major — repointing could add arbitrary short-name ids to the orphan-prune set, silently deleting an unrelated real node whose id collided with an imported short name (e.g. a Page.md doc node vanishing when any file gained use Vendor\Pkg\Page;). Fixed with a stub-only guard plus a regression test; the re-review mutation-tested the guard (dropping it fails exactly that test) and confirmed the repro now keeps the real node. Final verdict: APPROVE, no findings. Full suite on the integrated branch: 4321 passed / 3 skipped.
Activity
filipechagas commentedon Aug 7, 2026
Fixed on the fork feature branch
fix/stub-shadowing-46(commit 258d8e3, cherry-picked fromfix/48-imports-target-fqn), headed for the single PR into v8.What landed: the repoint pass in
_resolve_php_type_referencesresolves classimportsedges from their owntarget_fqnmetadata (stamped by_import_phpsince #19) instead of requiring a stub node to read a label from — an import used only via::classno longer dangles. Unresolvable FQNs park on FQN-labeled external stubs (deduped by FQN, never bare-matched to a same-short-name type).use function/use constare excluded from the type map.Acceptance criteria:
OnlyImport.phpcase:use App\Repo\DbFooRepository;used only as::class— the edge lands on the real class node (was dangling on base; verified red by review)._node_label_key, so the bare-label rewire cannot collapse it onto a same-short-name type (explicit test, mutation-verified by review).extract_phpseam).ChargeCustomerCancellationFeeresolves without disambiguation retry) and the 19,303-dangling-imports drop — deferred to Stub-shadow fix 4/4: release + acceptance grading on the pinned api corpus #50's grading rebuild, as specced.Bonus deltas (intended, tested): aliased imports (
use A\B\C as D;) now resolve to the written FQN instead of a namespace guess; class imports in namespace-less files repoint too (theuseFQN is itself the namespace fact).Review history worth recording: the first round found a major — repointing could add arbitrary short-name ids to the orphan-prune set, silently deleting an unrelated real node whose id collided with an imported short name (e.g. a
Page.mddoc node vanishing when any file gaineduse Vendor\Pkg\Page;). Fixed with a stub-only guard plus a regression test; the re-review mutation-tested the guard (dropping it fails exactly that test) and confirmed the repro now keeps the real node. Final verdict: APPROVE, no findings. Full suite on the integrated branch: 4321 passed / 3 skipped.Merge upstream/v8 (v0.9.42) into consolidated/php-support-1682