Avatar upload, content-addressed GET, DELETE, and PATCH cleanup #20
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/server!20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/avatar-upload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #16, #17, #18, #19 (parent #15).
Summary
internal/imagesniff(magic-byte detection, stable rejection categories), newinternal/avatarstore(content-addressedavatar-<sha256>.<ext>, atomic write + prior-file cleanup, idempotent on identical bytes),PUT /api/v1/identity/avatar(1 MiB cap, SSE fanout), publicGET /avatar-<hash>.<ext>(immutable cache, ETag, If-None-Match → 304, 404 on stale/no-avatar)./api/v1/identityno longer acceptsavatar;DisallowUnknownFieldsmakes a stray field 400 the request.DELETE /api/v1/identity/avatar— idempotent, only publishesidentity-changedwhen something was cleared..jpgwithContent-Type: image/jpeg.CLIENT_API.md documents the full surface and the iOS JPEG-for-photos guidance from PRD #15.
Test plan
go test ./internal/imagesniff/...— format table, rejection categoriesgo test ./internal/avatarstore/...— atomic write, replacement deletes prior, idempotent, locate ignores siblings, remove, readgo test ./internal/api/...— PUT round-trip, 400/413 categories, GET immutable cache + ETag, stale-hash 404, no-avatar 404, anonymous GET, PNG→JPEG transition, DELETE clears + idempotency, PATCH rejectsavatar