Commit c08cbd7
Align CBM serialized form with declared schema
`ConsecutiveBlockMinimization`'s `ProblemSchemaEntry::fields` declares
`matrix` and `bound`, but its serialized form also wrote `num_rows` and
`num_cols`, and its `try_from` rejected JSON that lacked them. This made
the schema-driven `pred create` path fail with "missing field `num_rows`"
for any caller that built JSON from the declared schema fields.
`num_rows` and `num_cols` are fully derived from `matrix` (just
`matrix.len()` and `matrix[0].len()`), so they don't belong in the wire
format. Switch to symmetric `serde(try_from / into = Def)` so both
serialize and deserialize round-trip through the minimal `{matrix, bound}`
form, and let `try_new` recompute the cached dimensions on the way in.
The cached fields stay on the in-memory struct for fast getter access.
Replace the now-unreachable inconsistent-dimensions test with one that
pins the minimal wire format and one that exercises ragged-matrix
rejection — the actual remaining input validation.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent cbfad84 commit c08cbd7
2 files changed
Lines changed: 27 additions & 20 deletions
File tree
- src
- models/algebraic
- unit_tests/models/algebraic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
187 | | - | |
| 190 | + | |
188 | 191 | | |
189 | 192 | | |
190 | | - | |
191 | | - | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
211 | 209 | | |
212 | | - | |
213 | 210 | | |
214 | 211 | | |
215 | 212 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
96 | 106 | | |
97 | | - | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| |||
0 commit comments