Commit 05d2bb7
Add short-body truncation tests for fixed-width response decoders
The fixed-width response decoders (FailureResponse, WelcomeResponse,
MetadataResponse, ResultResponse, DbResponse) all rely on the
primitive decode helpers (decode_uint32 / decode_uint64) raising
DecodeError on short input. That behaviour is well-covered by the
helpers' own tests, but the message-class wrappers have no direct
coverage — a future refactor that swaps a helper for a looser one
would regress silently.
Parametrise a short-body test over the five fixed-width response
classes, one iteration per length below the minimum body. Add a
targeted test for LeaderResponse.decode_body_legacy (no NUL
terminator must raise) and pin the current lax EmptyResponse
behaviour explicitly so any future tightening is a deliberate
decision, not a silent refactor side-effect.
Variable-size response bodies (RowsResponse, ServersResponse,
FilesResponse) are intentionally out of scope — they already have
targeted truncation tests and cover their own edge cases directly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8aea406 commit 05d2bb7
1 file changed
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
0 commit comments