Commit 83b3ac4
fix(BA-5983): preserve unset semantics in ModelDefinitionInput.to_draft
``ModelDefinitionInput.to_draft()`` used ``model_dump()`` with default
arguments, which dumps every field — including the unset ones at their
``None`` default. Round-tripping that through ``model_validate`` left
the resulting draft with ``model_fields_set`` containing every field,
so every ``None`` looked "explicitly set" and clobbered lower-priority
baselines during the revision merge chain.
Switch to ``model_dump(exclude_unset=True)`` so the resulting draft's
``model_fields_set`` reflects only what the caller actually provided.
This is what makes the BA-5983 scenario actually work end-to-end: a
request that omits ``name`` / ``model_path`` / ``service.port`` /
``health_check.path`` lets the variant baseline (or preset) fill them
in instead of nulling them out.
Extend the merge test to cover this directly — every "missing required
field" scenario now layers a baseline draft together with a request
draft so the merge actually combines fields across sources. Without
the fix, the model_path / service_port / health_check_path cases
would raise the wrong error first (e.g. ``ModelConfig.name is required``
fires before ``model_path``) because every request-side ``None`` would
clobber the baseline's preserved value.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d3cf04c commit 83b3ac4
2 files changed
Lines changed: 86 additions & 35 deletions
File tree
- src/ai/backend/common/dto/manager/v2/deployment
- tests/unit/manager/sokovan/deployment
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
Lines changed: 80 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
177 | 182 | | |
178 | 183 | | |
179 | | - | |
| 184 | + | |
180 | 185 | | |
181 | 186 | | |
182 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
183 | 200 | | |
184 | | - | |
| 201 | + | |
185 | 202 | | |
186 | 203 | | |
187 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
188 | 217 | | |
189 | | - | |
| 218 | + | |
190 | 219 | | |
191 | 220 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
201 | 235 | | |
202 | | - | |
| 236 | + | |
203 | 237 | | |
204 | 238 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
217 | 265 | | |
218 | | - | |
| 266 | + | |
219 | 267 | | |
220 | 268 | | |
221 | 269 | | |
222 | | - | |
223 | | - | |
| 270 | + | |
| 271 | + | |
224 | 272 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 273 | + | |
228 | 274 | | |
229 | 275 | | |
230 | 276 | | |
| |||
0 commit comments