mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-09-11 04:01:32 +00:00
Move the static `GET /api/decisions/causal-distance` endpoint above the
dynamic `GET /api/decisions/{decision_id}` route in the Explorer router.
Starlette evaluates routes sequentially in declaration order. Because
`/{decision_id}` was previously defined first, requests targeting
`/api/decisions/causal-distance` were captured by the parameter route
with `decision_id="causal-distance"`, causing the endpoint to query the
graph for a non-existent decision and return 404.
Changes:
- Reorder `causal_distance` above `get_decision` in
`semantica/explorer/routes/decisions.py` and add a comment guard
against future route-ordering regressions.
- Add regression test suite in
`tests/explorer/test_decisions_causal_distance_route.py` verifying
proper distance reporting, multi-hop traversal, and that unmatched
decision IDs still return 404.
Closes #1531