Commit Graph
57 Commits
Author SHA1 Message Date
Голиков Maximillian Антон fa3e919ad4 fix(student-tests):lab4 parse JSON body for 201 uploads 2026-10-23 11:27:08 +03:00
Голиков Maximillian Антон e799879f9e test(student):lab4 attachments negative cases
- 11 MiB body -> 413 payload_too_large
- truncated PNG -> 415 unsupported_media_type
- MIME mismatch (PNG bytes as image/jpeg) -> 201, content_type image/png
- outsider access to metadata and bytes -> 404
- foreign-chat attachment_id in message -> 404
- 11 attachment_ids -> 400 invalid_request
- duplicate attachment_ids -> 400 invalid_request
- empty filename -> 400
- path-traversal / backslash / NUL in filename -> 400
All rejections are 4xx; no 500 on user error.
2026-10-23 11:15:42 +03:00
Голиков Maximillian Антон 6c78efa17d feat(cmd,compose):lab4 run reconciler under postgres advisory lock 2026-10-23 10:32:08 +03:00
Голиков Maximillian Антон 43ef67ae7e feat(service):lab4 sweep orphan objects in S3 2026-10-23 10:04:12 +03:00
Голиков Maximillian Антон eff1fc3ded feat(service):lab4 sweep stale pending attachments 2026-10-23 09:38:47 +03:00
Голиков Maximillian Антон 7afa6133fa feat(service):lab4 add advisory lock to Reconciler.tick 2026-10-23 09:15:21 +03:00
Голиков Maximillian Антон c73167de34 feat(service):lab4 add Reconciler scaffold and Run loop 2026-10-23 08:53:44 +03:00
Голиков Maximillian Антон 9131dd9278 feat(config):lab4 add reconciler settings
- RECONCILER_ENABLED (default true)
- RECONCILER_INTERVAL_SECONDS (default 300 = 5 min)
- RECONCILER_GRACE_SECONDS (default 3600 = 1 hour)
Grace period ensures fresh uploads (< 1h pending) are not touched.
2026-10-23 08:12:30 +03:00
Голиков Maximillian Антон c367a970e2 chore(scripts):lab4 add stop-one.sh for failover test 2026-10-22 20:47:12 +03:00
Голиков Maximillian Антон e9213a533e chore(scripts):lab4 add restart.sh for persistence test 2026-10-22 20:14:29 +03:00
Голиков Maximillian Антон 42010e1209 chore(git):lab4 enforce LF for shell, Dockerfile, YAML 2026-10-22 19:42:03 +03:00
Голиков Maximillian Антон b6b3b94819 fix(postgres):lab4 non-nil empty slice in ListStalePending 2026-10-22 18:16:07 +03:00
Голиков Maximillian Антон 46423faf8d hotfix(postgres):lab4 wrap raw error in MessageRepo.Create 2026-10-22 18:05:41 +03:00
Голиков Maximillian Антон f02d3b447d fix(migrations): lab4 add allow empty message text 2026-10-22 17:55:14 +03:00
Голиков Maximillian Антон d45345366b chore(compose):lab4 wire S3 config into api
- S3_* env + s3_access_key_id/s3_secret_access_key secrets
- depends_on: minio healthy, mc-init completed
- API uses dedicated S3 credentials, not root
2026-10-22 17:12:28 +03:00
Голиков Maximillian Антон c8bbece449 feat(cmd):lab4 wire ObjectStorage and AttachmentService into main 2026-10-22 16:52:41 +03:00
Голиков Maximillian Антон 4a94b0a5a0 fix(postgres):lab4 add missing ExistingKeys to AttachmentRepo 2026-10-22 16:10:23 +03:00
Голиков Maximillian Антон 4d28ae549a feat(domain,storage/s3):lab4 add ObjectStorage.Ping 2026-10-22 15:34:56 +03:00
Голиков Maximillian Антон 1755a64f1a feat(handler):lab4 pass attachment_ids to MessageService 2026-10-22 14:38:23 +03:00
Голиков Maximillian Антон 297a1858a3 feat(domain,service):lab4 accept attachment_ids in idempotent request hash 2026-10-22 14:35:04 +03:00
Голиков Maximillian Антон 0834ac822a fix(dto):lab4 allow empty text when attachment_ids present 2026-10-22 13:52:11 +03:00
Голиков Maximillian Антон 0a72eab1da feat(httpapi):lab4 register attachment routes in router 2026-10-22 13:10:08 +03:00
Голиков Maximillian Антон f4fb287659 feat(handler):lab4 add AttachmentHandler.Content without redirect 2026-10-22 11:04:15 +03:00
Голиков Maximillian Антон 6db5900099 feat(handler):lab4 add AttachmentHandler.Get 2026-10-22 10:08:31 +03:00
Голиков Maximillian Антон c83f6c4a9b feat(handler):lab4 add AttachmentHandler with Upload 2026-10-22 09:12:47 +03:00
Голиков Maximillian Антон d3cc2113fe feat(dto):lab4 include attachment_ids in Message response 2026-10-21 19:14:37 +03:00
Голиков Maximillian Антон c912fe437e feat(dto):lab4 add AttachmentResponse 2026-10-21 20:03:10 +03:00
Голиков Maximillian Антон d62e74f3ac feat(service):lab4 add AttachmentService.Upload with S3 and compensation
- Upload: LimitReader -> DetectContentType -> DecodeConfig -> sha256
- Create(pending) -> Put -> MarkReady
- MarkFailed on Put error (compensation, avoid hanging pending rows)
- Download: member check + status ready via ObjectStorage
- Get: member check by chat_id
2026-10-21 19:04:22 +03:00
Голиков Maximillian Антон 15a2d7aa85 feat(service):lab4 add AttachmentService.Download via ObjectStorage 2026-10-21 18:19:34 +03:00
Голиков Maximillian Антон 21363f5b91 feat(service):lab4 add AttachmentService.Get with member check 2026-10-21 17:52:07 +03:00
Голиков Maximillian Антон 4a71b690c3 feat(service):lab4 add AttachmentService scaffold with helpers 2026-10-21 17:28:11 +03:00
Голиков Maximillian Антон a632a37080 feat(domain):lab4 add Expected hint to UnsupportedMediaTypeError 2026-10-21 16:53:02 +03:00
Голиков Maximillian Антон 7a0b02fc4e fix(s3/init):lab4 make mc-init idempotent without grep and mktemp 2026-10-21 16:20:00 +03:00
Голиков Maximillian Антон aa6fee6e82 chore(compose):lab4 add mc-init for bucket, api user and policy 2026-10-21 15:58:00 +03:00
Голиков Maximillian Антон f14111ccdf chore(compose):lab4 add MinIO service with volume and healthcheck 2026-10-21 12:45:26 +03:00
Голиков Maximillian Антон cbf553e183 feat(config):lab4 add optional S3 settings 2026-10-21 11:28:36 +03:00
Голиков Maximillian Антон 0e5b7375d5 fix(storage/s3):lab4 fail fast when bucket does not exist and chore deps 2026-10-21 10:49:06 +03:00
Голиков Maximillian Антон 6fb1e27375 feat(storage/s3):lab4 add MinIO-backed ObjectStorage 2026-10-21 10:33:06 +03:00
Голиков Maximillian Антон a4a8c3e473 feat(config):lab4 add S3 settings 2026-10-20 09:48:02 +03:00
Голиков Maximillian Антон f88c746b5e feat(domain):lab4 add ObjectStorage interface 2026-10-20 08:57:23 +03:00
Голиков Maximillian Антон cace078c65 feat(postgres):lab4 load attachment ids in ListByChat 2026-10-20 08:22:38 +03:00
Голиков Maximillian Антон 57efb9ce0d feat(postgres):lab4 add loadAttachmentIDs helper 2026-10-19 21:29:36 +03:00
Голиков Maximillian Антон 6cc487b0f3 feat(postgres):lab4 wire validate and link attachments into CreateIdempotent 2026-10-19 20:00:11 +03:00
Голиков Maximillian Антон 936747fe76 feat(postgres):lab4 add linkAttachments helper 2026-10-19 19:04:11 +03:00
Голиков Maximillian Антон 9becd7ddf0 feat(postgres):lab4 add validateAttachments helper 2026-10-19 18:23:00 +03:00
Голиков Maximillian Антон 54eca57152 feat(postgres):lab4 expose Attachments() via Storage 2026-10-19 16:21:55 +03:00
Голиков Maximillian Антон d22d493b1a feat(postgres):lab4 add AttachmentRepo.ExistingKeys and interface assertion 2026-10-19 15:44:08 +03:00
Голиков Maximillian Антон 8fe9e0a962 feat(postgres):lab4 add AttachmentRepo.MarkReady and MarkFailed 2026-10-19 13:53:08 +03:00
Голиков Maximillian Антон d208a7bef3 feat(postgres):lab4 add AttachmentRepo.GetByID 2026-10-19 12:41:08 +03:00
Голиков Maximillian Антон 17f8a65e87 feat(postgres):lab4 add AttachmentRepo scaffold and Create 2026-10-19 11:48:30 +03:00