Files
codebase-memory-mcp/src
Martin Vogel 70e73442ed fix(routes): leave a PSR-4-covered handler without a class file unresolved
Why: when a composer.json PSR-4 prefix covers a handler class but no
class file exists for it, cbm_registry_resolve_handler fell through to
the namespace/folder fallback and bound the route to a same-named class
in any folder that mirrors the namespace, a class composer never loads.
Main's import resolver stops in that case: resolve_php_psr4_class leaves
the `use` import unresolved (#1186). The handler now does the same, so
no guessed HANDLES edge is minted. Classes that no PSR-4 prefix covers
keep the fallback unchanged.

Change:
- pipeline_internal.h: cbm_pipeline_psr4_member_qn returns a tri-state
  cbm_psr4_member_t (NOT_COVERED, RESOLVED, UNRESOLVED) and hands out
  the member QN through an out parameter, set only when RESOLVED.
  UNRESOLVED means a prefix covers the class but no class file holds
  the class with that member: the file is absent, or it lacks the class
  or the member.
- pass_pkgmap.c: maps the outcome of resolve_php_psr4_class onto it;
  the class/member lookup in the resolved file moves into
  psr4_member_in_file.
- registry.c: cbm_registry_resolve_handler returns unresolved on
  UNRESOLVED and runs the folder fallback only on NOT_COVERED.

Proof:
- New handles_laravel_psr4_absent_class_issue1146 and its _parallel
  twin (edge_types_probe) extend the issue-1146 fixture with a route to
  \Acme\Blog\Http\MissingController::index (covered by Acme\Blog\ ->
  packages/blog/src/, no class file) and one to PostsController::archive
  (class file exists, no archive method), plus namespace-mirroring
  decoys in legacy/Acme/Blog/Http that hold both members. The test
  asserts exactly the 4 HANDLES of the fixture and that both Route nodes
  exist. RED before the change on both paths with the 2 decoy edges
  (legacy...MissingController.index -> /blog/missing,
  legacy...PostsController.archive -> /blog/archive; expected=4
  actual=6; suite 77 passed, 2 failed). GREEN after (79 passed). RED
  again with the production change reverted (the same 2 edges), GREEN
  once it was restored.
- Real input: koel/koel v9.11.1 (App\ -> app/) indexed with the new
  binary under a private HOME, cache and runtime: 16,564 nodes, 60,177
  edges, 15 Routes and 1 HANDLES (/demo/new-session ->
  NewSessionController.__invoke), identical to the numbers recorded for
  42118ad1.
- Suites: edge_types_probe 79, edge_imports 68, pipeline 317 and
  route_canon 11 all pass (475). make lint-ci passes.

Refs #1146

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-05 01:37:11 +02:00
..