Skip to content

bug(analytics): 6 registry-mounted router modules outside api/ are never scanned — their routes report as missing #12946

Description

@mrveiss

Split out of #12945 so the delivered part has a closable scope. #12945 stays open for the package case.

Problem

BackendEndpointScanner.scan_all_endpoints() walks backend_dir / "api" only, but the router registries also mount routers from sibling packages. Six of them are plain module files:

services.advanced_workflow.routes   -> /advanced-workflow
services.autoresearch.routes        -> /autoresearch
services.workflow_automation.routes -> /workflow-automation
routers.code_completion             -> /code-completion
routers.model_management            -> /code-completion/model
routers.feedback                    -> /code-completion/feedback

None of their routes were discovered, so every frontend call to one was reported as targeting a missing endpoint.

The prefix must be carried explicitly

_parse_config_tuple_registry stores the full dotted path (_module_prefix_map["services.advanced_workflow.routes"]), but _scan_file resolves a file's prefix via _get_module_prefix(), which tries the path relative to project_root and then py_file.stem. For services/advanced_workflow/routes.py the stem is routes, which matches nothing — so simply feeding these files into the existing loop discovers the routes under /api instead of /api/advanced-workflow.

Scope

Module files only. Registry entries naming a package are excluded and tracked in #12945 — see that issue for why applying a package's prefix per-submodule is actively wrong.

Done when

  • Routes from the six module-form registry entries are discovered under their registered prefixes.
  • No increase in scanned paths absent from app.openapi().

Activity

  1. github-actions commented on Jul 29, 2026

    @github-actions
    Contributor

    PR #12947 (merged to Dev_new_gui) references this issue with a close keyword.

    fix(analytics): scan registry-mounted router modules outside api/ (#12946)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Jul 29, 2026

    @mrveiss
    OwnerAuthor

    Closed by PR #12947, squash-merged to Dev_new_gui as 95cc9d793.

    _registry_router_files() resolves registry module paths against the backend directory and carries the registered prefix to the scanned file, since _get_module_prefix() keys on py_file.stem (routes) which matches nothing.

    Measured on indexed source c5939a51-… against app.openapi() (2159 unique paths):

    before after
    router files scanned outside api/ 0 6
    endpoints found 1986 2041
    real routes matched 1736 (80.4%) 1789 (82.9%)
    real routes missed 423 370
    scanned but not real 70 70

    53 real routes recovered with no new spurious endpoints — that last row is the guard against the failure mode described in #12945 (applying a package's prefix per-submodule invented 178 endpoints).

    Verification: 16 passed in api_endpoint_scanner_test.py (11 pre-existing + 5 new), 230 passed / 11 skipped across api/codebase_analytics/, flake8 clean.

    Package-form registry entries (llc.api, ~182 routes) remain on #12945.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions