Commit 966b07a
committed
fix(hpc): address #218 review — fidelity length-guard + edge_codec examples & decode asserts
- reliability: FidelityReport::compute returns a DEGENERATE report (zeros,
rel_l2=1.0) on length mismatch instead of silently truncating to the shorter
prefix (codex P2 + coderabbit Major) — consistent with the module's
return-degenerate-not-panic convention; a dropped tail can't read as high fidelity.
- edge_codec: added runnable /// examples to the 6 remaining public methods
(Codebook::assign/centroid, CoarseResidueCodec::encode/reconstruct,
ProductQuantizer::encode/reconstruct) per all-public-APIs-need-examples.
- edge_codec: both reconstruct() decoders now assert the packed-code length
(dim/2, m/2) so malformed input fails with a clear message instead of an
out-of-bounds panic deep in unpack (coderabbit Major).
edge_codec doctests 4→10; reliability 5; unit tests green; clippy -D warnings clean.
https://claude.ai/code/session_01D2WSmezQBNC3bUdHuGfGmo1 parent aa235b7 commit 966b07a
2 files changed
Lines changed: 83 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
| |||
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
149 | 165 | | |
150 | 166 | | |
151 | 167 | | |
| |||
245 | 261 | | |
246 | 262 | | |
247 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
248 | 273 | | |
249 | 274 | | |
250 | 275 | | |
| |||
261 | 286 | | |
262 | 287 | | |
263 | 288 | | |
264 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
265 | 300 | | |
266 | 301 | | |
| 302 | + | |
267 | 303 | | |
268 | 304 | | |
269 | 305 | | |
| |||
320 | 356 | | |
321 | 357 | | |
322 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
323 | 367 | | |
324 | 368 | | |
325 | 369 | | |
| |||
334 | 378 | | |
335 | 379 | | |
336 | 380 | | |
337 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
338 | 392 | | |
| 393 | + | |
339 | 394 | | |
340 | 395 | | |
341 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
236 | 242 | | |
237 | 243 | | |
238 | 244 | | |
| |||
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
245 | 255 | | |
246 | 256 | | |
247 | | - | |
248 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
249 | 272 | | |
250 | 273 | | |
251 | 274 | | |
| |||
0 commit comments