Commit 5a67834
committed
admin: address PR #669 review (route comment, ValidationError test, MaxBytes nil doc)
Three actionable findings from claude review on 91a48ef:
1) **Medium: stale route-table comment in `buildAPIMux`**
`internal/admin/server.go`: the comment block listing the routes
only mentioned the two GET S3 endpoints. Added the three new
write endpoints (POST /buckets, DELETE /buckets/{name}, PUT
/buckets/{name}/acl) so a future reader does not have to
reverse-engineer the routing from `servePerBucket`.
2) **Medium: missing handler-level `*ValidationError` test**
`s3_handler_test.go`: `writeBucketsError`'s `errors.As(err,
&verr)` arm was exercised end-to-end via the bridge translation
but had no direct handler-level coverage. Added
`TestS3Handler_WriteEndpoints_ValidationErrorReturns400` —
three sub-cases (create / put_acl / delete) injecting a
`*ValidationError` directly into the stub source and asserting
400 + `invalid_request` + the message. Locks the arm down so a
future refactor that drops the `errors.As` branch fails CI
immediately.
3) **Minor: `MaxBytesReader(nil, ...)` undocumented**
`s3_handler.go`: added an explanatory comment at the call site.
Passing nil is safe because `MaxBytesReader`'s only writer use
is the connection-close optimisation (a comma-ok type assertion
that no-ops on nil); the cap itself is enforced regardless. We
pass nil because the helper takes only `io.Reader` so it remains
usable from non-HTTP entry points (the upcoming AdminForward
decoder reuses the same shape). The 413 path still works via
`errAdminS3BodyTooLarge` matching on `*http.MaxBytesError`.
Findings #3 (failed-write audit log) and #5 (DisallowUnknownFields
error message) were noted as pre-existing patterns shared with the
Dynamo side; tracking them separately rather than diverging on
this slice.1 parent 56a547c commit 5a67834
3 files changed
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
440 | 451 | | |
441 | 452 | | |
442 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
651 | 703 | | |
652 | 704 | | |
653 | 705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
214 | 215 | | |
| 216 | + | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
0 commit comments