You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(spa): route by real_app_label, not the get_app_list group label (#163)
Regression from the get_app_list honoring work (#140/#152/#158).
The registry endpoint correctly emits, per model:
- app_label — the *display* label (the consumer's custom
get_app_list group name, e.g. "financial_
institutions"), and
- real_app_label — the model's true _meta.app_label (e.g. "bank").
The backend was designed for this: real_app_label is the routing key
that round-trips through resolve_model. But the SPA frontend was
never updated to use it — Layout.tsx, HomePage.tsx, and the
RegistryModelEntry type all still built model URLs from app_label
(the group). For any consumer whose AdminSite.get_app_list returns
custom groupings (very common — laminr does), every sidebar/card
link pointed at /<group_label>/<model>/, which resolve_model can't
resolve → 404 on every model. The SPA presented this as
"Couldn't load the list / HTTP 500"-style empty/error states.
Fix (frontend-only — the backend was already correct):
- contract.ts — add `real_app_label` to RegistryModelEntry and
`is_group?` to RegistryAppEntry, with doc comments stating that
app_label is display-only and real_app_label is the routing key.
- Layout.tsx + HomePage.tsx — build model links from
`model.real_app_label || app.app_label` (falls back to app_label
for the default ungrouped get_app_list case).
DetailPage/ListPage already use the URL param (which is the real
label by the time the user is on the page), so no change needed there.
Backend round-trip regression test
(tests/test_registry_get_app_list.py::
test_grouped_model_resolves_by_real_app_label_not_group_label):
a model grouped under a synthetic "accounts" group resolves 200 at
/api/v1/auth/user/ and 404 at /api/v1/accounts/user/ — codifying the
contract the SPA fix depends on.
Found by a full real-HTTP sweep of all 86 registered models in the
live consumer pilot: after the get_app_list change, 67/86 models
404'd on navigation because the SPA routed by the group label.
`pnpm --filter @dar/web typecheck` clean; 5/5 get_app_list tests pass.
Co-authored-by: Martin Castro Laminrs <mcastro@laminr.ai>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments