Commit 87561fd
committed
fix(sqs): RecognisesPartitionedKey checks prefix only, not full parse
Round 5 review on PR #715 raised a nit: RecognisesPartitionedKey
delegated to parsePartitionedSQSKey, which fails when the queue
segment is malformed base64 or the partition segment is truncated.
For such corrupt-shape keys the predicate returned false, so the
router fell through to the engine and silently routed via routeKey's
!sqs|route|global collapse to the SQS catalog default group —
exactly the failure mode the round 5 fail-closed change was
introduced to prevent.
The fix is the structural-only intent the kv.PartitionResolver
contract already documents: "Implementations answer purely on
prefix / structural inspection". Make RecognisesPartitionedKey
match the intent — accept ANY key that starts with one of the
partitioned family prefixes, regardless of subsequent corruption.
ResolveGroup still returns (0, false) for malformed keys, and the
router pairs that with Recognised=true to fail closed.
Tests
- TestSQSPartitionResolver_RecognisesMalformedPartitionedKey:
three sub-cases pin the new contract — prefix-only, prefix +
invalid base64 queue segment, prefix + valid queue + '|' but
truncated partition bytes. All assert Recognised=true and
ResolveGroup ok=false, which is exactly the fail-closed pairing
the router consumes.
- Existing TestSQSPartitionResolver_RecognisesPartitionedKey
cases stay valid (the well-formed shapes still match).1 parent b4bf81c commit 87561fd
2 files changed
Lines changed: 60 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | | - | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
283 | 334 | | |
284 | 335 | | |
285 | 336 | | |
| |||
0 commit comments