Commit 482bd12
committed
refactor(BA-5528): move print_summary onto entry, split clear, drop raw dict iter
Address review comments on PR #11344:
- types.py: add DeploymentChatCacheEntry.print_summary classmethod that
owns the full per-deployment display (deployment_id header + entry
fields + masked api_key line). The caller passes a pre-masked token
string so the type stays free of the mask_token helper. The free
function _print_entry in commands.py is gone.
- commands.py: split chat-config clear into chat-config clear-cache and
chat-config clear-token. One name doing two jobs (wipe endpoint cache
AND user-supplied token) was misleading; each subcommand now touches
exactly one store.
- utils.py: replace the manual deployments / tokens dict-walking +
per-entry model_validate with a single DeploymentChatCache.model_validate
/ DeploymentChatConfig.model_validate call. Pydantic now does both UUID
key parsing and entry validation; per-record resilience downgrades to
per-file resilience (a tampered file falls back to an empty store).
Tests retire the per-entry skip cases since the loader is fail-all-or-
none now, but still verify that an invalid UUID key or malformed entry
yields an empty store rather than crashing.1 parent cdbb40f commit 482bd12
4 files changed
Lines changed: 50 additions & 86 deletions
File tree
- src/ai/backend/client/cli/v2/deployment/chat
- tests/unit/client/cli
Lines changed: 16 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | | - | |
270 | | - | |
| 269 | + | |
| 270 | + | |
271 | 271 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 272 | + | |
277 | 273 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 274 | + | |
282 | 275 | | |
283 | | - | |
| 276 | + | |
284 | 277 | | |
285 | 278 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
295 | 287 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 288 | + | |
300 | 289 | | |
301 | 290 | | |
302 | 291 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
27 | 44 | | |
28 | 45 | | |
29 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
55 | 42 | | |
56 | 43 | | |
57 | 44 | | |
| |||
64 | 51 | | |
65 | 52 | | |
66 | 53 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
78 | 58 | | |
79 | 59 | | |
80 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | | - | |
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 113 | | |
120 | 114 | | |
121 | 115 | | |
122 | 116 | | |
123 | | - | |
124 | | - | |
| 117 | + | |
125 | 118 | | |
126 | | - | |
| 119 | + | |
127 | 120 | | |
128 | | - | |
129 | | - | |
130 | 121 | | |
131 | 122 | | |
132 | 123 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 124 | + | |
139 | 125 | | |
140 | 126 | | |
141 | 127 | | |
142 | 128 | | |
143 | | - | |
144 | | - | |
| 129 | + | |
145 | 130 | | |
146 | 131 | | |
147 | 132 | | |
| |||
150 | 135 | | |
151 | 136 | | |
152 | 137 | | |
153 | | - | |
| 138 | + | |
154 | 139 | | |
155 | | - | |
156 | 140 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 141 | + | |
163 | 142 | | |
164 | 143 | | |
165 | | - | |
166 | | - | |
| 144 | + | |
167 | 145 | | |
168 | 146 | | |
169 | 147 | | |
| |||
0 commit comments