Repository navigation
Conversation
…phify-Labs#5135) _php_get_route_name reads a route's path (or a group's prefix) from the string arguments before the closure, and stops at the closure's argument with `sibling is curr`. py-tree-sitter hands back a new Node object on every access, so `is` never matched: the scan ran past the closure and took a string argument after it. `$app->get(function () {...}, '/late')` became a `GET /late` route, and `$app->group(function ($g) { $g->get('/users', ...); }, '/late')` labelled the inner route `GET /late/users`. Compare with `==`, which py-tree-sitter defines on the node's identity in the tree. Same class of bug as Graphify-Labs#5113. Bump _AST_CACHE_SCHEMA to 44 so cached PHP extractions re-run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks for the pull request, @mppyxx. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).
Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 vacuous).
Not verified on this run: \_php\_get\_route\_name (vacuous: never exercised).
Graphify review — findings
Bumps the AST cache schema so cached extractions re-run, and widens extractor coverage across several languages: Swift constructor types and in-scope type parameters, Java and Kotlin annotation names, C++ parameter types and header-guard detection, Scala type refs, Ruby local class bindings, JS/Python dispatch-table values, and TS public/private twin marking. A PHP generic closure now gets an ordinal name. In the semantic cache, save_semantic_cache recovers group paths and handles hyperedges that dangle. Cache keys also pick up a grammar fingerprint, and stat keys can be mapped back to absolute paths. The diff is truncated, so this summary is based on the visible schema-bump comment and the changed symbol names.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 4530 functions depend on the 542 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract_php()— 40 callers, 5 callees
Verification — 4530 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: 2958 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
97 of 554 test file(s) selected (18%) via static blast radius.
tests/test_4992_ts_import_types.py— impacttests/test_astro_extraction.py— impacttests/test_binary_media_words.py— impacttests/test_build.py— impacttests/test_cache.py— impacttests/test_cache_long_paths.py— impacttests/test_cache_stale_import_target.py— impacttests/test_cache_windows_case_4925.py— impacttests/test_charmap_encoding.py— impacttests/test_chunking.py— impacttests/test_cjs_module_extension.py— impacttests/test_code_only_scope_4923.py— impacttests/test_cpp_alias_member_resolution.py— impacttests/test_cpp_conditional_initializers.py— impacttests/test_cpp_inherited_member_resolution.py— impacttests/test_cpp_nested_and_cli.py— impacttests/test_cpp_template_members.py— impacttests/test_csharp_extension_calls.py— impacttests/test_csharp_extension_metadata.py— impacttests/test_csharp_extension_resolution.py— impacttests/test_csharp_partial_classes.py— impacttests/test_definition_file_portability.py— impacttests/test_detect.py— impacttests/test_dotnet.py— impacttests/test_ejs_extractor.py— impacttests/test_ext_tagged_id_clash.py— impacttests/test_extract.py— impacttests/test_extract_cache_location.py— impacttests/test_extract_cli.py— impacttests/test_extract_php_closures.py— impact, changed-testtests/test_grammar_cache_key.py— impacttests/test_hook_content_freshness.py— impacttests/test_ignore_file_encoding.py— impacttests/test_import_extension_resolution.py— impacttests/test_incremental_mtime_collision.py— impacttests/test_indirect_call_block_scoped_shadow.py— impacttests/test_indirect_dispatch.py— impacttests/test_indirect_dispatch_assign_return.py— impacttests/test_indirect_dispatch_getattr.py— impacttests/test_java_member_calls.py— impacttests/test_js_exported_scalar_bindings.py— impacttests/test_js_member_collisions.py— impacttests/test_language_override_lifecycle.py— impacttests/test_language_overrides.py— impacttests/test_languages.py— impacttests/test_linked_worktree_reconcile.py— impacttests/test_llm_backends.py— impacttests/test_manifest_ingest.py— impacttests/test_msbuild_dir_evidence.py— impacttests/test_multilang.py— impact- … and 47 more
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
Could not verify: Could not verify \_php\_get\_route\_name.
The verifier did not have enough to check \_php\_get\_route\_name, 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: no capturable inputs from the test suite; property tier: not verifiable: all 66 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly AttributeError — names the real obstacle, not a sampling gap)
· 1 more finding(s) on lines outside this diff (see the check run).
What does this PR do?
Closes #5135.
_php_get_route_namereads a route's path (or an enclosing group's prefix) from the string arguments before the closure, and stops at the closure's own argument withsibling is curr. py-tree-sitter hands back a newNodeobject on every access, soisnever matched. The scan ran past the closure and took a string argument after it:$app->get(function () { return 1; }, '/late');GET /late(){closure#1}()(not a route)$app->group(function ($g) { $g->get('/users', fn); }, '/late');GET /late/users()GET /users()$app->group('/api/v1', function ($g) { $g->get('/users/{id}', fn); });GET /api/v1/users/{id}()The fix compares with
==, which py-tree-sitter defines on the node's identity in the tree, the same as the #5113 fix._AST_CACHE_SCHEMAgoes 43 -> 44 so cached PHP extractions re-run.Diff:
engine.py+4/-1,cache.py+1/-1, two tests intests/test_extract_php_closures.py.Type of change
Verification & Invariants
Invariant: a PHP route closure's path and its group prefixes come only from arguments that precede the closure in their call. Persisted state: PHP labels can change for files that hit this case, so the AST cache schema is bumped and cached PHP extractions re-run. Routes with the path before the closure (every existing fixture) keep their labels.
How was this tested?
The two failures in the full run are unrelated and reproduce on a clean v8 checkout here (macOS, Python 3.12, uv):
tests/test_languages.py::test_cpp_paired_merged_node_records_definition_site:definition_filecomes out relative to a different root thansource_file(PosixPath('.') != PosixPath('../../../../../../../Users/.../tests/fixtures/cpp_paired')), so it looks checkout-location dependent.tests/test_skill_no_backtick_substitution.py::test_control_a_backticked_unknown_command_is_caughtGraphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (No skill sources touched.)🤖 Generated with Claude Code