fix(apex): match commas, spaces, and dots in method return types - #3218
fix(apex): match commas, spaces, and dots in method return types#3218Fmahdavi wants to merge 1 commit into
Conversation
The return type in method_re was a single character class [\w<>\[\]]+, which cannot match Map<String, Object> (comma, space), Database.QueryLocator (dot), or List<Map<String, Id>> (nested generic). Every method with such a return type was silently dropped from the graph -- including Database.Batchable start() entry points and @AuraEnabled Map<String, Object> controller methods. Replace it with a base token plus an optional <...> generic group. The group excludes ;{}()= so declarations with initializers (Map<Id, X> m = new Map<Id, X>();) and control-flow lines still cannot match. On a 455-file production Apex codebase this recovers 512 method signatures with zero regressions (the old pattern's match set is strictly contained in the new one). Fixes Graphify-Labs#3217 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Fixes the Apex extractor dropping methods whose return type contains dots, spaces, commas, or nested generics — Map<String, Object>, Database.QueryLocator, and List<Map<String, Id>> return types are now matched via a dedicated _RETTYPE pattern instead of a single character class. Adds a regression test and fixture methods covering those cases.
No blocking issues surfaced. 2 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 574 functions depend on the 574 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract_apex()— 16 callers, 4 callees
Verification — 574 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: 574 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify extract\_apex.
The verifier did not have enough to check extract\_apex, 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: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 more finding(s) on lines outside this diff (see the check run).
Fixes #3217
Problem
method_rein the Apex extractor matches the return type with a single character class,[\w<>\[\]]+, which cannot contain a comma, space, or dot. Any method returningMap<String, Object>,Database.QueryLocator,List<Map<String, Id>>, or an inner/dotted type is silently dropped — no node, no edges, no warning. In practice that includes everyDatabase.Batchablestart()and the common@AuraEnabled Map<String, Object>controller pattern.Fix
Replace the return-type token with a base token plus an optional generic group:
Excluding
;{}()=inside<...>keeps non-signature lines from matching: declarations with initializers (Map<Id, X> m = new Map<Id, X>();), calls, and control flow all still fail to match, and the existing_CONTROL_FLOWname filter is unchanged.Verification
test_apex_method_generic_and_dotted_return_typesfails on the old pattern, passes on the new one (fixture extended with the three shapes).tests/test_languages.pyrun produces an identical failure set with and without this change in my environment (pre-existing, unrelated to apex).🤖 Generated with Claude Code