Repository navigation
Commit e92516d
Refactor materialization operations to use MaterializeOp model (#92)
## Summary
Refactors the materialization operation logic to use a dedicated
`MaterializeOp` model, replacing inline/ad-hoc parameter handling with a
structured, typed approach. This aligns materialization operations with
the existing pattern used by other graph operations (e.g.,
`UpgradeTierOp`).
## Key Accomplishments
- **New `MaterializeOp` model**: Introduced a dedicated Pydantic/data
model (`materialize_op.py`) that encapsulates all parameters and
validation logic for materialization operations, improving type safety
and maintainability.
- **New `UpgradeTierOpNewTier` model**: Added a supporting model for the
upgrade tier operation's new tier representation, further strengthening
the type system across graph operations.
- **New `DatabaseHealthResponse` model**: Added a structured model for
database health responses (93 lines of new model code), replacing
loosely-typed response handling.
- **Simplified `op_materialize.py`**: Reduced the materialization
operation module by ~100 lines by delegating parameter construction and
validation to the new `MaterializeOp` model, significantly improving
readability and reducing duplication.
- **Updated `graph_client.py`**: Adjusted the graph client to work with
the new model-based approach for materialization calls.
- **Exported new models**: Updated `models/__init__.py` to expose the
new models as part of the public API.
## Breaking Changes
- **API surface change**: Consumers that previously constructed
materialization operation parameters inline will need to migrate to
using the `MaterializeOp` model. The method signatures in the graph
client have been updated accordingly.
- **Model imports**: New models are now available via
`robosystems_client.models`; any code importing directly from internal
modules may need path updates.
## Testing Notes
- Existing materialization tests (`test_materialization_client.py`) have
been updated to reflect the new model-based interface.
- Verify that all materialization workflows (create, update, delete)
function correctly end-to-end with the new `MaterializeOp` model.
- Validate that the `DatabaseHealthResponse` model correctly
deserializes health check responses from the API.
## Infrastructure Considerations
- No new dependencies introduced; the new models follow existing
patterns and frameworks already in use.
- Downstream services or CI pipelines that depend on the materialization
client interface should be validated against the updated method
signatures.
- This is a stepping stone toward a consistent model-driven pattern for
all graph operations, making future operation additions more
straightforward.
---
🤖 Generated with [Claude Code](https://claude.ai/code)
**Branch Info:**
- Source: `refactor/additional-graph-ops`
- Target: `main`
- Type: feature
Co-Authored-By: Claude <noreply@anthropic.com>8 files changed
Lines changed: 260 additions & 123 deletions
File tree
- robosystems_client
- api/graph_operations
- clients
- models
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 19 | + | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 26 | | |
52 | 27 | | |
53 | 28 | | |
54 | 29 | | |
55 | 30 | | |
56 | | - | |
57 | 31 | | |
58 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
59 | 37 | | |
60 | 38 | | |
61 | 39 | | |
| |||
125 | 103 | | |
126 | 104 | | |
127 | 105 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 106 | + | |
134 | 107 | | |
135 | 108 | | |
136 | 109 | | |
137 | 110 | | |
138 | 111 | | |
139 | 112 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 113 | | |
144 | 114 | | |
145 | 115 | | |
146 | 116 | | |
147 | 117 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 118 | | |
| 119 | + | |
155 | 120 | | |
156 | 121 | | |
157 | 122 | | |
| |||
163 | 128 | | |
164 | 129 | | |
165 | 130 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 131 | + | |
172 | 132 | | |
173 | 133 | | |
174 | 134 | | |
| |||
183 | 143 | | |
184 | 144 | | |
185 | 145 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 146 | + | |
192 | 147 | | |
193 | 148 | | |
194 | 149 | | |
195 | 150 | | |
196 | 151 | | |
197 | 152 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | 153 | | |
202 | 154 | | |
203 | 155 | | |
204 | 156 | | |
205 | 157 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | 158 | | |
| 159 | + | |
213 | 160 | | |
214 | 161 | | |
215 | 162 | | |
| |||
222 | 169 | | |
223 | 170 | | |
224 | 171 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 172 | + | |
231 | 173 | | |
232 | 174 | | |
233 | 175 | | |
| |||
236 | 178 | | |
237 | 179 | | |
238 | 180 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 181 | + | |
245 | 182 | | |
246 | 183 | | |
247 | 184 | | |
248 | 185 | | |
249 | 186 | | |
250 | 187 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | 188 | | |
255 | 189 | | |
256 | 190 | | |
257 | 191 | | |
258 | 192 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | 193 | | |
| 194 | + | |
266 | 195 | | |
267 | 196 | | |
268 | 197 | | |
| |||
274 | 203 | | |
275 | 204 | | |
276 | 205 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 206 | + | |
283 | 207 | | |
284 | 208 | | |
285 | 209 | | |
| |||
292 | 216 | | |
293 | 217 | | |
294 | 218 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 219 | + | |
301 | 220 | | |
302 | 221 | | |
303 | 222 | | |
304 | 223 | | |
305 | 224 | | |
306 | 225 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | 226 | | |
311 | 227 | | |
312 | 228 | | |
313 | 229 | | |
314 | 230 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | 231 | | |
| 232 | + | |
322 | 233 | | |
323 | 234 | | |
324 | 235 | | |
| |||
332 | 243 | | |
333 | 244 | | |
334 | 245 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 246 | + | |
341 | 247 | | |
342 | 248 | | |
343 | 249 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
| 337 | + | |
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
343 | 347 | | |
344 | 348 | | |
345 | 349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| |||
366 | 367 | | |
367 | 368 | | |
368 | 369 | | |
| 370 | + | |
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
| |||
563 | 565 | | |
564 | 566 | | |
565 | 567 | | |
| 568 | + | |
566 | 569 | | |
567 | 570 | | |
568 | 571 | | |
| |||
692 | 695 | | |
693 | 696 | | |
694 | 697 | | |
| 698 | + | |
695 | 699 | | |
696 | 700 | | |
697 | 701 | | |
| |||
0 commit comments