mirror of
https://github.com/langgenius/dify.git
synced 2026-05-26 11:57:40 +08:00
The Inspector controller previously wrapped ``NodeOutputInspectorError`` in the generic ``NotFoundError`` (``error_code = "not_found"``), losing the specific code the service raises (``workflow_run_not_found`` / ``published_run_inspector_not_implemented`` / ``node_not_in_workflow_run`` / ``node_output_not_declared``). Discovered while driving the full real-user-flow E2E (both api server and agent backend running, real /login → JWT + CSRF, real /apps POST, real Inspector GET) — body code came back ``not_found`` instead of the specific value the design doc §11 promises. Fix introduces a small ``_InspectorNotFound(BaseHTTPException)`` subclass that takes the inspector error and copies its code onto the response. The 404 status code is unchanged; only the body's ``code`` field is now specific. E2E now confirms: - ``cross-tenant access blocked (404) — body: workflow_run_not_found`` - ``published-run access 404 — body code: published_run_inspector_not_implemented`` All unit tests (92) still pass; pyrefly + mypy + ruff clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>