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
Spec: #1 (upstream: Graphify-Labs#1682). Found by the red-team session against 2e68ec6. Repro: /tmp/rt6/wave2.py::B7_fcc.
Filed as a question rather than ready-for-agent: the fix depends on a maintainer decision about intended relation semantics, so it is not fully specified. Severity LOW — the dependency it records is real; only the relation and confidence are arguable.
Observation
PHP 8.1 first-class callable syntax creates a Closure without invoking the method:
run(...) is a reference to the method, not a call — the invocation may happen elsewhere, later, or never.
Why it may matter
The codebase already models by-name references as a distinct relation. From the shared cross-file pass (extract.py, indirect-dispatch block):
Indirect dispatch: a function passed BY NAME as a call argument (executor.submit(fn), Thread(target=fn), map(fn, xs)) is a real dependency the callee-only scan above can't see. Emit it as a distinct indirect_call.
A first-class callable is the same shape — a method named without being invoked — so indirect_call looks like the more faithful relation, and would keep calls meaning "control flow actually transfers here".
Decision needed
Leave as calls (a dependency edge is more useful than none, and the distinction may not be worth per-language plumbing), or
Re-tag first-class callables as indirect_call for PHP, matching the existing convention.
Worth checking whether the other member-call resolvers (C#, Java, TS) already emit calls for their equivalent syntax (C# method-group conversion, TS bare obj.method references) — if so, PHP is consistent with the rest of the codebase and option 1 is the coherent answer, making this a documentation note for #7 rather than a code change.
If option 2 is chosen
$obj->method(...) emits indirect_call, not calls
Ordinary $obj->method() still emits calls at unchanged confidence
Detection keyed on the argument list being exactly the ... spread token on the pinned grammar (tree-sitter-php 0.24.1), probe-verified
Maintainer decision: option 2 — re-tag as indirect_call
Decision made 2026-08-05 after a consistency investigation of the other member-call resolvers (the check this issue asked for). Findings, so they survive /tmp:
Investigation summary (v8 @ 102ae79)
No other language emits calls for a non-invoking member reference — they all emit nothing:
C# method group (var f = obj.Search;): call_types = {"invocation_expression"} (extract.py:878), and the C# capture branch is additionally guarded on invocation_expression (engine.py:4567). A bare member_access_expression is never captured.
TypeScript bare reference (const f = obj.method;): call_types = {"call_expression", "new_expression"} (extract.py:761); the JS/TS indirect-dispatch capture only takes bare identifiers (engine.py:4952, :5228), never member expressions.
PHP lets $obj->method(...) through only because PHP 8.1 reuses the invocation node (member_call_expression) for first-class callable syntax — the shared node.type in config.call_types gate (engine.py:4496) cannot see the difference, and the PHP branch never inspects the arguments field (engine.py:4636-4685).
Discriminator (probe-verified on the pinned grammar, tree-sitter-php 0.24.1):run(...) parses as arguments: (arguments (variadic_placeholder)) — a single named child of type variadic_placeholder. run() and run(1) do not. Zero ambiguity.
indirect_call today: emitted at engine.py:4362-4371 (in-file) and extract.py:5942-5965 (cross-file, INFERRED 0.8), only for bare identifiers in Python/JS/TS. Downstream: included in DEFAULT_AFFECTED_RELATIONS (affected.py:12-26), excluded from call-flow diagram preferred edges (callflow_html.py:559), bypasses the cross-language INFERRED suppression in analyze.py:228-233.
Why option 2 over suppression
Suppression would match the siblings byte-for-byte, but the siblings' behavior is a capture gap, not a policy: the repo's stated model for "named but not invoked" is indirect_call (the indirect-dispatch block's own comment). A first-class callable is a real dependency; keeping it visible under the faithful relation beats deleting it. This will be the first member-reference indirect_call and the first from the PHP extractor — worth a line in the changelog and docs.
Acceptance criteria
As written in the issue body under "If option 2 is chosen", plus:
The raw-call fact carries an explicit marker (e.g. fcc: true) stamped at capture; _resolve_php_member_calls emits relation: "indirect_call" for marked facts at unchanged target-resolution rules (same refusal policy as calls)
Nullsafe variant $obj?->method(...) covered by a test
$this->method(...) (first-class callable on $this) also re-tags, with a test
Decoy discipline: positive tests carry a same-named decoy asserted to get NO edge
CHANGELOG line naming the behavior delta (edge moves from calls to indirect_call)
Branch fix/php-fcc-indirect-call-15, one commit cf49aff, cut from v8 @ 102ae79. Not pushed; issue left open for orchestrator verification.
What changed
graphify/extractors/engine.py — PHP capture branch (walk_calls): stamps php_fcc when a member_call_expression / nullsafe_member_call_expression has an arguments node with exactly one named child of type variadic_placeholder; propagates it as rc_entry["fcc"] = True on the raw-call fact, and re-tags the in-file emission path to indirect_call (needed for $this->m(...), which resolves in-file and never reaches the cross-file resolver). A new seen_php_fcc_pairs dedup set keeps an fcc reference from ever swallowing a real calls edge to the same pair; if the direct call is seen second, it supersedes the fcc edge, so the outcome is source-order independent.
graphify/extract.py — _resolve_php_member_calls emits "indirect_call" if raw_call.get("fcc") else "calls"; receiver typing, the single-definition / interface-enum-trait refusals, and the confidence ladder are untouched. The loop now flattens PHP raw calls first and stable-sorts fcc last, so ordinary invocations claim the (caller, method) pair first. Most of the file's diff line count is the resulting dedent — git diff -w is 22 insertions / 5 deletions.
tests/test_php_first_class_callable.py — new, 7 cases, all through the public extract() seam.
docs/how-it-works.md — paragraph after the PHP refuse-don't-guess section.
Acceptance criteria
$obj->method(...) emits indirect_call, not calls
Ordinary $obj->method() still emits calls at unchanged confidence
Detection keyed on the argument list being exactly the ... spread token on tree-sitter-php 0.24.1, probe-verified
Full test suite green
Explicit fcc marker stamped at capture; _resolve_php_member_calls emits indirect_call under the same target-resolution and refusal rules
Nullsafe variant $obj?->method(...) covered by a test
$this->method(...) also re-tags, with a test
Decoy discipline: each positive test carries a same-named decoy asserted to get NO edge
CHANGELOG line naming the behavior delta
Test results
Red (new file only, before the fix): 3 failed, 4 passed — the three positives (plain, nullsafe, $this) failed; the four regression guards passed, as they must.
Green (new file): 7 passed.
Full suiteuv run --frozen --extra ollama pytest: 4031 passed, 36 skipped, 0 failed (baseline 4024/36 + 7 new). No flake in test_labeling.py.
ruff check clean on the three changed source files.
The 7 cases: plain fcc on a typed property, nullsafe fcc, $this fcc (each with a same-named decoy in another class asserted to get no edge), plus regression guards for the ordinary member call, the ordinary $this call, the ...$args spread, and direct-call precedence.
Discriminator re-verified
Probe run with uv run --frozen python against tree-sitter-php 0.24.1 (version printed by the probe):
source
arguments named children
$this->svc->run(...)
['variadic_placeholder']
$this->svc?->run(...)
['variadic_placeholder']
$this->helper(...)
['variadic_placeholder']
$this->svc->run()
[]
$this->svc->run(1)
['argument']
$this->svc->run(...$args)
['argument']
The spread form is distinguishable, so m(...$args) correctly stays calls.
Deviations from the design, and why
The in-file emission path was re-tagged too. The plan named only the capture marker plus _resolve_php_member_calls, but $this->method(...) is matched by the in-file label_to_nid scan — _php_defer is false when no receiver type is known — so it never reaches the cross-file resolver. Without the engine-side change, that acceptance-criteria line would have silently failed.
Direct-call precedence was added. Sharing seen_call_pairs between the two relations would let an fcc appearing first suppress a genuine calls edge to the same target — a regression against AC PHP member calls tracer bullet: $this->prop->method() resolves to an INFERRED calls edge #2. Resolved by mirroring the precedence _emit_indirect_ref already uses (direct wins), on both the in-file and cross-file paths; covered by test_direct_call_wins_over_first_class_callable_to_the_same_method.
Confidence deliberately unchanged, per "unchanged target-resolution rules": a $this fcc stays EXTRACTED 1.0, a typed-receiver fcc stays INFERRED 0.8. This makes the first indirect_call edges in the codebase that are not INFERRED — the other two emitters (engine.py:4362, extract.py:5954) hardcode INFERRED. The confidence answers "is this the right target", which is as certain here as for the equivalent invocation. If relation-uniform confidence is preferred, it is a one-line change in each emitter — flag it and I will make it.
Notes for follow-up tickets
Static and plain-function first-class callables are not covered.Helper::fmt(...) and strlen(...) parse with the same variadic_placeholder child (confirmed by the same probe), but the PHP branch resolves scoped_call_expression to the class (callee = scope) and function_call_expression to a function node, so neither produces the method-target edge this issue is about. Re-tagging them is a separate decision — the Helper::fmt(...) case would tag a class-level edge as indirect_call, which may not be wanted.
AST cache. The new fcc key rides in cached raw_calls. The version-namespaced cache is still at the already-bumped 0.9.34, so anyone who extracted with an intermediate 0.9.34 dev build keeps stale calls edges until graphify update . re-dispatches. Same exposure as the other tickets in this batch; no further bump made.
Downstream consumers (verified by grep, not by new tests): indirect_call is already in DEFAULT_AFFECTED_RELATIONS (affected.py:14), so blast-radius output is unchanged; call-flow diagrams exclude it (callflow_html.py:559); and analyze.py's cross-language INFERRED suppression matches only calls/uses, so these edges now bypass it. All three match the prediction in the maintainer decision above.
The counts in my report above (4031 passed / 36 skipped) were measured against v8 @ 102ae79. #9 has since merged as 6e91dbd, moving the baseline to 4034 / 36, so I merged origin/v8 into fix/php-fcc-indirect-call-15 (merge commit d97e37d, still not pushed).
Updated counts — uv run --frozen --extra ollama pytest on the merge commit: 4041 passed, 36 skipped, 0 failed (4034 + this branch's 7). ruff check clean on both changed source files. Nothing else in the report changes: same implementation, same 7 tests, same red counts (3 failed / 4 passed before the fix).
Conflicts:CHANGELOG.md only. Both sides had edited the Known open items line of the unreleased 0.9.34 section — #9 removed its own clause, this branch removed the #15 clause. Resolved keeping all three new bullets: the two #9Fix: bullets, then this branch's first-class-callable Behavior change: bullet, then the open-items line now naming only #10. graphify/extractors/engine.py auto-merged (#9 rewrote the _php_receiver_type derivation directly above the emission block this branch changed); graphify/extract.py, docs/how-it-works.md and the new test file were untouched by the merge.
One cross-ticket interaction worth recording, since #9 routes new cases into the code path this branch changed: a union- or intersection-typed receiver's first-class callable ($multi->m(...)) now takes #9's defer path, reaches the cross-file resolver marked fcc but with no receiver_type, and is refused — so it emits no edge at all, exactly as its ordinary $multi->m() call does. The refusal wins over the re-tag, which is the intended precedence. Verified by probe rather than inferred: a private Alpha|Beta $svc receiver invoking both run(...) and run() produced zero calls and zero indirect_call edges from the caller. Not added to the test suite — it is #9's refusal being exercised, and #9 already owns coverage for that rule; say the word if you would rather have it pinned as a regression test here.
Closed by PR #27 (merge commit 2a9f9fe). Orchestrator gate evidence: independent full-suite runs reproduced 4031/36 at branch head (pre-merge baseline 4024/36 + 7 new tests) and 4041/36 on the merged tree (post-#9 baseline 4034/36 + 7). Red state recorded: 3 failures against unfixed code, 4 regression guards green as required. The #9-interaction (union-typed receiver's first-class callable refuses entirely) was probe-verified during the merge. v8 baseline is now 4041/36.
Activity
filipechagas commentedon Aug 5, 2026
Maintainer decision: option 2 — re-tag as
indirect_callDecision made 2026-08-05 after a consistency investigation of the other member-call resolvers (the check this issue asked for). Findings, so they survive
/tmp:Investigation summary (v8 @
102ae79)No other language emits
callsfor a non-invoking member reference — they all emit nothing:var f = obj.Search;):call_types = {"invocation_expression"}(extract.py:878), and the C# capture branch is additionally guarded oninvocation_expression(engine.py:4567). A baremember_access_expressionis never captured.obj::search):call_types = {"method_invocation", "object_creation_expression"}(extract.py:802);method_referenceappears nowhere ingraphify/.const f = obj.method;):call_types = {"call_expression", "new_expression"}(extract.py:761); the JS/TS indirect-dispatch capture only takes bare identifiers (engine.py:4952,:5228), never member expressions.PHP lets
$obj->method(...)through only because PHP 8.1 reuses the invocation node (member_call_expression) for first-class callable syntax — the sharednode.type in config.call_typesgate (engine.py:4496) cannot see the difference, and the PHP branch never inspects theargumentsfield (engine.py:4636-4685).Discriminator (probe-verified on the pinned grammar, tree-sitter-php 0.24.1):
run(...)parses asarguments: (arguments (variadic_placeholder))— a single named child of typevariadic_placeholder.run()andrun(1)do not. Zero ambiguity.indirect_calltoday: emitted atengine.py:4362-4371(in-file) andextract.py:5942-5965(cross-file, INFERRED 0.8), only for bare identifiers in Python/JS/TS. Downstream: included inDEFAULT_AFFECTED_RELATIONS(affected.py:12-26), excluded from call-flow diagram preferred edges (callflow_html.py:559), bypasses the cross-language INFERRED suppression inanalyze.py:228-233.Why option 2 over suppression
Suppression would match the siblings byte-for-byte, but the siblings' behavior is a capture gap, not a policy: the repo's stated model for "named but not invoked" is
indirect_call(the indirect-dispatch block's own comment). A first-class callable is a real dependency; keeping it visible under the faithful relation beats deleting it. This will be the first member-referenceindirect_calland the first from the PHP extractor — worth a line in the changelog and docs.Acceptance criteria
As written in the issue body under "If option 2 is chosen", plus:
fcc: true) stamped at capture;_resolve_php_member_callsemitsrelation: "indirect_call"for marked facts at unchanged target-resolution rules (same refusal policy ascalls)$obj?->method(...)covered by a test$this->method(...)(first-class callable on$this) also re-tags, with a testcallstoindirect_call)filipechagas commentedon Aug 5, 2026
Implementation report — option 2 landed
Branch
fix/php-fcc-indirect-call-15, one commitcf49aff, cut fromv8@102ae79. Not pushed; issue left open for orchestrator verification.What changed
graphify/extractors/engine.py— PHP capture branch (walk_calls): stampsphp_fccwhen amember_call_expression/nullsafe_member_call_expressionhas anargumentsnode with exactly one named child of typevariadic_placeholder; propagates it asrc_entry["fcc"] = Trueon the raw-call fact, and re-tags the in-file emission path toindirect_call(needed for$this->m(...), which resolves in-file and never reaches the cross-file resolver). A newseen_php_fcc_pairsdedup set keeps an fcc reference from ever swallowing a realcallsedge to the same pair; if the direct call is seen second, it supersedes the fcc edge, so the outcome is source-order independent.graphify/extract.py—_resolve_php_member_callsemits"indirect_call" if raw_call.get("fcc") else "calls"; receiver typing, the single-definition / interface-enum-trait refusals, and the confidence ladder are untouched. The loop now flattens PHP raw calls first and stable-sorts fcc last, so ordinary invocations claim the(caller, method)pair first. Most of the file's diff line count is the resulting dedent —git diff -wis 22 insertions / 5 deletions.tests/test_php_first_class_callable.py— new, 7 cases, all through the publicextract()seam.CHANGELOG.md— behavior-delta bullet under 0.9.34; dropped the now-stale "PHP: first-class callable $obj->method(...) emits a calls edge; candidate indirect_call #15 unfixed" clause from the known-open-items line.docs/how-it-works.md— paragraph after the PHP refuse-don't-guess section.Acceptance criteria
$obj->method(...)emitsindirect_call, notcalls$obj->method()still emitscallsat unchanged confidence...spread token on tree-sitter-php 0.24.1, probe-verifiedfccmarker stamped at capture;_resolve_php_member_callsemitsindirect_callunder the same target-resolution and refusal rules$obj?->method(...)covered by a test$this->method(...)also re-tags, with a testTest results
$this) failed; the four regression guards passed, as they must.uv run --frozen --extra ollama pytest: 4031 passed, 36 skipped, 0 failed (baseline 4024/36 + 7 new). No flake intest_labeling.py.ruff checkclean on the three changed source files.The 7 cases: plain fcc on a typed property, nullsafe fcc,
$thisfcc (each with a same-named decoy in another class asserted to get no edge), plus regression guards for the ordinary member call, the ordinary$thiscall, the...$argsspread, and direct-call precedence.Discriminator re-verified
Probe run with
uv run --frozen pythonagainst tree-sitter-php 0.24.1 (version printed by the probe):argumentsnamed children$this->svc->run(...)['variadic_placeholder']$this->svc?->run(...)['variadic_placeholder']$this->helper(...)['variadic_placeholder']$this->svc->run()[]$this->svc->run(1)['argument']$this->svc->run(...$args)['argument']The spread form is distinguishable, so
m(...$args)correctly stayscalls.Deviations from the design, and why
_resolve_php_member_calls, but$this->method(...)is matched by the in-filelabel_to_nidscan —_php_deferis false when no receiver type is known — so it never reaches the cross-file resolver. Without the engine-side change, that acceptance-criteria line would have silently failed.seen_call_pairsbetween the two relations would let an fcc appearing first suppress a genuinecallsedge to the same target — a regression against AC PHP member calls tracer bullet: $this->prop->method() resolves to an INFERRED calls edge #2. Resolved by mirroring the precedence_emit_indirect_refalready uses (direct wins), on both the in-file and cross-file paths; covered bytest_direct_call_wins_over_first_class_callable_to_the_same_method.$thisfcc stays EXTRACTED 1.0, a typed-receiver fcc stays INFERRED 0.8. This makes the firstindirect_calledges in the codebase that are not INFERRED — the other two emitters (engine.py:4362,extract.py:5954) hardcode INFERRED. The confidence answers "is this the right target", which is as certain here as for the equivalent invocation. If relation-uniform confidence is preferred, it is a one-line change in each emitter — flag it and I will make it.Notes for follow-up tickets
Helper::fmt(...)andstrlen(...)parse with the samevariadic_placeholderchild (confirmed by the same probe), but the PHP branch resolvesscoped_call_expressionto the class (callee = scope) andfunction_call_expressionto a function node, so neither produces the method-target edge this issue is about. Re-tagging them is a separate decision — theHelper::fmt(...)case would tag a class-level edge asindirect_call, which may not be wanted.fcckey rides in cachedraw_calls. The version-namespaced cache is still at the already-bumped 0.9.34, so anyone who extracted with an intermediate 0.9.34 dev build keeps stalecallsedges untilgraphify update .re-dispatches. Same exposure as the other tickets in this batch; no further bump made.indirect_callis already inDEFAULT_AFFECTED_RELATIONS(affected.py:14), so blast-radius output is unchanged; call-flow diagrams exclude it (callflow_html.py:559); andanalyze.py's cross-language INFERRED suppression matches onlycalls/uses, so these edges now bypass it. All three match the prediction in the maintainer decision above.filipechagas commentedon Aug 5, 2026
Rebaselined onto v8 after #9 merged
The counts in my report above (4031 passed / 36 skipped) were measured against
v8@102ae79. #9 has since merged as6e91dbd, moving the baseline to 4034 / 36, so I mergedorigin/v8intofix/php-fcc-indirect-call-15(merge commitd97e37d, still not pushed).Updated counts —
uv run --frozen --extra ollama pyteston the merge commit: 4041 passed, 36 skipped, 0 failed (4034 + this branch's 7).ruff checkclean on both changed source files. Nothing else in the report changes: same implementation, same 7 tests, same red counts (3 failed / 4 passed before the fix).Conflicts:
CHANGELOG.mdonly. Both sides had edited the Known open items line of the unreleased 0.9.34 section — #9 removed its own clause, this branch removed the #15 clause. Resolved keeping all three new bullets: the two #9Fix:bullets, then this branch's first-class-callableBehavior change:bullet, then the open-items line now naming only #10.graphify/extractors/engine.pyauto-merged (#9 rewrote the_php_receiver_typederivation directly above the emission block this branch changed);graphify/extract.py,docs/how-it-works.mdand the new test file were untouched by the merge.One cross-ticket interaction worth recording, since #9 routes new cases into the code path this branch changed: a union- or intersection-typed receiver's first-class callable (
$multi->m(...)) now takes #9's defer path, reaches the cross-file resolver markedfccbut with noreceiver_type, and is refused — so it emits no edge at all, exactly as its ordinary$multi->m()call does. The refusal wins over the re-tag, which is the intended precedence. Verified by probe rather than inferred: aprivate Alpha|Beta $svcreceiver invoking bothrun(...)andrun()produced zerocallsand zeroindirect_calledges from the caller. Not added to the test suite — it is #9's refusal being exercised, and #9 already owns coverage for that rule; say the word if you would rather have it pinned as a regression test here.Merge pull request #27 from lawnstarter/fix/php-fcc-indirect-call-15
filipechagas commentedon Aug 5, 2026
Closed by PR #27 (merge commit 2a9f9fe). Orchestrator gate evidence: independent full-suite runs reproduced 4031/36 at branch head (pre-merge baseline 4024/36 + 7 new tests) and 4041/36 on the merged tree (post-#9 baseline 4034/36 + 7). Red state recorded: 3 failures against unfixed code, 4 regression guards green as required. The #9-interaction (union-typed receiver's first-class callable refuses entirely) was probe-verified during the merge. v8 baseline is now 4041/36.