Commit 1851f3b
refactor: model the fragment scoped search as a scope action
`ScopedSearchAppConfigFragmentAction` was a `BaseBulkAction[SearchableActionTarget]`
holding a list of domain/user targets that the repository OR-combined into one
query. A search is not a bulk mutation over entities: it acts at one RBAC scope
and returns whatever lives under it. `BaseBulkAction` exists to authorize an
operation per entity across a batch, which is why `bulk_update` / `bulk_purge`
carry the bulk RBAC validator — the scoped search carried none at all, so once an
API reaches it any authenticated caller could read any domain's or user's
fragments by naming them in the request.
Model it the way the sibling `CreateAppConfigFragmentAction` already models a
write: one `BaseScopeAction` at the single scope named by the request, deriving
its RBAC facets through `AppConfigScopeType.to_rbac_*`, wired through
`ScopeActionProcessor` with the scope RBAC validator.
The fragment row is `(scope_type, scope_id)`, so one scope expresses the query
exactly: `DomainAppConfigFragmentSearchScope` and
`UserAppConfigFragmentSearchScope` collapse into `AppConfigFragmentSearchScope`,
and `scoped_search(querier, scope)` takes a single scope.
Searching several scopes in one request is gone — it was the only thing the list
bought, and it cannot be authorized as a single scope action. Nothing consumed
the removed `queried_refs` / `element_refs()` on the result.
Tests are parametrized over the scope instead of one near-identical test per
kind; the OR-across-scopes case is dropped with the capability.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ef72c3f commit 1851f3b
8 files changed
Lines changed: 167 additions & 190 deletions
File tree
- src/ai/backend/manager
- repositories/app_config_fragment
- db_source
- services/app_config_fragment
- actions
- tests/unit/manager
- repositories/app_config_fragment
- services/app_config_fragment
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
Lines changed: 15 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
22 | | - | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 52 | + | |
| 53 | + | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
82 | 59 | | |
83 | 60 | | |
84 | 61 | | |
85 | | - | |
| 62 | + | |
| 63 | + | |
86 | 64 | | |
87 | 65 | | |
88 | 66 | | |
89 | | - | |
90 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
91 | 71 | | |
92 | 72 | | |
93 | 73 | | |
| |||
Lines changed: 35 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | | - | |
6 | 3 | | |
7 | 4 | | |
8 | 5 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 6 | + | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | | - | |
18 | 10 | | |
19 | | - | |
20 | | - | |
| 11 | + | |
21 | 12 | | |
22 | 13 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
53 | 18 | | |
54 | 19 | | |
55 | 20 | | |
56 | | - | |
57 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
58 | 28 | | |
59 | | - | |
| 29 | + | |
60 | 30 | | |
61 | 31 | | |
62 | 32 | | |
63 | | - | |
64 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
65 | 36 | | |
66 | 37 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 38 | + | |
| 39 | + | |
70 | 40 | | |
71 | 41 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 42 | + | |
| 43 | + | |
75 | 44 | | |
76 | 45 | | |
77 | | - | |
78 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
79 | 52 | | |
80 | 53 | | |
81 | 54 | | |
82 | | - | |
| 55 | + | |
| 56 | + | |
83 | 57 | | |
84 | 58 | | |
85 | 59 | | |
86 | 60 | | |
87 | | - | |
88 | 61 | | |
89 | 62 | | |
90 | | - | |
91 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
| 83 | + | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
89 | | - | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| |||
0 commit comments