Skip to content

Commit 5cc69fc

Browse files
jopemachineclaude
andcommitted
doc: define the REST v2 URL shape for multi-entity domains
The search URL rules assumed one entity per sub-app, so `/v2/{entity}/search` had no reading for a domain that groups several entities — `scheduling-history` holds session, kernel, deployment, and route histories. Pin the entity as its own segment under the domain prefix, with the qualifier attached to the entity. Also state explicitly that the admin variant carries no path qualifier; only `scoped` and `my` appear as segments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 88c69c1 commit 5cc69fc

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/ai/backend/manager/api/rest/v2/AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ REST v2 Handler → Adapter (api/adapters/) → Processor → Service → Reposi
3838
- `POST /v2/{entity}/search`: superadmin only, no scope — system-wide query.
3939
- scoped search (non-admin): scope required — query within that scope.
4040
- There is no "unscoped system-wide query" for non-admins.
41+
- The admin variant takes **no path qualifier** — it is `/search`, not `/admin/search`. Only `scoped` and `my`
42+
appear as qualifier segments.
43+
44+
**domains that group several entities:**
45+
- When a sub-app covers more than one entity, the entity is its own segment under the domain prefix:
46+
`/v2/{domain}/{entity}/{qualifier}/{operation}`.
47+
Example: `/v2/scheduling-history/kernels/search` and `/v2/scheduling-history/kernels/scoped/search`.
48+
- The qualifier (`scoped`, `my`) always follows the entity, never the domain —
49+
`/v2/scheduling-history/kernels/scoped/search`, not `/v2/scheduling-history/scoped/kernels/search`.
50+
- Everything else on this page reads `{entity}` as this `{domain}/{entity}` pair for such sub-apps.
4151

4252
**scoped search URL** (under consideration):
4353
- Current: `POST /v2/{entity}/{scope_type}/{scope_id}/search` — express the scope as a nested resource path (not `search-by-{scope}`).

src/ai/backend/manager/api/rest/v2/CONTEXTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ class V2DomainHandler:
2424
- `POST /v2/users/projects/{project_id}/search` — users within a project
2525
- `POST /v2/users/roles/{role_id}/search` — users with a specific role
2626

27+
## Multi-entity domains
28+
29+
Some sub-apps cover several entities rather than one. `scheduling-history` is the clearest case: one
30+
domain holding session, kernel, deployment, and route histories. The entity becomes its own segment
31+
under the domain prefix, and the qualifier attaches to the entity:
32+
33+
- `POST /v2/scheduling-history/kernels/search` — admin, system-wide
34+
- `POST /v2/scheduling-history/kernels/scoped/search` — scoped, `auth_required`
35+
36+
Reading the domain as the entity instead (`/v2/scheduling-history/scoped/search`) would make the
37+
qualifier apply to all four histories at once, which is not what the caller is asking for. Splitting
38+
the domain apart (`/v2/kernel-scheduling-histories/search`) loses the grouping that makes the four
39+
histories discoverable as one feature.
40+
2741
## Pagination mode behavior
2842

2943
search endpoints accept both cursor and offset pagination arguments.

0 commit comments

Comments
 (0)